Skip to content

Repository files navigation

py_template

Template repository for Python projects. After you create a new repository using this one as template, search and replace all "my_project_name" with the desired name.

Uses uv for environment and dependency management and ruff for formatting and linting. The Python version is pinned in .python-version and baked into the Docker image at build time.

Build the Docker container image

docker build -f docker/Dockerfile -t my_project_name-py-dev:latest .

Run a Docker container

docker run -it --rm --network=host --privileged -v .:/root/my_project_name -w /root/my_project_name my_project_name-py-dev:latest bash

Set up the environment (inside the container)

bash -e /root/my_project_name/scripts/sync.sh

This creates the virtual environment at /opt/venv (outside the bind mount) and generates uv.lock on first run. Commit the resulting uv.lock.

Run the application

uv run my_project_name

Lint and format

bash -e /root/my_project_name/scripts/lint_format.sh

Run the tests

bash -e /root/my_project_name/scripts/test.sh

Coverage

Run the tests under coverage and produce an HTML report. Fails if line coverage falls below 80% (the threshold enforced in CI).

bash -e /root/my_project_name/scripts/coverage.sh

API documentation

Docs are generated with mkdocs and the API reference is auto-generated from docstrings with mkdocstrings.

bash -e /root/my_project_name/scripts/build_docs.sh

To preview with live reload, serve them (the container is run with --network=host, so the site is reachable from the host):

uv run mkdocs serve -a 0.0.0.0:8000

Using VSCode

Needed extensions on the host PC:

code --force --install-extension ms-azuretools.vscode-containers
code --force --install-extension ms-vscode-remote.remote-containers

About

Template repository for Python projects.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages