A Python Package CookieCutter Template
This CookieCutter template is a boilerplate for my own personal Python projects. It should be used for small to medium size Python packages.
First, install CookieCutter via pip or conda.
$ pip install -U cookiecutter
$ conda install -c conda-forge cookiecutter
Now, create a new cookiecutter from this template by executing one of the following commands:
$ cookiecutter gh:markusritschel/cookiecutter-pypackage
$ cookiecutter https://github.com/markusritschel/cookiecutter-pypackage.git
$ cookiecutter git+https://github.com/markusritschel/cookiecutter-pypackage
$ cookiecutter git+ssh://[email protected]/markusritschel/cookiecutter-pypackage.git
├── AUTHORS.md
├── CHANGELOG.md
├── CITATION.cff
├── docsrc
│ ├── authors.md
│ ├── changelog.md
│ ├── _config.yml
│ ├── content.md
│ ├── intro.md
│ ├── license.md
│ ├── logo.png
│ ├── markdown.md
│ ├── markdown-notebooks.md
│ ├── notebooks.ipynb
│ ├── readme.md
│ ├── references.bib
│ └── _toc.yml
├── LICENSE
├── Makefile
├── notebooks
├── pyproject.toml
├── README.md
└── src
├── {{ cookiecutter.package_name }}
└── tests
The package's source code resides in a subdirectory of src
.
This follows the Good Integration Practices from pytest.org;
The advantage of such a layout is that the tests (residing in the root folder of the package) run always agains the
installed version of the source code.
If the package's source code would exist in a direct subdirectory of the root directory, import statements like
import mypackage
would refer to the subdirectory instead of the installed version. Another good source on this issue can be found here.
The documentation is to be placed inside docsrc/
and makes use of jupyterbook.
Issues & pull-requests accepted.
© Markus Ritschel 2024