{"id":16429928,"url":"https://github.com/smarlhens/python-boilerplate","last_synced_at":"2025-04-08T03:13:08.982Z","repository":{"id":37091664,"uuid":"504238572","full_name":"smarlhens/python-boilerplate","owner":"smarlhens","description":"Python boilerplate using uv, pre-commit, prettier, pytest, GitHub Actions, mypy, ruff, bandit \u0026 docformatter.","archived":false,"fork":false,"pushed_at":"2024-10-24T16:22:33.000Z","size":213,"stargazers_count":52,"open_issues_count":5,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-25T12:27:04.675Z","etag":null,"topics":["bandit","boilerplate","docformatter","docker","gh-actions","mypy","pre-commit","prettier","pytest","python","renovate","ruff","uv"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smarlhens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-16T17:01:38.000Z","updated_at":"2024-10-19T09:47:56.000Z","dependencies_parsed_at":"2023-12-23T01:53:05.152Z","dependency_job_id":"c6cbe5f3-ccc5-449b-bec3-7fba0536b63b","html_url":"https://github.com/smarlhens/python-boilerplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarlhens%2Fpython-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarlhens%2Fpython-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarlhens%2Fpython-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarlhens%2Fpython-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smarlhens","download_url":"https://codeload.github.com/smarlhens/python-boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bandit","boilerplate","docformatter","docker","gh-actions","mypy","pre-commit","prettier","pytest","python","renovate","ruff","uv"],"created_at":"2024-10-11T08:24:57.486Z","updated_at":"2025-04-08T03:13:08.958Z","avatar_url":"https://github.com/smarlhens.png","language":"Dockerfile","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/astral-sh/uv\" target=\"blank\"\u003e\u003cimg src=\"https://github.com/astral-sh/uv/blob/8674968a17e5f2ee0dda01d17aaf609f162939ca/docs/assets/logo-letter.svg\" height=\"100\" alt=\"uv logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://pre-commit.com/\" target=\"blank\"\u003e\u003cimg src=\"https://pre-commit.com/logo.svg\" height=\"100\" alt=\"pre-commit logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/astral-sh/ruff\" target=\"blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/astral-sh/ruff/8c20f14e62ddaf7b6d62674f300f5d19cbdc5acb/docs/assets/bolt.svg\" height=\"100\" alt=\"ruff logo\" style=\"background-color: #ef5552\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://bandit.readthedocs.io/\" target=\"blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/pycqa/bandit/main/logo/logo.svg\" height=\"100\" alt=\"bandit logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://docs.pytest.org/\" target=\"blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/pytest-dev/pytest/main/doc/en/img/pytest_logo_curves.svg\" height=\"100\" alt=\"pytest logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://docs.docker.com/\" target=\"blank\"\u003e\u003cimg src=\"https://www.docker.com/wp-content/uploads/2022/03/Moby-logo.png\" height=\"60\" alt=\"Docker logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/features/actions\" target=\"blank\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/44036562\" height=\"60\" alt=\"GitHub Actions logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Python boilerplate\n\n[![CodeQL](https://github.com/smarlhens/python-boilerplate/workflows/codeql/badge.svg)](https://github.com/smarlhens/python-boilerplate/actions/workflows/codeql.yml)\n[![GitHub CI](https://github.com/smarlhens/python-boilerplate/workflows/ci/badge.svg)](https://github.com/smarlhens/python-boilerplate/actions/workflows/ci.yml)\n[![GitHub license](https://img.shields.io/github/license/smarlhens/python-boilerplate)](https://github.com/smarlhens/python-boilerplate)\n\n---\n\n## Table of Contents\n\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [What's in the box ?](#whats-in-the-box-)\n- [Testing](#testing)\n- [Docker](#docker)\n\n---\n\n## Prerequisites\n\n- [Python](https://www.python.org/downloads/) **\u003e=3.13.0 \u003c3.14.0** (_tested with 3.13.2_)\n- [pre-commit](https://pre-commit.com/#install) **\u003e=3.2.0 \u003c5.0.0** (_tested with 4.0.1_)\n- [uv](https://docs.astral.sh/uv/getting-started/installation/) **\u003e=0.5.29** (_tested with 0.6.5_)\n- [docker](https://docs.docker.com/get-docker/) (_optional_)\n\n---\n\n## Installation\n\n1. Clone the git repository\n\n   ```bash\n   git clone https://github.com/smarlhens/python-boilerplate.git\n   ```\n\n2. Go into the project directory\n\n   ```bash\n   cd python-boilerplate/\n   ```\n\n3. Checkout working branch\n\n   ```bash\n   git checkout \u003cbranch\u003e\n   ```\n\n4. Enable pre-commit hooks\n\n   ```bash\n   pre-commit install\n   ```\n\n5. Configure Python environment\n\n   ```bash\n   uv python install\n   uv venv\n   source .venv/bin/activate\n   ```\n\n---\n\n## What's in the box ?\n\n### uv\n\n[uv](https://github.com/astral-sh/uv) is an extremely fast Python package and project manager, written in Rust.\n\n**pyproject.toml file** ([`pyproject.toml`](pyproject.toml)): orchestrate your project and its dependencies\n**uv.lock file** ([`uv.lock`](uv.lock)): ensure that the package versions are consistent for everyone\nworking on your project\n\nFor more configuration options and details, see the [configuration docs](https://docs.astral.sh/uv/).\n\n### pre-commit\n\n[pre-commit](https://pre-commit.com/) is a framework for managing and maintaining multi-language pre-commit hooks.\n\n**.pre-commit-config.yaml file** ([`.pre-commit-config.yaml`](.pre-commit-config.yaml)): describes what repositories and\nhooks are installed\n\nFor more configuration options and details, see the [configuration docs](https://pre-commit.com/).\n\n### ruff\n\n[ruff](https://github.com/astral-sh/ruff) is an extremely fast Python linter, written in Rust.\n\nRules are defined in the [`pyproject.toml`](pyproject.toml).\n\nFor more configuration options and details, see the [configuration docs](https://github.com/astral-sh/ruff#configuration).\n\n### mypy\n\n[mypy](http://mypy-lang.org/) is an optional static type checker for Python that aims to combine the benefits of\ndynamic (or \"duck\") typing and static typing.\n\nRules are defined in the [`pyproject.toml`](pyproject.toml).\n\nFor more configuration options and details, see the [configuration docs](https://mypy.readthedocs.io/).\n\n### bandit\n\n[bandit](https://bandit.readthedocs.io/) is a tool designed to find common security issues in Python code.\n\nRules are defined in the [`pyproject.toml`](pyproject.toml).\n\nFor more configuration options and details, see the [configuration docs](https://bandit.readthedocs.io/).\n\n### docformatter\n\n[docformatter](https://github.com/PyCQA/docformatter) is a tool designed to format docstrings to\nfollow [PEP 257](https://peps.python.org/pep-0257/).\n\nOptions are defined in the [`.pre-commit-config.yaml`](.pre-commit-config.yaml).\n\n---\n\n## Testing\n\nWe are using [pytest](https://docs.pytest.org/) \u0026 [pytest-cov](https://github.com/pytest-dev/pytest-cov) to write tests.\n\nTo run tests:\n\n```bash\nuv run pytest tests\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eOutput\u003c/summary\u003e\n\n```text\ncollected 1 item\n\ntests/test_myapplication.py::test_hello_world PASSED\n```\n\n\u003c/details\u003e\n\nTo run tests with coverage:\n\n```bash\nuv run pytest tests --cov=src\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eOutput\u003c/summary\u003e\n\n```text\ncollected 1 item\n\ntests/test_myapplication.py::test_hello_world PASSED\n\n---------- coverage: platform linux, python 3.10.4-final-0 -----------\nName                            Stmts   Miss  Cover\n---------------------------------------------------\nsrc/myapplication/__init__.py       1      0   100%\nsrc/myapplication/main.py           6      2    67%\n---------------------------------------------------\nTOTAL                               7      2    71%\n```\n\n\u003c/details\u003e\n\n---\n\n## Docker\n\n### Build\n\nTo build the docker `production` image using [`Dockerfile`](Dockerfile):\n\n```bash\ndocker build . -t my-python-application:latest\n```\n\nTo build the docker `development` image using [`Dockerfile`](Dockerfile):\n\n```bash\ndocker build . --target development -t my-python-application:dev\n```\n\n### Run\n\nTo run the python app example inside Docker:\n\n```bash\ndocker run -it --rm my-python-application:latest # or :dev for development\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eOutput\u003c/summary\u003e\n\n```text\nHello World\n```\n\n\u003c/details\u003e\n\n### Execute command inside container\n\n```bash\ndocker run -it --rm my-python-application:latest bash\n```\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarlhens%2Fpython-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmarlhens%2Fpython-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarlhens%2Fpython-boilerplate/lists"}