- Phase: 10. Concurrency & Internals
- Duration: 2 hours
- Create a pyproject.toml for modern Python packaging
- Understand setup.py vs pyproject.toml
- Build source distributions (sdist) and wheels
- Upload packages to PyPI with twine
- Apply semantic versioning (semver)
- Add project metadata (authors, classifiers, README)
- pyproject.toml (modern packaging)
- setup.py vs pyproject.toml
- setuptools
- Creating source distributions (sdist) and wheels
- Uploading to PyPI (twine)
- Version numbering (semver)
- Project metadata (authors, classifiers, README)
- version convention
Modules 000-096.
# pyproject.toml
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.backends._legacy:_Backend"
[project]
name = "mypackage"
version = "0.1.0"
description = "A short description"
readme = "README.md"
license = {text = "MIT"}
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
]
dependencies = [
"requests>=2.25",
]# __init__.py
__version__: str = "0.1.0"# Build and publish
python -m build
twine upload dist/*- Python packaging guide: https://packaging.python.org
- pyproject.toml specification: https://peps.python.org/pep-0621
- semver.org
Module 098: Performance Optimization & Profiling