Easy-to-use, general-purpose, modern cookiecutter template for Python
Project description
snickerdoodle
Version | |
Status | |
Docs | |
Compatibility | |
Stats | |
Tools | |
What is snickerdoodle?
snickerdoodle
is an easy-to-use, general-purpose cookiecutter template for Python projects utilizing pdm
, mkdocs
, GitHub Actions, ruff
, and other modern tools. To see what a repository looks like using the template, you can check out snickerdoodle_demo
.
Why use snickerdoodle?
There are an enormous number of cookiecutter templates. However, many are difficult to use, inflexible, and/or underdocumented. I created snickerdoodle
because I couldn't find another cookiecutter
template meeting these criteria:
- Modern: most templates are older and do not use current best practices, such as
pyproject.toml
and one of the numerous dependency managers that make project management much easier. - PEP-Compatible: all included tools should meet the design specifications of all finalized PEPs (that rules out
poetry
, which, three years after PEP adoption, is still not PEP 621 compatible). - No External Services: I wanted a template that didn't require external services offering CI/CD, code coverage, code analysis, etc. This is particularly true for services that are neither free nor open-source (e.g. sonarcloud.io, which is in an increasing number of newer templates).
- (Nearly) Turn-Key: a template should be easy to deploy and immediately use without having to understand or examine the underlying code.
- Flexible: beyond the core tools, a template should be easy to add other components too (including external services that you use).
To meet those goals, snickerdoodle
uses pdm
, a modern dependency manager (that follows PEP 621 syntax), GitHub Actions for CI/CD, and GitHub Pages for documentation hosting. The only other dependency for the template is, obviuosly, cookiecutter
.
Further, rather than adopting a rigid, opinionated approach, snickerdoodle
includes nice-looking and functional defaults (like the badges table above, which will include several other badges in your created project). There are also nice extras, like an automatically generated credits page in the documentation, that should work with any Python project. snickerdoodle
makes no assumptions about the type of Python project you are creating and includes base template options that are (nearly) universal.
Getting started
This section describes the basic usage of the snickerdoodle
template. If you want to modify its settings or have other questions, you should consult the template user guide.
Requirements
To use snickerdoodle
and the repository that it creates, you need python
, git
, cookiecutter
(or cruft
), and pdm
installed on your system. You also need a GitHub account. If you have not already, set up your GitHub credentials on your local computer.
Setup
If you are new to cookiecutter or simply want to make sure the created repository works as intended, follow the instructions in the snickerdoodle
tutorial.
If you are familiar with creating cookiecutter templates, you can go about the normal template construction process with one important addition: after you create the remote repository on GitHub, change Settings/Actions/General/Workflow Permissions to "Read and Write Permissions." This is necessary for the repository documentation to be properly deployed. Then, follow the instructions for setting up your virtual environment and deploying your documentation in the snickerdoodle
tutorial. It is especially important to follow the document deployment process for the first time - after that GitHub Actions will automatically update and redeploy the documentation (and you need not use the manual process again).
Usage
After your repository is created, you can start setting the dependencies in pyproject.toml
. Every push to GitHub will run any tests in the "Tests" folder, deploy documentation, and apply ruff
. If you wish to publish your repository to PyPi, I recommend using the pdm publish
command.
Contributing
Contributors are always welcome and should find snickerdoodle
easy to work with. The template is highly documented so that users and developers can make snickerdoodle
work with their projects. Feel free to grab an issue to work on or make a suggested improvement. If you wish to contribute, please read the Contribution Guide and Code of Conduct.
Similar Projects
These are other templates using pdm
as their dependency manager:
- cookiecutter-docker-python-pdm: uses Docker and
black
. - cookie: uses
mkdocs
and Github Actions, but also addsconda
, Nox,black
, andpyright
.
And, these are other general-purpose templates that are well-maintained, modern, and well-documented:
- cookiecutter-hypermodern-python: uses, among other tools,
sphinx
, GitHub Actions, Nox,mypy
,flake8
, andpoetry
. If you do not mind those choices and wanted a modern, maintained template, this is the one to use. - cookiecutter-pylibrary: a newer template that is minimal compared to most and uses, among other tools,
sphinx
, GitHub Actions, Setuptools, Tox, and Travis-CI. - wolt python package cookiecutter: an interesting template that uses
cruft
instead of basecookiecutter
. The created repository uses, among other tools, 'mkdocs', GitHub Actions,black
,flake8
, andpoetry
.
Acknowledgements
I'd also like to extend a special thanks to pawamoy whose excellent pdm and mkdocs extensions and utlities are incorporated into snickerdoodle
. Some of the scripts, documentation, configuration files, and other CI code were all adapted from pawamoy's repositories.
I would also like to thank the University of Kansas School of Law for tolerating and supporting this law professor's coding efforts, an endeavor which is well outside the typical scholarly activities in the discipline.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for snickerdoodle-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 716114a7282fd3a591087a0f98228e8484949e984883653b20bf0b1981d3f921 |
|
MD5 | 0f12da59133daf06bab1717be5c15d81 |
|
BLAKE2b-256 | db37c682734bc78bb986575316986c46eb96e74c565fbfadf26642a20e066b04 |