Quietly building the future.
2024-06-12
(Updated 2024-07-07 with improvements based on doing the Air 0.3.0 release.)
To do a new release of a Python package that is managed by Rye:
Update the package version: Open pyproject.toml
and check version
under [tool.rye]
, then:
rye version -b minor
Now recheck pyproject.toml
to see the new version number.
Update the changelog: Open the CHANGELOG.md
file and add a new section for the new release version. Document all the changes, bug fixes, and new features in this section.
Commit the changes:
git commit -am "Release version 0.3.0"
Build the package: Run the following command to build the package:
rye build
This will create sdist and wheel in dist/
Test the package: It's a good practice to test the built package before releasing it. You can create a new virtual environment and install the package from the dist/
directory to ensure everything works as expected.
python -m venv .venvtmp
source .venvtmp/bin/activate
pip install dist/your-package-0.3.0-py3-none-any.whl
(test your package here)
deactivate
rm -rf .venvtmp
Upload the package to the Python Package Index (PyPI):
rye publish
You will be prompted to enter your PyPI username and password (or API token).
Commit and tag the release: After the successful upload, commit the changes to your version control system and create a new tag for the released version:
git commit -am "Release version X.X.X"
git tag X.X.X
git push --tags
Replace X.X.X
with the actual version number you released.
Publish the release on GitHub: To get the release to appear under Releases on GitHub:
CHANGELOG.md
file.tar.gz
and .whl
files from the dist/
directory