From 32295facbf3ebe2626a72cfbb5b0887a136ef854 Mon Sep 17 00:00:00 2001 From: Douglas Wilson Date: Mon, 20 May 2024 15:54:49 +0100 Subject: [PATCH] chore: correct __version__ in hugr.py --- hugr-py/src/hugr/__init__.py | 4 +++- hugr-py/tests/test_version.py | 16 ++++++++++++++++ poetry.lock | 15 +++++++++++++-- pyproject.toml | 1 + release-please-config.json | 6 +++++- 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 hugr-py/tests/test_version.py diff --git a/hugr-py/src/hugr/__init__.py b/hugr-py/src/hugr/__init__.py index 807626cf0d..7b63396f56 100644 --- a/hugr-py/src/hugr/__init__.py +++ b/hugr-py/src/hugr/__init__.py @@ -2,7 +2,9 @@ representation. """ -__version__ = "0.2.0a1" +# This is updated by our release-please workflow, triggered by this +# annotation: x-release-please-version +__version__ = "0.2.1" def it_works() -> str: diff --git a/hugr-py/tests/test_version.py b/hugr-py/tests/test_version.py new file mode 100644 index 0000000000..08d20a58e7 --- /dev/null +++ b/hugr-py/tests/test_version.py @@ -0,0 +1,16 @@ +# from https://github.com/python-poetry/poetry/issues/144#issuecomment-877835259 +import toml +from pathlib import Path +import hugr + + +def test_versions_are_in_sync(): + """Checks if the pyproject.toml and package.__init__.py __version__ are in sync.""" + + path = Path(__file__).resolve().parents[1] / "pyproject.toml" + pyproject = toml.loads(open(str(path)).read()) + pyproject_version = pyproject["tool"]["poetry"]["version"] + + package_init_version = hugr.__version__ + + assert package_init_version == pyproject_version diff --git a/poetry.lock b/poetry.lock index 77c94471d3..24e529051e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -143,7 +143,7 @@ typing = ["typing-extensions (>=4.8)"] [[package]] name = "hugr" -version = "0.1.0" +version = "0.2.1" description = "Quantinuum's common representation for quantum programs" optional = false python-versions = ">=3.10" @@ -565,6 +565,17 @@ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments testing = ["build[virtualenv]", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mypy (==1.9)", "packaging (>=23.2)", "pip (>=19.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.2)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] + [[package]] name = "tomli" version = "2.0.1" @@ -610,4 +621,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "3904741f2d3fffd8b5ef03ab33de64905761fe0b07c70a7a4c151a8fb8981067" +content-hash = "487ddc7148ab4801c38871d976104e32eb884e91342ea1cdc05d2aa090489a0c" diff --git a/pyproject.toml b/pyproject.toml index 48eff6fa7b..3138b58937 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ pytest = "^8.1.1" pytest-cov = "^4.1.0" mypy = "^1.9.0" ruff = "^0.3.3" +toml = "^0.10.0" [tool.poetry.group.hugr.dependencies] hugr = { path = "hugr-py", develop = true } diff --git a/release-please-config.json b/release-please-config.json index a5d9f907bf..6967119a39 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -12,7 +12,11 @@ "package-name": "hugr", "include-component-in-tag": true, "draft": false, - "prerelease": false + "prerelease": false, + "extra-files": [{ + "type": "generic", + "path": "hugr-py/src/__init__.py" + }] } }, "changelog-sections": [