Build and Publish#
If you are developing a library, after adding dependencies to your project, and finishing the coding, it's time to build and publish your package. It is as simple as one command:
1 |
|
This will automatically build a wheel and a source distribution(sdist), and upload them to the PyPI index.
To specify another repository other than PyPI, use the --repository
option, the parameter can be either the upload URL or the name of the repository stored in the config file.
1 2 |
|
Publish with trusted publishers#
You can configure trusted publishers for PyPI so that you don't need to expose the PyPI tokens in the release workflow. To do this, follow the guide to add a publisher and write the GitHub Actions workflow as below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Build and publish separately#
You can also build the package and upload it in two steps, to allow you to inspect the built artifacts before uploading.
1 |
|
There are many options to control the build process, depending on the backend used. Refer to the build configuration section for more details.
The artifacts will be created at dist/
and able to upload to PyPI.
1 |
|