
Project structure:
myproject/ ├── mypackage/ │ ├── __init__.py │ ├── core.py │ └── utils.py ├── tests/ │ └── test_core.py ├── README.md ├── requirements.txt └── pyproject.toml
pyproject.toml (modern standard):
[build-system] requires = ["setuptools"] build-backend = "setuptools.backends.legacy:build" [project] name = "mypackage" version = "0.1.0" description = "My awesome package" requires-python = ">=3.8" dependencies = ["requests"]
Build & publish to PyPI:
pip install build twine python -m build # creates dist/ folder twine upload dist/* # upload to PyPI
Install locally for development:
pip install -e . # editable install
__init__.py: Makes a folder a Python package. Can be empty or expose public API: from .core import MyClass.
Reference:
TaskLoco™ — The Sticky Note GOAT