Skip to content

Adds Github Action for PyPI release! #648

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

purepani
Copy link
Contributor

@purepani purepani commented Mar 27, 2025

Depends on #643.

This adds a github action for releasing to pypi. If you tag a commit with v*, the action will be triggered, and it will try and publish it. You'll have to set up this action as a "trusted publisher" on your pypi account for this to work.

This uses an nvidia docker container to get cuda on the github runner. The runners don't have gpus, so you can't test with them(at least without custom runners), but you can at least build them

@purepani purepani force-pushed the push-kxyuuxqmmuox branch 4 times, most recently from 3015248 to 61ffb51 Compare March 27, 2025 02:52
@purepani
Copy link
Contributor Author

purepani commented Mar 27, 2025

Ok, I believe I have finally finished force pushing everything to get this to work fully.
Assuming your cuda stuff is correctly set up, you should be able to drop into the project folder and run uv run on anything to get the package using the previous PR; additionally any time you cut a release(with the version on the tag and the version in pyproject matching), it will upload to pypi once you set up the connection on pypi(this is pretty easy to do).

One thing I haven't done is test in a cuda environment, since I don't have an easily accessible one set up. If you can do that, that would be great(just installing the project into your environment with pip install . and testing it should work).

@purepani purepani marked this pull request as ready for review March 27, 2025 03:06
@purepani
Copy link
Contributor Author

purepani commented Mar 27, 2025

I just realized I completely forgot about windows support on the auto release
I'll work on that later

@AnderBiguri
Copy link
Member

Thanks a lot @purepani , I'll try to test both things ASAP and then I'll merge. This is super appreciated, thanks!

@purepani
Copy link
Contributor Author

purepani commented Mar 27, 2025

Hmm I'm not sure if I have time in the near future to figure this out; will probably be at least early next week. Maybe it's better to just upload linux by itself(or upload windows manually with linux).
The issue with windows is I don't have a windows computer to test the build on, and also that I can't just run a docker image with cuda since docker is linux only, so I have to figure out how to install into the CI manually.

@purepani
Copy link
Contributor Author

purepani commented Mar 28, 2025

In researching on my phone while waiting for stuff, I found that there aren't super great solutions for windows cuda CI without custom runners, since pretty much all of them seem to be a bit manual, but they should work.
Mostly writing here as a note to myself for later.

@purepani purepani force-pushed the push-kxyuuxqmmuox branch from 61ffb51 to 6bcfa65 Compare April 2, 2025 08:54
@AnderBiguri
Copy link
Member

thank @purepani . I am suddenly swamped with some stuff, so I will need to leave testing and mergin this for end of April, but I really want to do it, just letting you know you have time to faff around with this until then if you want :)

@purepani
Copy link
Contributor Author

purepani commented Apr 2, 2025

I'll definitely do that :)

@purepani purepani force-pushed the push-kxyuuxqmmuox branch 5 times, most recently from 897063e to 290b8f4 Compare April 3, 2025 01:06
@purepani purepani force-pushed the push-kxyuuxqmmuox branch 4 times, most recently from 85122f8 to a2ee83d Compare April 3, 2025 01:58
@purepani purepani force-pushed the push-kxyuuxqmmuox branch 3 times, most recently from 0bd182a to 218f9c0 Compare April 10, 2025 00:04
@purepani purepani force-pushed the push-kxyuuxqmmuox branch from 218f9c0 to b0c3ba4 Compare April 10, 2025 13:34
@purepani purepani force-pushed the push-kxyuuxqmmuox branch from b0c3ba4 to 8beaa04 Compare April 10, 2025 13:38
@purepani purepani force-pushed the push-kxyuuxqmmuox branch 3 times, most recently from 2eba4f1 to 0751f54 Compare April 10, 2025 14:43
@purepani purepani force-pushed the push-kxyuuxqmmuox branch from 0751f54 to d9612fa Compare April 10, 2025 14:51
@AnderBiguri
Copy link
Member

Right! Finally tested and working on a linux machine with CUDA!

Anything else I should test before a merge?

Once merged, I'll try to figure out how to make a pip package then for tigre

@purepani
Copy link
Contributor Author

I don't think you need to test anything else. Of course, a future step should be to get this working for windows though. I may or may not be able to get to it, but I do remember it was not tricky getting cuda toolkit installed on the GitHub runner. Maybe easiest to just use a conda environment for that. I may or may not be able to get to this in the future, but I've been procrastinating on my master's degree and need to get to finishing that for now. (Though feel free to ping me for questions!)

There is https://test.pypi.org to test the workflow before going on actual pypi. You'll need to create a trusted publisher, and link it to the GitHub actions, and the GitHub environment. The documentation for that is here: https://docs.pypi.org/trusted-publishers/
(The site in general is pretty comprehensive). Once you get it working on the test pypi, you can do the exact same thing on the actual pypi to do it!

The way the release workflow is triggered is creating a release, and have a branch named vX.Y.Z where X.Y.Z is the version.

You can also upload manually to pypi on your computer. Just build a wheel and upload it(I don't remember the pip commands off the top of my head, but the uv commands are uv build and uv publish).

@purepani
Copy link
Contributor Author

Feel free to ping me with any questions!

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