From 17e0a3eaee0fbcf79c45ba7a7ca2042b84ebc7c6 Mon Sep 17 00:00:00 2001 From: Sarantopoulos Konstantinos Date: Wed, 22 Jun 2022 14:49:15 +0300 Subject: [PATCH 1/3] Enable publishing beta versions --- azure-pipelines.yaml | 8 ++++++-- setup.py | 13 ++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml index 6258f31..ee89307 100644 --- a/azure-pipelines.yaml +++ b/azure-pipelines.yaml @@ -129,6 +129,12 @@ stages: env: NPM_TOKEN: $(NPM_TOKEN) + - script: | + latestGitTag=$(git describe --tags --abbrev=0) + latestGitTag="${latestGitTag:1}" + npm version $latestGitTag --no-commit-hooks --no-git-tag-version + displayName: 'Update package.json version' + - script: jlpm run build:prod displayName: 'Build jupyterlab extension' env: @@ -149,10 +155,8 @@ stages: displayName: 'Release to Pypi' - script: | - currentVersion=$(./node_modules/.bin/git-tag-version) latestGitTag=$(git describe --tags --abbrev=0) latestGitTag="${latestGitTag:1}" - echo $currentVersion echo $latestGitTag if [[ $latestGitTag == *"beta"* ]]; then diff --git a/setup.py b/setup.py index 0c39b40..d948b10 100644 --- a/setup.py +++ b/setup.py @@ -33,13 +33,16 @@ # Get the package info from package.json pkg_json = json.loads((HERE / "package.json").read_bytes()) +version = ( + pkg_json["version"] + .replace("-alpha.", "a") + .replace("-beta.", "b") + .replace("-rc.", "rc") +) + setup_args = dict( name=name, - use_scm_version={ - "version_scheme": "guess-next-dev", - "local_scheme": "dirty-tag", - "write_to": "pybabylonjs/version.py", - }, + version=version, setup_requires=[ "setuptools-scm>=1.5.4", "setuptools-scm-git-archive", From 0045eacfa0699f23c67a4ea4e876c5572ce75331 Mon Sep 17 00:00:00 2001 From: Sarantopoulos Konstantinos Date: Wed, 22 Jun 2022 21:20:15 +0300 Subject: [PATCH 2/3] Get module version from package.json's version --- pybabylonjs/_frontend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pybabylonjs/_frontend.py b/pybabylonjs/_frontend.py index 0d9a72f..03d1697 100644 --- a/pybabylonjs/_frontend.py +++ b/pybabylonjs/_frontend.py @@ -3,10 +3,11 @@ # Copyright (c) TileDB, Inc.. # Distributed under the terms of the Modified BSD License. +from ._version import __version__ """ Information about the frontend package of the widgets. """ module_name = "@tiledb-inc/pybabylonjs" -module_version = ">=1.0.4" +module_version = "==" + __version__ From b4968e97c9a6df88b8fc195d31a672e4710f6076 Mon Sep 17 00:00:00 2001 From: Sarantopoulos Konstantinos Date: Thu, 23 Jun 2022 13:24:31 +0300 Subject: [PATCH 3/3] Use npm version as module_version instead of the pypi, since they follow different format for prereleases --- pybabylonjs/_frontend.py | 4 ++-- pybabylonjs/_version.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pybabylonjs/_frontend.py b/pybabylonjs/_frontend.py index 03d1697..1e5de2e 100644 --- a/pybabylonjs/_frontend.py +++ b/pybabylonjs/_frontend.py @@ -3,11 +3,11 @@ # Copyright (c) TileDB, Inc.. # Distributed under the terms of the Modified BSD License. -from ._version import __version__ +from ._version import __npm_version__ """ Information about the frontend package of the widgets. """ module_name = "@tiledb-inc/pybabylonjs" -module_version = "==" + __version__ +module_version = __npm_version__ diff --git a/pybabylonjs/_version.py b/pybabylonjs/_version.py index da102d4..b62b2a9 100644 --- a/pybabylonjs/_version.py +++ b/pybabylonjs/_version.py @@ -11,15 +11,15 @@ def _fetchVersion(): try: with settings.open() as f: version = json.load(f)["version"] - return ( - version.replace("-alpha.", "a") - .replace("-beta.", "b") - .replace("-rc.", "rc") - ) + return version except FileNotFoundError: pass raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}") -__version__ = _fetchVersion() +__npm_version__ = _fetchVersion() + +__version__ = ( + __npm_version__.replace("-alpha.", "a").replace("-beta.", "b").replace("-rc.", "rc") +)