Skip to content
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 PIPY release instructions to Developer Docs #306

Open
jordandsullivan opened this issue Mar 14, 2025 · 5 comments
Open

Add PIPY release instructions to Developer Docs #306

jordandsullivan opened this issue Mar 14, 2025 · 5 comments
Assignees
Milestone

Comments

@jordandsullivan
Copy link
Collaborator

jordandsullivan commented Mar 14, 2025

I noticed in our developer docs, we don't currently include instructions for pushing a new version to PyPI.

@Misty-W are the steps are the same as for Mitiq? https://mitiq.readthedocs.io/en/stable/release.html#release-the-new-version-on-pypi

Originally posted by @jordandsullivan in #305 (comment)

@Misty-W
Copy link
Collaborator

Misty-W commented Mar 14, 2025

No, they are a bit more manual. Side note: I created #308 to fix that.

  1. Make sure you have the latest version of PyPA’s build installed:

  2. Now run this command from the same directory where pyproject.toml is located:

python3 -m build

  1. Once you are registered with TestPyPI, you can use twine to upload the distribution packages.

python3 -m twine upload --repository testpypi dist/*

  1. I use pip to install ucc from TestPyPI:

python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps ucc-[YOUR-USER]

but if you want to use Poetry here's a guide on how to do that, with the caveat that I haven't used it personally:
https://towardsdatascience.com/packages-part-2-how-to-publish-test-your-package-on-pypi-with-poetry-9fc7295df1a5/

  1. If all is working, you can repeat steps 3 and 4 with
    python3 -m twine upload --repository pypi dist/*
    and install UCC using poetry or pip

@Misty-W Misty-W self-assigned this Mar 14, 2025
@Misty-W Misty-W added this to the 0.4.5 milestone Mar 14, 2025
@jordandsullivan
Copy link
Collaborator Author

jordandsullivan commented Mar 14, 2025

Related change to the docs would be that you don't actually need to manually create a new tag locally before publishing using the Release GUI on GitHub, as you can create a new tag automatically:

Image

This is what we currently have in our instructions for Release, which includes the unnecessary local tagging step:

Image

@jordandsullivan
Copy link
Collaborator Author

I'm in the process of trying to automate the PyPI releases using GH Actions #308 and adding my steps here so they can be documented for future releases:

I've added OIDC authentication for the python-publish.yml GH action on PyPI and TestPiPY:

Image

This allows the action to publish to both, and the workflow file currently pushes first to testpypi and then, if manually approved by myself, @bachase , or @Misty-W , published to PyPI.

The process should be automatically triggered whenever we do a release using the normal GH GUI, and I am also creating a manual dispatch trigger for testing purposes.

@jordandsullivan
Copy link
Collaborator Author

jordandsullivan commented Mar 14, 2025

After manually triggering dispatch, it should run the TestPyPI step and upload there, which you should then test locally the poetry install, TODO: add instructions for how to poetry install from testPyPI.

After that, one of us admins can manually approve publishing to the real PyPI.

@jordandsullivan
Copy link
Collaborator Author

jordandsullivan commented Mar 19, 2025

Instructions for maintainers, reflecting the GitHub Actions automated workflow per #308 and #311:

  1. Follow our normal Developer Docs for cutting a release.
  2. The deployment to TestPiPY should trigger automatically (only maintainers will have access).
  3. Run a test of the TestPiPY deployment on your local machine:
    a. Create a new python environment > our latest required version, e.g. python3.13 -m venv ~/.venvs/test_ucc
    b. Run pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ucc to install from the TestPiPY deployment
    c. Run python -c "import ucc; print(ucc.__version__)". This should run successfully and (theoretically) show the latest version of UCC (bug #312.
  4. If all went well in the TestPyPI step, you (as a maintainer) can go to the GH Actions and approve the deployment to real PyPI.

If for some reason this does not work, or fails to trigger on a release, you can also manually trigger the workflow in the Github Actions tab:

Image Image Image

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

No branches or pull requests

2 participants