Skip to content

VDuchauffour/python-package-template

Repository files navigation

Python Package Template

Lightweight template for Python package.

How to complete to setup your project

Things you have to do in order to properly set up our project:

  • replace all references of package_name with the corresponding value of your project in the pyproject.toml, src folder and README.md files.
  • replace all references of owner_name with the corresponding value of your project in the pyproject.toml and README.md files.
  • setup the corresponding Python versions in the pyproject.toml and .github/workflows/ci.yml files
  • uncomment the necessary wheels part in .github/workflows/release.yml. If you choose the cibuildwheel (which only works if the build of your project is platform related, e.g. if it has C or C++ extensions) you may need to set Python versions used for the build.
  • set the code owners in the .github directory if necessary.
  • add your PyPI API token as Github secret with the name PYPI_API_TOKEN.
  • change your name in the LICENSE file.

About this template

This project provide a flexible and lightweight Python package template. It includes the following components:

  • a pyproject.toml file which define the configuration of the dependencies. The specifications defined by PEP 621 of project metadata are stored in this file.
  • a requirements-dev.txt file which contains development dependencies.
  • a .pre-commit-config.yaml pipeline which apply the same dependencies

Github actions

The project contains multiple Github workflow, including:

  • ci, apply linting and run tests with pytest and pytest-cov.
  • draft, draft a new release when a commit is pushed on branch main or master given its config file located at .github/release-drafter.yml.
  • release, build the package with cibuildwheel when a release is published and upload it to the PyPI index.
  • pre_commit_auto_update, run a pre-commit autoupdate every month and open a pull request if needed.
  • pr_description_enforcer, enforce description on pull requests, otherwise close the pull request.
  • pr_labeler, apply a corresponding label on a pull request given its config file located at .github/pr-labeler.yml

Some of these actions requires you to allow Github actions to create or approve pull requests. Learn more.

The generated badges are located in the .github/assets/badges/ folder.

Acknowledgements

DELETE EVERYTHING ABOVE FOR YOUR PROJECT


Your Project Name

CI/CD CI Pipeline Release Interrogate Codecov
Meta Ruff Pre-commit License
Package PyPI - Python version PyPI - Version

About this project

My description

️️⚙️ Installation

Install the package from the PyPI registry.

pip install package

Install the package from the latest commit of the repository.

pip install git+https://github.com/owner_name/package_name

⚡ Usage

Example

from package_name import foo

Insert example usage here.

⛏️ Development

Clone the project

git clone https://github.com/owner_name/package_name

In order to install all development dependencies, run the following command:

pip install -e ".[dev]"

To ensure that you follow the development workflow, please setup the pre-commit hooks:

pre-commit install