This is a starter template to publish to PyPI.
Describe your project here and remove these instructions, this README will appear in your documentation and on your PyPI page.
Find and replace any instances of REPLACEME-
with your information. Replace the placeholders in src/
with your application. Add appropriate tests to tests/
.
Add your development dependencies to requirements.txt
and any runtime dependencies to pyproject.toml
.
Add your top-level functions to docsrc/index.rst
Log into your account on PyPI and configure a pending Trusted Publisher:
- PyPI Project Name: The name of the project
- Owner: Your GitHub username
- Repository name: Your GitHub repo
- Workflow name:
release.yml
- Environment name: Leave this blank
The project will be created the first time the publication action runs successfully.
In VSCode, press Ctrl
+Shift
+p
(Windows) or Cmd
+Shift
+p
(Mac) and search for "Python: Create Environment...". Take the defaults and install requirements from requirements.txt
.
Always write your test cases and make sure they run correctly locally before pushing your code.
pytest
Run a test build to ensure everything works correctly.
python -m build
Commit your changes, push your branch, and open a PR. The pre-release.yml
workflow will run, and make sure the project builds against Python 3.10, 3.11, and 3.12. It will also generate a fresh copy of your docs into the docs
directory.
When everything looks fine (hint: pull the latest changes on the branch and open docs/index.html
), you can merge the PR.
You only have to do this once. In your repo, go to "settings/pages". Choose "Deploy from a branch", set your branch to main
and deploy from /docs
. Further down the page, select "Enforce HTTPS".
Your site will now build.
When you're ready to publish to PyPI, create and push an annotated tag on the main
branch:
git checkout main
git pull
git tag -a v1.0.0 -m "v1.0.0"
git push origin tag v1.0.0
The release.yml
workflow will run and publish to PyPI.