-
Notifications
You must be signed in to change notification settings - Fork 7
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
poetry
Build System
#49
base: master
Are you sure you want to change the base?
Conversation
check
command
check
commandpoetry
Build System
Hi @darthtrevino , Thanks for your contribution. I like the idea of moving to Poetry as well as setting up PyPi Trusted Publisher. Let's work on the details to make this merged. Cheers! |
@@ -0,0 +1,60 @@ | |||
[tool.poetry] | |||
name = "semversioner" | |||
version = "2.0.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to automatically bump versions, this should not be hardcoded or manually updated. It should be read from __version__.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that may be an incompatible goal with how Poetry works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that there should be a single source of truth here, but I kind of think it should go the other way.
We could model this as a build step that reads from pyproject.toml and injects that version into init.py.
Another route we could go is use the poetry-dynamic-versioning
plugin to hydrate the version in pyproject.toml and in version.py the closest git tag, which is what I used recently in this project (https://github.com/graspologic-org/graspologic).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, makes sense. We could update both places during the build process: https://github.com/raulgomis/semversioner/blob/master/.github/workflows/build-and-publish.yml#L60 and have an additional check to verify both versions are the same before publishing to avoid any mismatch.
This is an interesting thread with similar (and additional) ideas: python-poetry/poetry#144 (comment) .
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@darthtrevino I'll find some time this week to run this in local and test this branch for additional feedback. Thanks for your contribution.
run: poetry build | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to use poetry publish
here instead of relying on the github action?
|
||
- name: Build Distributable | ||
shell: bash | ||
run: poetry build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an expert on Github Actions as I normally use other CI/CD tools, but I'd like to find a way that we build only once, and deploy exactly the same artifact we run the tests against. From what I understand from this workflow is that we are building it again, pulling dependencies, etc. The poetry.lock file helps reducing the risk to introducting non tested behaviour, but overall I'd like to have a CI/CD workflow that enforces:
After merging to master:
- We run tests
- We package only once
- We publish the package we run the tests against
Does it make sense? I'll read a bit more about how to achieve that in actions.
@@ -0,0 +1,60 @@ | |||
[tool.poetry] | |||
name = "semversioner" | |||
version = "2.0.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, makes sense. We could update both places during the build process: https://github.com/raulgomis/semversioner/blob/master/.github/workflows/build-and-publish.yml#L60 and have an additional check to verify both versions are the same before publishing to avoid any mismatch.
This is an interesting thread with similar (and additional) ideas: python-poetry/poetry#144 (comment) .
Thoughts?
Hey Raul,
I wanted to make some contributions around the issues I've been posting. As a first step I thought I'd offer up a build-system update.
This PR updates semversioner with the Poetry build system, which is a PEP517-based package management tool.
The tasks in the
makefile
have been replaced with poethepoet tasks. These can be invoked via:The release flow is also a little different. The
publish
script assumes that you're got a PyPi Trusted Publisher configured, which means you don't need$TWINE_USERNAME
and$TWINE_PASSWORD
. It also expects that developers have runpoetry run poe release
in a release branch.If you'd like to use this, I'd be glad to help with any configuration issues you run into.
Thanks!
Chris