A monorepo containing jupyter-blocks and jupyter-tidyblocks. Blockly extension for JupyterLab.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #89 from QuantStack/bumpVersion

Restore `bump-version` script

authored by

Denisa Checiu and committed by
GitHub
92f8b725 a858e27c

+82 -4
+6 -4
pyproject.toml
··· 71 71 build_dir = "jupyterlab_blockly/labextension" 72 72 73 73 [tool.jupyter-releaser.options] 74 - version_cmd = "hatch version" 74 + version_cmd = "python scripts/bump-version.py --force" 75 75 76 76 [tool.jupyter-releaser.hooks] 77 - before-build-npm = [ 77 + before-bump-version = [ 78 78 "python -m pip install 'jupyterlab>=4.0.0,<5'", 79 - "jlpm", 80 - "jlpm build:prod" 79 + "jlpm" 80 + ] 81 + before-build-npm = [ 82 + "YARN_ENABLE_IMMUTABLE_INSTALLS=0 jlpm build:prod" 81 83 ] 82 84 before-build-python = [ 83 85 # Build the assets
+76
scripts/bump-version.py
··· 1 + ############################################################################# 2 + # Copyright (c) 2024, Voila Contributors # 3 + # Copyright (c) 2024, QuantStack # 4 + # # 5 + # Distributed under the terms of the BSD 3-Clause License. # 6 + # # 7 + # The full license is in the file LICENSE, distributed with this software. # 8 + ############################################################################# 9 + 10 + import json 11 + from pathlib import Path 12 + 13 + import click 14 + from jupyter_releaser.util import get_version, run 15 + from pkg_resources import parse_version 16 + 17 + LERNA_CMD = "jlpm lerna version --no-push --force-publish --no-git-tag-version" 18 + 19 + 20 + @click.command() 21 + @click.option("--force", default=False, is_flag=True) 22 + @click.argument("spec", nargs=1) 23 + def bump(force, spec): 24 + status = run("git status --porcelain").strip() 25 + if len(status) > 0: 26 + raise Exception("Must be in a clean git state with no untracked files") 27 + 28 + curr = parse_version(get_version()) 29 + if spec == 'next': 30 + spec = f"{curr.major}.{curr.minor}." 31 + if curr.pre: 32 + p, x = curr.pre 33 + spec += f"{curr.micro}{p}{x + 1}" 34 + else: 35 + spec += f"{curr.micro + 1}" 36 + 37 + elif spec == 'patch': 38 + spec = f"{curr.major}.{curr.minor}." 39 + if curr.pre: 40 + spec += f"{curr.micro}" 41 + else: 42 + spec += f"{curr.micro + 1}" 43 + 44 + 45 + version = parse_version(spec) 46 + 47 + # convert the Python version 48 + js_version = f"{version.major}.{version.minor}.{version.micro}" 49 + if version.pre: 50 + p, x = version.pre 51 + p = p.replace("a", "alpha").replace("b", "beta") 52 + js_version += f"-{p}.{x}" 53 + 54 + # bump the JS packages 55 + lerna_cmd = f"{LERNA_CMD} {js_version}" 56 + if force: 57 + lerna_cmd += " --yes" 58 + run(lerna_cmd) 59 + 60 + HERE = Path(__file__).parent.parent.resolve() 61 + path = HERE.joinpath("package.json") 62 + if path.exists(): 63 + with path.open(mode="r") as f: 64 + data = json.load(f) 65 + 66 + data["version"] = js_version 67 + 68 + with path.open(mode="w") as f: 69 + json.dump(data, f, indent=2) 70 + 71 + else: 72 + raise FileNotFoundError(f"Could not find package.json under dir {path!s}") 73 + 74 + 75 + if __name__ == "__main__": 76 + bump()