A template repository for building a Python package with the src layout.
python-template/
├── src/
│ └── my_package/
│ ├── __init__.py
│ └── core.py
├── tests/
│ ├── __init__.py
│ └── test_core.py
├── pyproject.toml
└── .gitignore
-
Rename the package — replace every occurrence of
my_package/my-packagewith your package name. -
Install in editable mode:
pip install -e ".[dev]" -
Run tests:
pytest
-
Lint / format:
ruff check src tests ruff format src tests
- Source code lives under
src/<your_package>/ - Add runtime dependencies to
[project] dependenciesinpyproject.toml - Add dev/test dependencies to
[project.optional-dependencies] dev