Package using pyproject.toml
- The publisher is using the latest version of setuptools
- The latest version of twine is used to upload the package
- The user installing the package has at least Pip 9.0, or a client that supports the Metadata 1.2 specification.
Creating the package files
packaging_tutorial/
├── LICENSE
├── pyproject.toml
├── README.md
├── src/
│ └── your_package/
│ ├── __init__.py
│ └── example.py
└── tests/
Dealing with the universal wheels
Traditionally, projects providing Python code that is semantically compatible with both Python 2 and Python 3, produce wheels that have a py2.py3 tag in their names.
It is often configured within setup.cfg under the [bdist_wheel] section by setting universal = 1 if they use setuptools.
Choosing a build backend
Tools like pip and build do not actually convert your sources into a distribution package (like a wheel); that job is performed by a build backend.
The build backend determines how your project will specify its configuration, including metadata (information about the project, for example, the name and tags that are displayed on PyPI) and input files.
Build backends have different levels of functionality, such as whether they support building extension modules, and you should choose one that suits your needs and preferences.
- Hatchling
- setuptools
- Flit
- PDM
others that support the [project] table for metadata. The pyproject.toml tells build frontend tools like pip and build which backend to use for your project.
Defining the Python version required
python3 -m pip install --upgrade setuptools twine
Generating distribution archives
python3 -m pip install --upgrade build
python3 -m build
Uploading the distribution archives
python3 -m pip install --upgrade twine
python3 -m twine upload --repository pypi dist/*
Installing your newly uploaded package
python3 -m pip install toml_package
Metadata
Release files for toml-package 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| toml_package-0.0.2.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| toml_package-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.5 kB
Release files / toml_package-0.0.2.tar.gz
| Download URL | toml_package-0.0.2.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
556fb9417f701e5fc4d23253ff53fa816050b72accb6c3c60f57db9d57e0e8a8
|
|
BLAKE2b-256 checksum How to use checksums |
cb8039cf58325280180d2448cc611a3a52f5d04a1eeeb3c4f62fe61f04340b35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / toml_package-0.0.2-py3-none-any.whl
| Download URL | toml_package-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db3cdfce8ce4ad252e9f3fe4412469c7612cdcc4e840153397b9af69fbeac6ac
|
|
BLAKE2b-256 checksum How to use checksums |
c61fbeb409dcaa41b7bdd90843bcc7d99e4c071a7b15eb4cb1df7ebbe9259c76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|