Enable reading project's version number dynamically from somewhere other than pyproject.toml
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Feature Request
I’m working on a project where we would like to adopt poetry. One aspect of our long-established workflow is that our version numbers are maintained a changelog file. We currently parse that file in setup.py
to ensure that when we install the project, the version number is always correct.
poetry
seems to only support reading the version from pyproject.toml
which is obviously a static configuration file and so doesn’t support logic as setup.py
does. Is there, or could there be, a way to dynamically read the version from somewhere else? (The obvious workaround is to make the change manually ourselves as part of our release process, but anything you rely on a human to do is liable to suffer human error sooner or later!)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:21
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Standard way to embed version into Python package?
There is only one place that the version number is written down, so there is only one place to change it when the...
Read more >Dynamic project names and PEP 621 - Packaging
I am a fan of the static package configuration espoused by pyproject.toml and PEP 621. As I migrate projects to use it, I...
Read more >Packaging Your Python Code With pyproject.toml - YouTube
Learning how to package your code can seem overwhelming. This complete 52 minute conversation takes you through the steps one at a time, ......
Read more >The pyproject.toml file | Documentation | Poetry
The pyproject.toml file The tool.poetry section of the pyproject.toml file is composed of multiple sections. name The name of the package.
Read more >Poetry - The Blue Book
lock to ensure that the package versions are consistent for everyone working on your project. As a result you will have all dependencies...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Cross-posting my comment from: https://github.com/python-poetry/poetry/pull/2366#issuecomment-849615115 as it seems it’s relevant here too.
Sorry if it feels like spam, but I think people subscribed to this issue might not be subscribed to that one and could miss this.
I just made a plugin (available with Poetry
1.2.0a1
and above) to read the version from an__init__.py
file:or from a git tag, set with a GitHub release or with:
I thought this could be useful for others here too.
https://github.com/tiangolo/poetry-version-plugin
Hello @burrscurr,
please see my comment at https://github.com/python-poetry/poetry/pull/2366#issuecomment-652418094 about what you can do.
Hello @maxgrenderjones,
this is a question that raises from time to time. Also me was asking this a while ago (https://github.com/python-poetry/poetry/issues/1314#issuecomment-530366576). However, generate or read the version number dynamic from somewhere, makes it hard for dependency resolution tools like
poetry
, to get this value, when it needs to install something from source. Version numbers should belong to the static metadata and there should be only one place of truth for it. In case ofpoetry
this is thepyproject.toml
. Saying this we currently tend to not implement any dynamic reading from another place.fin swimmer