Skip to content

ibonn/pypi-package-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI Package Cookiecutter Template

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.

Features

  • 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

Installation

First, install Cookiecutter if you haven't already:

pip install cookiecutter

Usage

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.

Publishing to PyPI

  1. Create an account on PyPI and TestPyPI

  2. 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
  3. Make sure your code is ready and versioned

  4. Create a tag on GitHub

    git tag v0.1.0
    git push origin v0.1.0
    
  5. GitHub Actions will automatically build and publish the package to PyPI

Customization

You can modify the files within the template to suit your needs. The GitHub Actions configuration is located in .github/workflows/

Contributions

Contributions are welcome! If you have suggestions or improvements, open an issue or submit a pull request

License

This project is licensed under the MIT License.

Reference

This template was presented as part of a talk at Python Bilbao. Follow them on:

  • GitHub
  • Telegram
  • Meetup

About

PyPI package Cookiecutter template

Topics

Resources

License

Stars

Watchers

Forks

Languages