Skip to content

Commit

Permalink
Sync jupytercad_* version (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc authored Jun 27, 2024
1 parent 3187cae commit 5de1ff5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"clean:all": "lerna run clean:all",
"eslint": "eslint . --ext .ts,.tsx --cache --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}\"",
"prettier": "prettier --no-error-on-unmatched-pattern --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}\"",
"prettier:check": "prettier --list-different \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}\"",
"lint:check": "jlpm run prettier:check && jlpm run eslint:check",
"lint": "jlpm run prettier && jlpm run eslint",
Expand Down
8 changes: 4 additions & 4 deletions python/jupytercad/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling>=1.5.0,<2"]
requires = ["hatchling>=1.5.0,<2", "tomlkit>=0.12.5,<0.13"]

[project]
classifiers = [
Expand All @@ -19,9 +19,9 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
dependencies = [
"jupytercad_core>=2.0.0a0,<3",
"jupytercad_lab>=2.0.0a0,<3",
"jupytercad_app>=2.0.0a0,<3",
"jupytercad_core==2.0.0a10",
"jupytercad_lab==2.0.0a10",
"jupytercad_app==2.0.0a10",
]
dynamic = ["version"]
license = {file = "LICENSE"}
Expand Down
19 changes: 18 additions & 1 deletion python/jupytercad/scripts/bump-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

import argparse
import json
from typing import List
from packaging.version import parse as parse_version
from pathlib import Path
from subprocess import run

import tomlkit

ENC = dict(encoding="utf-8")
HATCH_VERSION = "hatch version"
Expand All @@ -27,6 +28,20 @@ def next_version():
return f"{v.major}.{v.minor}.{v.micro + 1}"


def bump_jupytercad_deps(py_version: str):
with open(ROOT / "pyproject.toml", "r") as f:
data = tomlkit.load(f)
dependencies: List[str] = data["project"]["dependencies"]

for index, value in enumerate(dependencies):
if value.startswith("jupytercad"):
lib = value.split("==")[0]
dependencies[index] = f"{lib}=={py_version}"

with open(ROOT / "pyproject.toml", "w") as f:
tomlkit.dump(data, f)


def bump():
parser = argparse.ArgumentParser()
parser.add_argument("version")
Expand All @@ -51,6 +66,8 @@ def bump():
)
# bump the Python version with hatch
run(f"{HATCH_VERSION} {py_version}", shell=True, check=True, cwd=ROOT)
# pin jupytercad_* package to the same version
bump_jupytercad_deps(py_version)
# bump the JS version with lerna
run(f"yarn run bump:js:version {js_version}", shell=True, check=True)

Expand Down

0 comments on commit 5de1ff5

Please sign in to comment.