diff --git a/{{cookiecutter.project_slug}}/.env.defaults b/{{cookiecutter.project_slug}}/.env.defaults new file mode 100644 index 0000000..ffdee59 --- /dev/null +++ b/{{cookiecutter.project_slug}}/.env.defaults @@ -0,0 +1,3 @@ +# Add any project-wide default values here. Note that they should still +# be valid values, so not examples like EMAIL=myusername@mydomain, those should +# be specied elsewhere like in user-local .env file. diff --git a/{{cookiecutter.project_slug}}/.tool-versions b/{{cookiecutter.project_slug}}/.tool-versions new file mode 100644 index 0000000..edeafe2 --- /dev/null +++ b/{{cookiecutter.project_slug}}/.tool-versions @@ -0,0 +1,3 @@ +# this if config file for https://asdf-vm.com/ +# which can be used to install hundreds of tools at specific version +poetry 1.7.1 diff --git a/{{cookiecutter.project_slug}}/Makefile b/{{cookiecutter.project_slug}}/Makefile new file mode 100644 index 0000000..c642975 --- /dev/null +++ b/{{cookiecutter.project_slug}}/Makefile @@ -0,0 +1,18 @@ +include tools/make/*.mk +# please keep any rules idempotent if possible. +# NOTE: whenever useful, we'll use sentinel pattern with .make- prefix to avoid unnecessary work + +# please keep dev-setup idempotent +dev-setup: deps + +# use 'make -B deps' to force execution of rule +# `make deps` allows us to absract details of package manager without changing developer flow or github actions +deps: .make-dev-deps + +# this should install all dependencies, and only those mentioned in the lock file +# Note that rule should be idempotent and return immediately if there's nothing to do, so that +# eg. test can depend on this. Strictly speaking this depends on 'pyproject.toml' too, but often those changes +# are not relevant to dependencies and user can always do `make -B to force rebuild` +.make-dev-deps: poetry.lock + poetry install --sync + touch $@ diff --git a/{{cookiecutter.project_slug}}/sample.envrc b/{{cookiecutter.project_slug}}/sample.envrc new file mode 100644 index 0000000..8170299 --- /dev/null +++ b/{{cookiecutter.project_slug}}/sample.envrc @@ -0,0 +1,12 @@ +# Read .envrc settings in parent dirs if present +source_up + +# See https://github.com/direnv/direnv/wiki/Python#poetry to activate Poetry automatically +layout_poetry + +# first load defaults and then apply any custom env vars if present, overriding defaults +dotenv .env.defaults +dotenv_if_exists .env + +# add any tools/scripts to the path +PATH_add tools diff --git a/{{cookiecutter.project_slug}}/tools/make/Common.mk b/{{cookiecutter.project_slug}}/tools/make/Common.mk new file mode 100644 index 0000000..87d6fac --- /dev/null +++ b/{{cookiecutter.project_slug}}/tools/make/Common.mk @@ -0,0 +1,57 @@ +# use sane shell by default, as well as other settings +SHELL := bash +.SHELLFLAGS := -eu -o pipefail -c +.DELETE_ON_ERROR: +MAKEFLAGS += --warn-undefined-variables --no-builtin-rules +.DEFAULT_GOAL = help + +# location for source files +SRC ?= src/ + +# Hack to make help rule work, given that rule has suffix ' ##