Skip to content
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

Let poetry automatically pull version from tags #448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zxiiro
Copy link
Contributor

@zxiiro zxiiro commented Oct 11, 2021

Rather than spending time updating the 2 files that have hardcoded
versions in them. Let poetry auto-generate the versions directly from
Git tags.

If a dev has a git tag checked out then poetry build will generate
a version directly from that tag, for example the tag "v0.15.1" will
produce a version "0.15.1".

Otherwise the version will be based on how many commits since the last
tag was available in Git history for example "0.15.1-post.13+d211ed4347"
where "post.13" represents 13 commits since v0.15.1 was tagged and
"d211ed4347" is the commit hash of the commit that generated this
version.

For this to work however devs are required to install
poetry-dynamic-versioning in addition to poetry at the global level.

Ref: https://pypi.org/project/poetry-dynamic-versioning/
Signed-off-by: Thanh Ha [email protected]

@@ -1,7 +1,8 @@
#!/usr/bin/env python


SUZIEQ_VERSION = "0.15.1"
__version__ = "0.0.0"
SUZIEQ_VERSION = __version__
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept SUZIEQ_VERSION since I did not know if this module is being imported in other modules.

@zxiiro zxiiro force-pushed the auto-version branch 3 times, most recently from 05d8fcc to 6852818 Compare October 11, 2021 14:30
@ddutt
Copy link
Member

ddutt commented Oct 11, 2021

@zxiiro Thank you for all the contributions. I was in the middle of a release and so didn't start to work on your new PRs. Will do so once the release is out, which should be early today

@zxiiro
Copy link
Contributor Author

zxiiro commented Oct 11, 2021

@zxiiro Thank you for all the contributions. I was in the middle of a release and so didn't start to work on your new PRs. Will do so once the release is out, which should be early today

No worries. I'm just doing this for fun. Let me know if there's anything you need me to change in my PRs :)

@zxiiro zxiiro force-pushed the auto-version branch 2 times, most recently from d6c143b to fcff97f Compare October 24, 2021 23:24
@ddutt
Copy link
Member

ddutt commented Oct 25, 2021

@zxiiro I'm going to leave this open for a bit. I need to get a bit more organized before I go down this path. But when I'm ready, I want to use this. So, please don't close the PR

@zxiiro
Copy link
Contributor Author

zxiiro commented Oct 25, 2021

@zxiiro I'm going to leave this open for a bit. I need to get a bit more organized before I go down this path. But when I'm ready, I want to use this. So, please don't close the PR

Sounds good. I'll periodically keep it up to date so that when you're ready for it the PR is ready to go.

@ddutt
Copy link
Member

ddutt commented Oct 25, 2021

Thats very kind of you Thanh, thank you.

Rather than spending time updating the 2 files that have hardcoded
versions in them. Let poetry auto-generate the versions directly from
Git tags.

If a dev has a git tag checked out then `poetry build` will generate
a version directly from that tag, for example the tag "v0.15.1" will
produce a version "0.15.1".

Otherwise the version will be based on how many commits since the last
tag was available in Git history for example "0.15.1-post.13+d211ed4347"
where "post.13" represents 13 commits since v0.15.1 was tagged and
"d211ed4347" is the commit hash of the commit that generated this
version.

For this to work however devs are required to install
poetry-dynamic-versioning in addition to poetry at the global level.

Ref: https://pypi.org/project/poetry-dynamic-versioning/
Signed-off-by: Thanh Ha <[email protected]>
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