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

Commit

Permalink
Fix version number (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou authored Aug 3, 2023
1 parent caa4193 commit 3f74831
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions jupyterlite_xeus_python/_version.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import json
import sys
from pathlib import Path

__all__ = ["__version__"]


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

try:
with open(HERE / "package.json", "r") as f:
version = json.load(f)["version"]
return (
version.replace("-alpha.", "a")
.replace("-beta.", "b")
.replace("-rc.", "rc")
)
except FileNotFoundError:
pass
with open(package, "r") as f:
version = json.load(f)["version"]
return (
version.replace("-alpha.", "a")
.replace("-beta.", "b")
.replace("-rc.", "rc")
)


__version__ = _fetchVersion()

0 comments on commit 3f74831

Please sign in to comment.