A cookiecutter template for a monorepo containing several python packages. This repository structure is partially inspired by this medium post.
To use, install cookiecutter if you have not done so already,
pip install -U cookiecutter
Then:
cookiecutter https://www.github.com/davehadley/monorepo-python
The generated package contains the following directories/files:
setup.sh
: a setup script to run before starting development. It handles creation of a python virtual environment.bin/
: added to the path by the setup script and is a place to store scripts needed by all sub-packages.bin/{{cookiecutter.project_slug}}.manage.py
: a script that runs build and test operations on all sub-packages.lib/
: sub-packages of this mono-repo go in here.templates/
: contains cookie-cutter templates used to generate new packages insidelib/
.
See the inner README.md for additional information.
Tests are run with pytest. From the root directory of the package run:
source setup.sh && pytest tests
On CentOS 7, when running the initial cookiecutter command you may run into an error:
RuntimeError: Click will abort further execution because Python was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/unicode-support/ for mitigation steps.
To resolve this, check that your LANG
and LC_ALL
environment variables are set to
valid values. You can list the valid values with locale -a
.
For example, setting LANG to:
export LANG=en_US.utf8
may solve the problem.