-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add github action for packaging and publishing python packages to PyPI (#1592) #2126
base: master
Are you sure you want to change the base?
Conversation
Hi, Thanks a lot for tackling this! This is great. We'll give it a look soon. Just to make sure I understand, the package that you published on TestPyPI has been done through this workflow, right? I don't have a strong opinion about the name - I find |
Yes, I wanted to make sure the whole workflow works as expected. You can check, for example, this job to see some details https://github.com/vlcek/nickel/actions/runs/12383038938/job/34565207353
Yes, I made change just as a workaround so I can test the recommended way of package publishing on TestPyPI. From what I understand, the packages/projects on TestPiPY are regularly wiped and somewhere in some FAQ I read you can ask administrators to "hand it over" if you want to claim the name. Just a word of caution. Renaming packages later is... problematic and perhaps a different name would make python bindings on PyPI more discoverable. I really like Nickel and I hope it will gain more adoption and "infiltrating" Python ecosystem seems to me like a great help :)
I am no expert either. From what I read there is no strict convention. From what I saw, packages containing python bindings usually have |
I think the fact that Nickel is implemented in Rust is a bit of an implementation detail for Pythonistas (I don't think it deserves to be in the name). Several config languages just have the language as package name (Dhall or Jsonnet for example), but |
I think it's my earlier attempt on this (shortly after posting the issue) that occupied the |
I deleted the |
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.
Thanks, I'm not very knowledgeable in Python packaging, but this looks good plus you've tested it before.
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event_name == 'release' && '' || github.event.inputs.release_tag }} |
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.
IIRC, this means: if the first condition evaluates to true
, then &&
evaluates to its second condition, and ||
to its first condition. Otherwise, &&
evaluates to false
and ||
to its second condition.
I'm not a GitHub action expert, and given that workflow expressions are limited (well, maybe they should use Nickel :p), that might be the idiomatic way to do things but I find this a bit confusing.
Regarding the name, while I like |
Hello,
this PR relates to #1592. I tried to create a gits of the packaging and publish workflows to PyPI so people can more easily use Nickel withing Python code.
What I've managed to do here:
Unfortunately, for sake of testing I had to rename
pyckel
package topy-nickel
(andnickel
as the python module), because the name on PyPI is already taken. Thepy-nickel
is just a name I picked to progress further. If you like this approach, I can easily change the name to whatever you like.I found testing github workflows in a forked repository rather hard and my inexperience with GitHub did not helped either so please take this as a draft :) I highly suspect that the workflow will need some adjustments to fit your release process, however, I am not sure if I can help you with this any further :)
Setting up repository on PyPI is quite easy, here is the official guide.
Basically, once the pypi repository is created, you just set up the "trusted publisher" on github and there is no need to set up any credentials - everything is handled via OIDC and trust setup between PyPI and GitHub.
You can check/test the PyPI uploads here https://test.pypi.org/project/py-nickel/
You can see the list of uploaded artifacts here https://test.pypi.org/project/py-nickel/1.9.0/#files
Attestation https://test.pypi.org/project/py-nickel/1.9.0/#py_nickel-1.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (some files don't have attestations, that's only because of my experiments with uploads via maturin).
Example of a slightly different workflow version here - I needed different triggers to check if the builds and publishing work.