chore: modifications to ease into Pypi release #112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description: Prepare Discovery for PyPI Publication
This PR prepares the
discoverypackage for publication on PyPI. Since we now have a Zenodo release, it makes sense to also make Discovery available on PyPI. This PR does not really do much, except that it makes minor tweaks to make the PyPI release go smooth. Once we have PyPI, it is a small step to also make it available on conda-forge.While I could do the PyPI release myself, my reasoning is that Michele (or Pat?) should own the release, so they should do it from their account.
This PR
Includes:
_version.py(set to 0.5.1)discovery-pulsar(to avoid conflicts with existingdiscoverypackage)Changes Made
Version Management (
src/discovery/_version.py)_version.pyfile with version0.5.1__init__.pyto import version from_version.pyPackage Configuration (
pyproject.toml)discoverytodiscovery-pulsarhttps://github.com/nanograv/discoveryhttps://github.com/nanograv/discovery/issuesnanograv/discoveryrepositoryCI/CD (
.github/workflows/publish.yml)Instructions for PyPI Publication
To complete the PyPI publication process, the package owner (Michele or Pat) needs to complete the following steps:
Step 1: Create PyPI Accounts
If you don't have an account yet, register one:
Step 2: Generate API Tokens
PyPI API Token:
TestPyPI API Token:
Step 3: Add GitHub Secrets
PYPI_PASSWORD: Paste your PyPI API tokenTEST_PYPI_PASSWORD: Paste your TestPyPI API tokenStep 4: Test Publication on TestPyPI
Since PyPI releases are definitive, you will want to test. Therefore, test the process. It can be done in multiple ways. You can build and then upload with twine. Or you can use flit to do it all. Or, perhaps even better, integrate it in github actions (which is what I would recommend eventually). However, start with a manual upload:
Option A: Manual Test with Twine (Recommended for first time)
Twine is a utility for uploading Python packages to PyPI. It's a good alternative to flit if you prefer more control over the build and upload process.
When prompted:
__token__)__token__, use the token as the password)Option B: Test via GitHub Release
v0.5.1-test)Verify TestPyPI Installation
Step 5: Publish to Production PyPI
Once you've verified the TestPyPI publication works:
Option A: Manual Publication with Twine (Recommended)
When prompted:
__token__)__token__, use the token as the password)Make sure you're uploading to production PyPI, not TestPyPI! If you have a
.pypircfile, you can specify:twine upload --repository pypi dist/*Verification before upload:
You can check the package files before uploading:
v0.5.1(must match version in_version.py)v0.5.1(or descriptive title)Step 6: Verify Publication
Future Releases
For future releases:
src/discovery/_version.pyv0.5.2)Important Notes
discovery-pulsarwas chosen becausediscoveryis already taken on PyPI. Users will install withpip install discovery-pulsarbut import asimport discovery.src/discovery/_version.py- update this file for each release.microsoft/action-pythonreusable workflow, which handles building and publishing automatically.Checklist for PyPI account owner
PYPI_PASSWORDsecret to GitHub repositoryTEST_PYPI_PASSWORDsecret to GitHub repository