From 3523c691a198832918c007b2353f4c4a54d4fa38 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 10 Dec 2025 11:38:18 +0100 Subject: [PATCH 1/4] Dynamic version from JS --- bqplot_gl/_version.py | 7 ------- pyproject.toml | 22 +++++++++++++++++++--- scripts/write_version.py | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 10 deletions(-) delete mode 100644 bqplot_gl/_version.py create mode 100644 scripts/write_version.py diff --git a/bqplot_gl/_version.py b/bqplot_gl/_version.py deleted file mode 100644 index b07aeaa..0000000 --- a/bqplot_gl/_version.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -# Copyright (c) The bqplot Development Team. -# Distributed under the terms of the Modified BSD License. - -__version__ = "0.1.0a0" diff --git a/pyproject.toml b/pyproject.toml index ec1f0b3..cfa4b55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,9 @@ [build-system] requires = [ + "hatch", "hatchling", + "hatch-nodejs-version", + "hatch-build-scripts", "jupyterlab==4.*", ] build-backend = "hatchling.build" @@ -28,16 +31,19 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] dependencies = [ "bqplot>=0.13.0a0,<0.14", ] -version = "0.1.0a0" +dynamic = [ + "version", +] [project.license] file = "LICENSE" @@ -45,6 +51,9 @@ file = "LICENSE" [project.urls] Homepage = "https://github.com/bqplot/bqplot-gl" +[tool.hatch.version] +source = "nodejs" + [tool.hatch.build] artifacts = [ "bqplot_gl/nbextension/index.*", @@ -71,6 +80,13 @@ dependencies = [ ] build-function = "hatch_jupyter_builder.npm_builder" +[[tool.hatch.build.hooks.build-scripts.scripts]] +work_dir = "." +commands = ['python scripts/write_version.py'] +artifacts = [ + "bqplot_gl/_version.py" +] + [tool.hatch.build.hooks.jupyter-builder.build-kwargs] path = "." build_cmd = "build:prod" diff --git a/scripts/write_version.py b/scripts/write_version.py new file mode 100644 index 0000000..229fb31 --- /dev/null +++ b/scripts/write_version.py @@ -0,0 +1,15 @@ +import json, pathlib + + +pkg = pathlib.Path('bqplot_gl') +pkg.mkdir(exist_ok=True) + +with open('package.json') as f: + version = json.load(f)['version'] + +with open(pkg / '_version.py', 'w') as f: + f.write( + '# Auto-generated from package.json\n' + '\n' + f'__version__ = "{version}"\n' + ) From 67e712f3411e4084b54ee4745bff005390e98d1d Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 10 Dec 2025 11:39:21 +0100 Subject: [PATCH 2/4] Add gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9adfd4d..8cdaa83 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,5 @@ ui-tests/test-results/* ui-tests/playwright-report/* .yarn + +bqplot_gl/_version.py From 318d97fb00258f97c9eae0eece934887ab47039f Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 10 Dec 2025 14:16:36 +0100 Subject: [PATCH 3/4] Missing artifact --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index cfa4b55..dac73db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ source = "nodejs" artifacts = [ "bqplot_gl/nbextension/index.*", "bqplot_gl/labextension", + "bqscales/_version.py", ] [tool.hatch.build.targets.wheel.shared-data] From cc20d015fc9107994739e3ffa677191a7b742d30 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 10 Dec 2025 14:37:37 +0100 Subject: [PATCH 4/4] Wrong copy paste + unused config --- pyproject.toml | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index dac73db..0796c40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ source = "nodejs" artifacts = [ "bqplot_gl/nbextension/index.*", "bqplot_gl/labextension", - "bqscales/_version.py", + "bqplot_gl/_version.py", ] [tool.hatch.build.targets.wheel.shared-data] @@ -94,28 +94,3 @@ build_cmd = "build:prod" npm = [ "jlpm", ] - -[tool.tbump] -field = [ - { name = "channel", default = "" }, - { name = "release", default = "" }, -] - -[tool.tbump.version] -current = "0.1.0a0" -regex = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)((?Pa|b|rc|.dev)(?P\\d+))?" - -[tool.tbump.git] -message_template = "Bump to {new_version}" -tag_template = "v{new_version}" - -[[tool.tbump.file]] -src = "pyproject.toml" -version_template = "version = \"{major}.{minor}.{patch}{channel}{release}\"" - -[[tool.tbump.file]] -src = "bqplot_gl/_version.py" - -[[tool.tbump.file]] -src = "package.json" -version_template = "\"version\": \"{major}.{minor}.{patch}{channel}{release}\""