poetry-version-plugin
poetry-version-plugin copied to clipboard
Automatically set version in __init__.py
First of all, thank you for this @tiangolo, it's a very convenient plugin to have.
If this could somehow be extended to work like Versioneer or Miniver, so that it overrides the __version__
variable in __init__.py
to dynamically use the git tag during development and then override that with a static string at build time, it would be absolutely perfect. Basically one would never have to manually set the version in __init__.py, just set the git tag.
If you would be interested in doing this, I wouldn't mind making the PR but I'm not sure about what limitations Poetry plugins have, so don't know if it's even possible.
Adding to this, it would be awesome to have the same kind of version format as in Versioneer:
A build 5 commits ahead tag 0.20.0, latest commit being abcd123
would be: 0.22.0+5.abcd123
A build 5 commits ahead tag 0.20.0, latest commit being abcd123
and with uncommitted changes would be: 0.22.0+5.abcd123.dirty
Another package poetry-dynamic-versioning
is considering adding poetry plugin support officially, rather than as a separate package as it currently stands. That package has all of the fancy version numbers that you're looking for @mrpgraae .
Does it make sense to combine our efforts of poetry-version-plugin
with poetry-dynamic-versioning
? https://github.com/mtkennerly/poetry-dynamic-versioning/issues/39
@sl304227-nh Thanks, poetry-dynamic-versioning
seems somewhat broader in scope than this project, AFAICT it already supports the behavior that I'm looking for, i.e. using the Git tag as the source of truth, then setting init.py version and package version based on that?
I would say that it would definitely make sense to make poetry-dynamic-versioning
a Poetry plugin rather than a standalone package. Do you know what, if any, the arguments are for keeping it as a standalone package?
Hi there,
Thanks a lot for bringing VCS-sourced dynamic versioning to poetry!
I do also think that this plugin should be combined with poetry-dynamic-versioning
. I cannot answer @mrpgraae's question with certainty, but the README.md there says:
Since Poetry does not yet officially support plugins (refer to this issue) as of the time of writing on 2019-10-19, this package takes some novel liberties to make the functionality possible. As soon as official support lands, this plugin will be updated to do things the official way.
...so I guess (and hope!) that it will be "pluginized" soon (I don't know the ETA for poetry 1.2.x, though).