PyPi no longer allows simple username/password authhentication through twine. 2FA is now required for all publisyhing.
This gist is based on this PyPA guide
setuptools
setup.py
-- see example below and in this projectREADME.md
in your project
- Sign in to PyPi and edit a project from the Username > Your Projects menu: https://pypi.org/manage/projects/
- [[Manage]] a project and choose [[Publishing]] and Add a new publisher
- Fill in the details below and click [[Add]]
- Owner: github username or org name
- Repository Name :project name
- Workflow name: release.yml file name
- see release.yml
- Environment name: leave this blank
This will create a workflow that publishes to PyPi when a new release is tagged.
- Within the project, add the following file:
projectroot/.github/workflows/release.yml
see release.yml
- Commit changes and push to github; make sure to update the version number in the project
constants.py
file - Use the Releases feature to tag a new release:
- Click on [[Releases]]
- [[Draft a new release]]
- [[Choose a tag]] and add a new version tag (e.g. v0.2.9) that matches the version in the
constants.py
file - Provide a release title
- Describe the release
- [[Publish release]]
- Click on the [[Actions]] tab and view the workflow in progress