Add a Github action to publish to PyPI#274
Conversation
|
I created an API token for the ics.py project at test.pypi.org, but I can't add it to this project's secrets on GitHub as I have no access to its settings. I can also add you on test.pypi so that I'm no longer the sole owner - do you already have an account there? |
|
It seems like i can't give you access as the repo is under my personal account. (It might be time to push the move to a dedicated org 👀) I do have an test account with the same username: https://test.pypi.org/user/C4ptainCrunch/ |
4b0fcad to
7499567
Compare
|
So, i have an action that kind of pushed to test pypi. But it fails as the version already exists. What is also missing:
|
baaca7c to
9b06095
Compare
Codecov Report
@@ Coverage Diff @@
## main #274 +/- ##
=======================================
Coverage 81.28% 81.28%
=======================================
Files 30 30
Lines 2885 2885
=======================================
Hits 2345 2345
Misses 540 540 Continue to review full report at Codecov.
|
9b06095 to
2210415
Compare
|
This approach is stuck at the moment as we try to publish 0.8.0-dev multiple times on (dev)pypi and publishing the same version multiple times is prohibited. We could try to include the commit hash in the version but this has multiple problems:
So i guess we should abandon the idea to publish every commit of What i'm tempted to do is:
What do you think ? |
|
@C4ptainCrunch I have often seen |
|
I think 0.8.0dev0 etc. is pretty common. See, e.g., https://pypi.org/project/yaml2ics/, which is based on ics-py :) @tupui You've done this recently, any advice? |
Sounds good. Note that you can also delete (and not only "yank") releases on PyPi, so you could also get rid again of that dev2 "release".
Instead of per-commit preview releases, we could adopt nightly builds that are published to the test PyPi once per day using the date as monotonically increasing index, e.g. 0.8.0-dev20220304. One could also include a check to only publish a nightly build if anything changed in the last 24 hours. |
|
My 2 cents after having deployed a few things both on internal PyPi and normal. There is very little value to publish a version nightly on dev PyPi:
For the release itself, I tend to prefer a semi automatic way with locally using Point is, IMHO releases should require a manual interaction as you can potentially break all packages depending on your package. And you should have a separation of credentials on PyPi vs GH. |
|
To add on to what tupui said which I agree with -- I'm relatively new here, but my observation is I would suggest to keep it simple: This project has had zero new feature commits in the last 20+ days (just a patch release and test improvement). The tension here is because there is a lot wrapped up in 8.0, thus a large desire to have a pypi development release. My suggestion based on how most other python projects work is (1) to significantly cut as much scope as possible to get 8.0 out and (2) to lean into semvar and get comfortable with major version bumps indicating breaking changes, and very frequent releases of minor and patch releases. Then in the future, a major rewrite can happen in a branch and be pulled into the main line when it's ready to get on the release train, and use a major version bump when there are breaking changes. |
- project and dependency declaration is now according to the standard - optional-dependencies are declared nicely (including pinned tox versions for flake8 and mypy) - upper version caps preferred by poetry have been removed - removed lock file which we don't need
45426c1 to
c34a340
Compare
|
Let's try this again, with a much less complicated route:
=> No more fidling with automatic version names, bump2version, ... only the core "job to be done": being able to reproducibly build and upload packages in an isolated environment not depending on my laptop. Notes:
|
|
Of course, the only thing that we could not test in the PR (the actual release workflow) does not work when building a tag. What was wrong: The artifacts from the build were not available in the upload step. I'm just building in both steps right now. It's not clean, but building twice for each tag is not a huge problem anyway. What is still not working: Something in the |
|
It works 🎉 https://pypi.org/project/ics/0.8.0.dev0/ |
Co-authored-by: Simon Dominik Niko Fink <simon.fink@uni-passau.de>

I'd like to automate the release process as much as possible to i'm not a bottleneck (and computer usually make less mistakes than humans) so i'm trying to build a package on every commit for master and publish it on the test PyPI. Then on every tag, push it to the production PyPI.
I've already added a token to publish to production in the github settings. @N-Coder you are the admin of the test PyPI package. Could you add a token under
TEST_PYPI_API_TOKENplease ?