Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Commit 3f74831

Browse files
authored
Fix version number (#147)
1 parent caa4193 commit 3f74831

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

jupyterlite_xeus_python/_version.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
import json
2+
import sys
23
from pathlib import Path
34

45
__all__ = ["__version__"]
56

67

78
def _fetchVersion():
8-
HERE = Path(__file__).parent.resolve()
9+
prefix = Path(sys.prefix)
10+
package = prefix / "share" / "jupyter" / "labextensions" / "@jupyterlite" / "xeus-python-kernel" / "package.json"
911

10-
try:
11-
with open(HERE / "package.json", "r") as f:
12-
version = json.load(f)["version"]
13-
return (
14-
version.replace("-alpha.", "a")
15-
.replace("-beta.", "b")
16-
.replace("-rc.", "rc")
17-
)
18-
except FileNotFoundError:
19-
pass
12+
with open(package, "r") as f:
13+
version = json.load(f)["version"]
14+
return (
15+
version.replace("-alpha.", "a")
16+
.replace("-beta.", "b")
17+
.replace("-rc.", "rc")
18+
)
2019

2120

2221
__version__ = _fetchVersion()

0 commit comments

Comments
 (0)