-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add github action for packaging and publishing python packages to PyPI (#1592) #2126
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 |
|
Branch | add_python_packages_to_github_actions |
Testbed | ubuntu-latest |
Click to view all benchmark results
Benchmark | Latency | microseconds (µs) |
---|---|---|
fibonacci 10 | 📈 view plot 🚷 view threshold | 498.87 |
foldl arrays 50 | 📈 view plot 🚷 view threshold | 1,753.70 |
foldl arrays 500 | 📈 view plot 🚷 view threshold | 6,804.20 |
foldr strings 50 | 📈 view plot 🚷 view threshold | 7,148.10 |
foldr strings 500 | 📈 view plot 🚷 view threshold | 61,711.00 |
generate normal 250 | 📈 view plot 🚷 view threshold | 41,976.00 |
generate normal 50 | 📈 view plot 🚷 view threshold | 2,054.10 |
generate normal unchecked 1000 | 📈 view plot 🚷 view threshold | 3,332.00 |
generate normal unchecked 200 | 📈 view plot 🚷 view threshold | 770.23 |
pidigits 100 | 📈 view plot 🚷 view threshold | 3,221.10 |
pipe normal 20 | 📈 view plot 🚷 view threshold | 1,527.10 |
pipe normal 200 | 📈 view plot 🚷 view threshold | 10,025.00 |
product 30 | 📈 view plot 🚷 view threshold | 853.20 |
scalar 10 | 📈 view plot 🚷 view threshold | 1,556.60 |
sum 30 | 📈 view plot 🚷 view threshold | 846.50 |
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.
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 am also not a github action expert, this is something I've managed to find after googling for quite some time.
Github actions are based on typescript plugins and their behavior ... finicky :)
Using Nickel would be great:D
Nonetheless, this is something I've found that should be working, however, I could not test it properly since testing github actions in forks is severely limited by github.
Regarding the name, while I like |
2fa3db7
to
b195011
Compare
I took the liberty to rebase, as there was a trivial conflict. |
Sorry for going dark on you for the last few weeks. The reason I marked this as a Draft is that I wasn't really able to test all the github action release flows in this repository. Basically, github limits the git forks ability to trigger actions in a other way that editing them to use "push" actions. I hope that everything went alright during the merging and everything works as expected :) |
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.