This repository provides a Cookiecutter template for creating Python packages ready to be uploaded to PyPI. It includes integration with GitHub Actions to automatically publish new versions to PyPI.
-
Standard Python package structure
-
Automatic GitHub Actions setup for:
- Building and uploading packages to PyPI when a new tag is created
-
Configuration with pyproject.toml
-
Support for common licenses and README
-
Support for unittest/pytest
First, install Cookiecutter if you haven't already:
pip install cookiecutter
To generate a new project based on this template, run:
cookiecutter gh:ibonn/pypi-package-template
This will prompt you for basic information like package name, description, license, etc. and generate a ready-to-use directory structure.
-
Add the package publishers on both sites (PyPI and TestPyPI)
- PyPI project name: Your package name
- Owner: Your GitHub username/organization name
- Repository name: Your repository name
- Workflow name: pypi-publish.yml
- Environment name: Leave it empty
-
Make sure your code is ready and versioned
-
Create a tag on GitHub
git tag v0.1.0 git push origin v0.1.0
-
GitHub Actions will automatically build and publish the package to PyPI
You can modify the files within the template to suit your needs. The GitHub Actions configuration is located in .github/workflows/
Contributions are welcome! If you have suggestions or improvements, open an issue or submit a pull request
This project is licensed under the MIT License.
This template was presented as part of a talk at Python Bilbao. Follow them on: