A Copier template for Python projects.
Poetry used for package dependency management.
Currently, this Copier template relies on and requires the copier-templates-extensions plugin so that an embedded Jinja2 extension (extensions/shell.py
) can be properly loaded and used in templates.
The plugin needs to be installed in the Python environment that is used with copier
. If copier
is installed via Homebrew (as it is the case in my setup), the easiest way would be to run the following from the command line:
$(brew --prefix copier)/libexec/bin/pip3 install copier-templates-extensions
The embedded extensions/shell.py
extension is used because even when a Jinja2 3.x version of jinja2-shell-extension is now published, the embedded version includes additional parameters.
Generation of a project is as simple as running:
copier "gh:tnarik/copier-python" /path/to/your/new/project
Once the project has been created, you can go ahead and cd
into the project folder.
If your system is configured to run the direnv
hooks (it should, see WORKBENCH.md), then you just need to execute:
direnv allow .
poetry install
These commands will setup the automated activation of the project local virtual environment and install all DEV dependencies.
Perhaps something like pawamoy/copier-poetry is preferable for some people, but it includes too much magic and post-generation scripts which is something I prefer not using. In any case, you can give it a try.