Skip to content

Commit 1e2e07a

Browse files
Remove dynamic version from pyproject.toml (#204)
A dynamic `version` configuration within the `pyproject.toml` file can give issues with Dependabot due to circular import. This commit moves the source of truth for the package version from `version.py` to the `pyproject.toml` file and updates other references accordingly.
1 parent c5fe4f3 commit 1e2e07a

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ jobs:
1616
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1717
steps:
1818
- uses: actions/checkout@v6
19+
- uses: astral-sh/setup-uv@v7
20+
with:
21+
version: "0.9.16"
22+
- uses: actions/setup-python@v6
23+
with:
24+
python-version: 3.13
25+
- name: "Install plugin"
26+
run: uv sync --locked --no-dev
1927
- name: "Get version"
20-
run: echo "PLUGIN_VERSION=$(cat streamflow/plugins/unito/postgresql/version.py | grep -oP '(?<=VERSION = \")(.*)(?=\")')" >> $GITHUB_ENV
28+
run: |
29+
source .venv/bin/activate
30+
echo "STREAMFLOW_VERSION=$(python -c "from streamflow.plugins.unito.postgresql.version import VERSION; print(VERSION)")" >> $GITHUB_ENV
2131
- name: "Check tag existence"
2232
uses: mukunku/tag-exists-action@v1.7.0
2333
id: check-tag
@@ -45,11 +55,18 @@ jobs:
4555
if: ${{ github.event.workflow_run.conclusion == 'success' }}
4656
steps:
4757
- uses: actions/checkout@v6
58+
- uses: astral-sh/setup-uv@v7
59+
with:
60+
version: "0.9.16"
4861
- uses: actions/setup-python@v6
4962
with:
50-
python-version: "3.13"
63+
python-version: 3.13
64+
- name: "Install plugin"
65+
run: uv sync --locked --no-dev
5166
- name: "Get local version"
52-
run: echo "PLUGIN_VERSION=$(cat streamflow/plugins/unito/postgresql/version.py | grep -oP '(?<=VERSION = \")(.*)(?=\")')" >> $GITHUB_ENV
67+
run: |
68+
source .venv/bin/activate
69+
echo "STREAMFLOW_VERSION=$(python -c "from streamflow.plugins.unito.postgresql.version import VERSION; print(VERSION)")" >> $GITHUB_ENV
5370
- name: "Get PyPI version"
5471
run: echo "PYPI_VERSION=$(pip index versions --pre streamflow-postgresql | grep streamflow-postgresql | sed 's/.*(\(.*\))/\1/')" >> $GITHUB_ENV
5572
- name: "Build Python packages"

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies = [
3131
"asyncpg==0.31.0",
3232
"streamflow==0.2.0.dev13"
3333
]
34-
dynamic = ["version"]
34+
version = "0.0.9"
3535

3636

3737
[project.urls]
@@ -73,8 +73,5 @@ zip-safe = true
7373
[tool.setuptools.package-data]
7474
"streamflow.plugins.unito.postgresql" = ["schemas/*.json", "schemas/*.sql"]
7575

76-
[tool.setuptools.dynamic]
77-
version = {attr = "streamflow.plugins.unito.postgresql.version.VERSION"}
78-
7976
[tool.isort]
8077
profile = "black"
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
VERSION = "0.0.9"
1+
from importlib.metadata import version
2+
3+
VERSION = version("streamflow-postgresql")

uv.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)