Skip to content

Commit 4e6361d

Browse files
authored
Fix __init__.py for wheel (#99)
* Update __init__.py * Test importing the package
1 parent 3ef6c49 commit 4e6361d

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

.github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
7373
pip install "jupyterlab>=4.0.0,<5" jupyterlab_vim*.whl
7474
75+
python -c "import jupyterlab_vim"
7576
7677
jupyter labextension list
7778
jupyter labextension list 2>&1 | grep -ie "@axlair/jupyterlab_vim.*OK"

jupyterlab_vim/__init__.py

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
2-
import json
3-
from pathlib import Path
4-
5-
from ._version import __version__
6-
7-
HERE = Path(__file__).parent.resolve()
8-
9-
with (HERE / "labextension" / "package.json").open() as fid:
10-
data = json.load(fid)
1+
try:
2+
from ._version import __version__
3+
except ImportError:
4+
# Fallback when using the package in dev mode without installing
5+
# in editable mode with pip. It is highly recommended to install
6+
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
7+
import warnings
8+
warnings.warn("Importing 'jupyterlab_vim' outside a proper installation.")
9+
__version__ = "dev"
1110

1211
def _jupyter_labextension_paths():
1312
return [{
1413
"src": "labextension",
1514
"dest": "@axlair/jupyterlab_vim",
1615
}]
17-

0 commit comments

Comments
 (0)