From b72064750a13fcc943d663ddc57972dc998eb3d8 Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Mon, 9 Mar 2026 11:41:40 +0100 Subject: [PATCH 1/5] Remove unused __version__. --- pyaml/__init__.py | 3 +-- pyproject.toml | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/pyaml/__init__.py b/pyaml/__init__.py index c58ae48b..6395d4d1 100644 --- a/pyaml/__init__.py +++ b/pyaml/__init__.py @@ -8,7 +8,6 @@ __title__ = "pyAML" __description__ = "Python Accelerator Middle Layer" __url__ = "https://github.com/python-accelerator-middle-layer/pyaml" -__version__ = "0.2.3" __author__ = "pyAML collaboration" __author_email__ = "" @@ -17,7 +16,7 @@ from pyaml.common.exception import PyAMLConfigException, PyAMLException -__all__ = [__version__, "PyAMLException", "PyAMLConfigException"] +__all__ = ["PyAMLException", "PyAMLConfigException"] config_file = os.getenv("PYAML_LOG_CONFIG", "pyaml_logging.conf") diff --git a/pyproject.toml b/pyproject.toml index 3e4a62d9..eaa38810 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,23 +1,3 @@ -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - -[tool.hatch.version] -path = "pyaml/__init__.py" - -[tool.hatch.build.targets.sdist] -exclude = [ - "/.github", - "/docs", - "/tests", -] - -[tool.hatch.build.targets.wheel] -packages = ["pyaml"] - -[tool.hatch.metadata] -allow-direct-references = true - [project] name = "accelerator-middle-layer" description = "Python Accelerator Middle Layer" @@ -91,6 +71,26 @@ Homepage = "https://github.com/python-accelerator-middle-layer/pyaml" Documentation = "https://python-accelerator-middle-layer.github.io/pyaml/" Repository = "https://github.com/python-accelerator-middle-layer/pyaml.git" +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.targets.sdist] +exclude = [ + "/.github", + "/docs", + "/tests", +] + +[tool.hatch.build.targets.wheel] +packages = ["pyaml"] + +[tool.hatch.metadata] +allow-direct-references = true + [tool.ruff] line-length = 88 target-version = "py311" From 77fc29d230e7b937e2bf06a064d6f9dc06543ff5 Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Mon, 9 Mar 2026 14:12:12 +0100 Subject: [PATCH 2/5] Add so __version__ attribute is automatically generated when installing. --- pyaml/__init__.py | 2 ++ pyproject.toml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/pyaml/__init__.py b/pyaml/__init__.py index 6395d4d1..65050bc0 100644 --- a/pyaml/__init__.py +++ b/pyaml/__init__.py @@ -5,6 +5,8 @@ pyAML """ +from ._version import __version__ + __title__ = "pyAML" __description__ = "Python Accelerator Middle Layer" __url__ = "https://github.com/python-accelerator-middle-layer/pyaml" diff --git a/pyproject.toml b/pyproject.toml index eaa38810..475ce07f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,6 +91,9 @@ packages = ["pyaml"] [tool.hatch.metadata] allow-direct-references = true +[tool.hatch.build.hooks.vcs] +version-file = "pyaml/_version.py" + [tool.ruff] line-length = 88 target-version = "py311" From 83576c717c427f09bbd875b33202d7278092b164 Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Mon, 9 Mar 2026 14:25:43 +0100 Subject: [PATCH 3/5] Fix merge conflict. --- .github/workflows/tests.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a5ca02ed..c0682d4b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,16 +28,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install numpy - pip install scipy - pip install pydantic - pip install accelerator-toolbox - pip install accelerator-commissioning==1.1.0 - pip install matplotlib - pip install h5py - pip install PyYaml - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install .[test] + pip install flake8 - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names From 6fa78f3a0b6efce3e8c6bb76af0a1220fd1f397b Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Mon, 9 Mar 2026 14:33:21 +0100 Subject: [PATCH 4/5] Updated CONTRIBUTING.md for release workflow with automatic versioning. --- CONTRIBUTING.md | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8618d1a..0c28593c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,21 +28,10 @@ If manual intervention is required, please follow the instructions provided by t #### Releasing a new version on PyPi 1. Create a branch for a release -2. Set the version in pyaml/__init__.py: - -``` -__title__ = "pyAML" -__description__ = "Python Accelerator Middle Layer" -__url__ = "https://github.com/python-accelerator-middle-layer/pyaml" -__version__ = "0.2.4" -__author__ = "pyAML collaboration" -__author_email__ = "" -``` -3. Provide a list of changes and release description in the merge request. Justify a version bump is necessary. -4. Approve and merge the PR - -5. Then tag to the corresponding version. -6. CI/CD will take care of PyPi release. (Make sure the version in CI/CD deployment pipeline matches the one you just tagged.) +2. Provide a list of changes and release description in the merge request. Justify a version bump is necessary. +3. Tag the corresponding version. +4. Approve and merge the PR. +5. CI/CD will take care of PyPi release. (Make sure the version in CI/CD deployment pipeline matches the one you just tagged.) ### 4. Documentation - **Improving Docs:** Fix typos, clarify instructions, or add missing documentation. Submit a PR as you would for code changes. - **Website:** Our project website is at [python-accelerator-middle-layer.github.io](https://python-accelerator-middle-layer.github.io/). From 56ea95dba0ca36621f7a38e49fd49e0da2bcc589 Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Mon, 9 Mar 2026 16:39:59 +0100 Subject: [PATCH 5/5] Add _version.py to gitignore since built when installing. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cc4cfcfb..f0f74e0d 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +_version.py # PyInstaller # Usually these files are written by a python script from a template