π₯ Cookiecutter Template for Modern Python Package Projects π
A package template that comes pre-configured with pre-commit
, conventional-commits
, mkdocs
docs generation and hosting, linting
frameworks and a unit testing
suite out-of-the-box for better python project development.
Cookiecutter templates enables developers and data scientists to create projects from a predefined template. This template is a modern Python package project structure that utilizes a number of tools to automate and align with best practices in order to have smoother development. The project template can be viewed from the structure document. The template creates a project that can be hosted on GitHub and deployed to PyPI.
This template uses husky
, commitlint
and pre-commit
managed by pnpm
to use git
hooks to automate tasks such as linting, formatting, testing, etc. before a commit is made. This ensures that the code is always in a consistent state and that the commit history is clean and easy to read. The commit messages are also linted to ensure that they follow the Conventional Commits specification.
mkdocs
is used to generate a static site for documentation of the project from the docs
folder. This is hosted on GitHub Pages through a GitHub Action in .github
. The site is automatically built and deployed on every push to the main
branch. Mkdocs Material is used as the theme for the documentation site.
This project is primarily built for .vscode
but can be used with other editors as well. The .vscode
folder contains a number of settings and extensions that are recommended for the project. These are automatically installed when the project is opened in VS Code.
This project uses Pytest as a testing framework with code coverage. A number of python linters are configured to run through pyproject.toml
.
βοΈ Helper Resources for more information on choice of tools and how to use them.- π Project structure for more information on the project structure.
-
Clone the repository
git clone https://github.com/dotlas/cookiecutter-pypackage cd cookiecutter-template
-
Initialize
base
conda environment for cookiecutter dependencies and install requirementsDevelopers @Dotlas can directly use the
dotlas
environment instead ofbase
conda activate base python -m pip install -r requirements.txt
Run the following command to create a new project:
cookiecutter .
Or use directly from source:
cookiecutter gh:dotlas/cookiecutter-pypackage