Skip to content

Conversation

amCap1712
Copy link
Member

Add GitHub Actions workflow for PyPI publishing. Transitioned from Poetry-specific metadata to PEP 621 standard using [project] and added poetry-dynamic-versioning for dynamic version management using git tags.

Copy link
Contributor

@yvanzo yvanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, the changes may make sense but I don’t know much about this stuff and it is uneasy to follow without references to the docs. See the comments.

Comment on lines +4 to +6
# automatically filled in and updated by poetry-dynamic-versioning plugin
# in distributions
__version__ = "0.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add references to the related docs at the bottom of your first commit message. Is it the one below?
https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#static-vs-dynamic-metadata

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the general pyproject.toml reference yes but this change is from poetry and poetry-dynamic-versioning specific. If we were using setuptools instead of poetry, this would be done differently.

Basically, poetry-dynamic-versioning plugin during build time substitutes the __version__ attribute with the current version in the sdist and the wheel. I can leave it an empty string here and the substitution would work fine but I chose to use 0.0.0 as that's the base version in pyproject.toml as well. The base version is an arbitrary version required by poetry in tool.poetry section. I have added references to both poetry's and poetry-dynamic-versioning plugin's documentation in the first commit.

amCap1712 added 2 commits May 17, 2025 18:07
Transitioned from Poetry-specific metadata to PEP 621 standard using `[project]` and
added `poetry-dynamic-versioning` for dynamic version management using git tags.

The `poetry-dynamic-versioning` needs to be installed manually during development by
running `poetry self add 'poetry-dynamic-versioning[plugin]'`.

References for dynamic versioning with poetry:
- https://python-poetry.org/docs/pyproject/#version
- https://github.com/mtkennerly/poetry-dynamic-versioning?tab=readme-ov-file#installation
The workflow carries out the following steps:

1. Check out the repository.
2. Install Python.
3. Install Poetry (with the required plugins).
4. Build the package.
5. Publish the package to pypi.

The publishing process does not require the use of any credentials or
keys as it utilizes Pypi's "Trusted Publishing" support. See also:
https://docs.pypi.org/trusted-publishers/.
Copy link
Contributor

@yvanzo yvanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed commit messages!

Let’s merge and release as 30.0.1 🚢

@amCap1712 amCap1712 merged commit 648c34e into main May 17, 2025
5 checks passed
@amCap1712 amCap1712 deleted the dynamic-version branch May 17, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants