Template repository for python projects
Documentation: https://max-models.github.io/template-python/
Create and activate python environment
python -m venv env
source env/bin/activate
pip install --upgrade pip
Install the code and requirements with pip
pip install -e .
Run the code with
template-python
make html
cd ../
open docs/_build/html/index.html
This project is configured to automatically publish to PyPI using GitHub Actions with trusted publishing (OIDC).
- Create an account on PyPI
- Create a new project or claim your project name
- Go to your PyPI project settings
- Navigate to "Publishing" → "Add a new publisher"
- Configure the trusted publisher with these details:
- PyPI Project Name:
template-python(or your project name) - Owner: Your GitHub username/organization
- Repository name:
template-python - Workflow name:
publish_pypi.yml - Environment name:
pypi
- PyPI Project Name:
- Go to your GitHub repository → Settings → Environments
- Create an environment named
pypi - Add protection rules:
- Deployment branches: Only
mainbranch
- Deployment branches: Only
Once configured, publishing is automatic:
- Merge to main branch: Any push to the
mainbranch triggers the workflow - Automatic build: The workflow builds the Python package
- Automatic publish: The package is automatically published to PyPI using trusted publishing