Skip to content

markusritschel/cookiecutter-pypackage

Repository files navigation

Cookiecutter-PyPackage Template

License MIT

A Python Package CookieCutter Template

Setup

This CookieCutter template is a boilerplate for my own personal Python projects. It should be used for small to medium size Python packages.

Installation

First, install CookieCutter via pip or conda.

$ pip install -U cookiecutter
$ conda install -c conda-forge cookiecutter

Usage

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://git@github.com/markusritschel/cookiecutter-pypackage.git

Structure

    ├── 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
        

Source code

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.

Documentation

The documentation is to be placed inside docsrc/ and makes use of jupyterbook.

Maintainer

Contributing

Issues & pull-requests accepted.


© Markus Ritschel 2024

About

A cookiecutter template for new Python projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published