-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support PEP 621 version? #66
Comments
This is a great point, and I'm kicking myself for not recognizing it before. |
Any update on this? In my case I need the field at
and this
|
#215 has my current answer to this. The |
Establish pyproject.toml functionally as the single source of truth for the version number, so users can rely on `importlib.metadata.version` to query the version programmatically [1, 2]. Storing the version number in the packaging metadata makes it directly accessible to most build tools statically, instead of dynamically, which in theory would make certain kinds of operations (reinstall, querying the metadata from a git checkout) much more tractable [3]. And frankly, the only reason the version attribute previously was dynamic was incomplete tooling support. [4, 5] We still retain the `__version__` attribute -- we need the version number for the command-line interface and machinery, and querying it via the installed packages registry is unnecessarily heavyweight -- but only on the top-level package. Same goes for the `__author__` attribute. In future commits, the `__version__` attribute (and version markers in other files such as the manpages) will be auto-generated by our build system, commit hooks, or the like. In general, what we still need is a system to update all mentions of a version number across the software package [6]. Further reading: 1. Python Packaging Authority: [Single-sourcing the Project Version](https://packaging.python.org/en/latest/discussions/single-source-version/). 2. Hynek Schlawek: [Python Packaging Metadata](https://hynek.me/articles/packaging-metadata/). 3. Armin Ronacher: [Constraints are Good: Python's Metadata Dilemma](https://lucumr.pocoo.org/2024/11/26/python-packaging-metadata/). 4. Barry Warsaw: [`hatch version` should be able to handle static version numbers](pypa/hatch#1419). 5. Henry Schreiner: [Support PEP 621 version?](callowayproject/bump-my-version#66) 6. Alex Gaynor: [Scaling Software Development](https://alexgaynor.net/2020/feb/18/scaling-software-development/). "As the scale of a codebase increases, any properties of it which are not programmatically enforced will tend to regress."
It can be, yes, but it needn't necessarily be. Some people even make cases against such dynamic metadata. (Though with little success.) And it seems baffling to me to refuse support for @coordt, would you accept a PR that detects static vs. dynamic |
I'll be happy to look at it. I don't want a "hack" to make it work. If you see a better way to manage retrieving the current version than is currently used, I would welcome PRs for that as well. |
#306 has been merged, correct? Then this issue is complete, I believe. Thanks. |
Thanks to @the-13th-letter for the patch! |
Description
I was expecting bump-my-version to be able to read
But it did not. If a
current_version
isn't specified, IMO this should be the fallback location. According to PEP 621, it is the canonical version if specified. All backends except Poetry support this now (and Poetry 2 is supposed to).What I Did
The text was updated successfully, but these errors were encountered: