From 4ae1398bab0a6088c0c0070dee699ab7b15a4047 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 14:20:41 +0100 Subject: [PATCH 01/18] Migrate project to `pyproject.toml` and update module structure. --- Makefile | 6 ++--- pyproject.toml | 47 ++++++++++++++++++++++++++++++++++++++ setup.py | 35 ---------------------------- src/__init__.py | 1 - src/sandbox/__init__.py | 1 + src/{ => sandbox}/hello.py | 0 test/test_hello.py | 2 +- 7 files changed, 52 insertions(+), 40 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py delete mode 100644 src/__init__.py create mode 100644 src/sandbox/__init__.py rename src/{ => sandbox}/hello.py (100%) diff --git a/Makefile b/Makefile index a99809c..9d687f2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: style check_code_quality -export PYTHONPATH = . -check_dirs := src +export PYTHONPATH = src +check_dirs := src/sandbox style: black $(check_dirs) @@ -16,7 +16,7 @@ check_code_quality: flake8 $(check_dirs) --count --max-line-length=88 --exit-zero --ignore=D --extend-ignore=E203,E501,W503 --statistics publish: - python setup.py sdist bdist_wheel + python3 -m build twine upload -r testpypi dist/* -u ${PYPI_USERNAME} -p ${PYPI_TEST_PASSWORD} --verbose twine check dist/* twine upload dist/* -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} --verbose \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9cc7d73 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "sandbox-template" +dynamic = ["version"] +authors = [ + { name="zuppif", email="francesco.zuppichini@gmail.com" }, +] +description = "" +readme = "README.md" +requires-python = ">=3.9" +license = "MIT" +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] +dependencies = [] + +[project.urls] +"Homepage" = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + +[dependency-groups] +dev = [ + "flake8", + "black==22.3.0", + "isort", + "twine", + "pytest", + "wheel", +] + +[tool.setuptools.dynamic] +version = {attr = "sandbox.__version__"} + +[tool.setuptools] +package-dir = {"" = "src"} + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.black] +line-length = 120 + +[tool.isort] +profile = "black" diff --git a/setup.py b/setup.py deleted file mode 100644 index 3f61437..0000000 --- a/setup.py +++ /dev/null @@ -1,35 +0,0 @@ -import setuptools -from setuptools import find_packages -import re - -with open("./src/__init__.py", 'r') as f: - content = f.read() - # from https://www.py4u.net/discuss/139845 - version = re.search(r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', content).group(1) - -with open("README.md", "r") as fh: - long_description = fh.read() - -setuptools.setup( - name="template-python-zuppif#1", - version=version, - author="zuppif", - author_email="francesco.zuppichini@gmail.com", - description="", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://www.youtube.com/watch?v=dQw4w9WgXcQ", - install_requires=[ - # list your requires - ], - packages=find_packages(exclude=("tests",)), - extras_require={ - "dev": ["flake8", "black==22.3.0", "isort", "twine", "pytest", "wheel"], - }, - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - python_requires=">=3.7", -) diff --git a/src/__init__.py b/src/__init__.py deleted file mode 100644 index b1a19e3..0000000 --- a/src/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.0.5" diff --git a/src/sandbox/__init__.py b/src/sandbox/__init__.py new file mode 100644 index 0000000..b44315b --- /dev/null +++ b/src/sandbox/__init__.py @@ -0,0 +1 @@ +__version__ = "0.0.0.dev0" diff --git a/src/hello.py b/src/sandbox/hello.py similarity index 100% rename from src/hello.py rename to src/sandbox/hello.py diff --git a/test/test_hello.py b/test/test_hello.py index 985ff07..58b4c15 100644 --- a/test/test_hello.py +++ b/test/test_hello.py @@ -1,4 +1,4 @@ -from src.hello import hello +from sandbox.hello import hello def test_hello(): From 598e0ab5d13562137822236f93fe01a359a698ea Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 14:26:31 +0100 Subject: [PATCH 02/18] Integrate `pre-commit` for streamlined code quality checks --- .github/workflows/publish.yml | 4 ++-- .github/workflows/test.yml | 2 +- .github/workflows/welcome.yml | 2 +- .pre-commit-config.yaml | 23 ++++++++++++++++++++++ Makefile | 16 +++++---------- README.md | 37 +++++++++++++++++++++++------------ pyproject.toml | 4 +--- test/test_hello.py | 2 +- 8 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 17e1fc2..9ca6e19 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,9 +24,9 @@ jobs: python -m pip install --upgrade pip pip install ".[dev]" - name: ๐Ÿš€ Publish to PyPi - env: + env: PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} PYPI_TEST_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }} run: | - make publish -e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD -e PYPI_TEST_PASSWORD=$PYPI_TEST_PASSWORD \ No newline at end of file + make publish -e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD -e PYPI_TEST_PASSWORD=$PYPI_TEST_PASSWORD diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4fd76a1..9d58f87 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,4 +27,4 @@ jobs: run: | make check_code_quality - name: ๐Ÿงช Test - run: "python -m pytest ./test" \ No newline at end of file + run: "python -m pytest ./test" diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml index c9bb3f0..facf9b0 100644 --- a/.github/workflows/welcome.yml +++ b/.github/workflows/welcome.yml @@ -13,4 +13,4 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} issue-message: "Hello there, thank you for opening an Issue ! ๐Ÿ™๐Ÿป The team was notified and they will get back to you asap." - pr-message: "Hello there, thank you for opening an PR ! ๐Ÿ™๐Ÿป The team was notified and they will get back to you asap." \ No newline at end of file + pr-message: "Hello there, thank you for opening an PR ! ๐Ÿ™๐Ÿป The team was notified and they will get back to you asap." diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b578f40 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-toml + - id: check-added-large-files + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + args: ["--profile", "black"] + - repo: https://github.com/pycqa/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + args: ["--max-line-length=88", "--extend-ignore=E203,E501,W503", "--ignore=D"] diff --git a/Makefile b/Makefile index 9d687f2..9ee1409 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,13 @@ export PYTHONPATH = src check_dirs := src/sandbox style: - black $(check_dirs) - isort --profile black $(check_dirs) + pre-commit run --all-files check_code_quality: - black --check $(check_dirs) - isort --check-only --profile black $(check_dirs) - # stop the build if there are Python syntax errors or undefined names - flake8 $(check_dirs) --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. E203 for black, E501 for docstring, W503 for line breaks before logical operators - flake8 $(check_dirs) --count --max-line-length=88 --exit-zero --ignore=D --extend-ignore=E203,E501,W503 --statistics - + pre-commit run --all-files + publish: python3 -m build - twine upload -r testpypi dist/* -u ${PYPI_USERNAME} -p ${PYPI_TEST_PASSWORD} --verbose + twine upload -r testpypi dist/* -u ${PYPI_USERNAME} -p ${PYPI_TEST_PASSWORD} --verbose twine check dist/* - twine upload dist/* -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} --verbose \ No newline at end of file + twine upload dist/* -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} --verbose diff --git a/README.md b/README.md index dd78b7b..8afb6da 100644 --- a/README.md +++ b/README.md @@ -22,26 +22,39 @@ The project has the following structure ``` โ”œโ”€โ”€ .github โ”‚ โ””โ”€โ”€ workflows -โ”‚ โ””โ”€โ”€ test.yml # holds our github action config +โ”‚ โ””โ”€โ”€ test.yml # holds our github action config โ”œโ”€โ”€ .gitignore โ”œโ”€โ”€ Makefile โ”œโ”€โ”€ README.md -โ”œโ”€โ”€ setup.py +โ”œโ”€โ”€ pyproject.toml โ”œโ”€โ”€ src -โ”‚ โ”œโ”€โ”€ __init__.py -โ”‚ โ”œโ”€โ”€ hello.py -โ””โ”€โ”€ test +โ”‚ โ””โ”€โ”€ sandbox +โ”‚ โ”œโ”€โ”€ __init__.py +โ”‚ โ””โ”€โ”€ hello.py +โ””โ”€โ”€ test โ””โ”€โ”€ test_hello.py ``` ### Code Quality ๐Ÿงน -We provide two handy commands inside the `Makefile`, namely: +We provide two handy commands inside the `Makefile`, which both use `pre-commit` internally: -- `make style` to format the code +- `make style` to format the code and run checks - `make check_code_quality` to check code quality (PEP8 basically) -So far, **there is no types checking with mypy**. See [issue](https://github.com/roboflow-ai/template-python/issues/4). +We also use `pre-commit` to ensure code quality before each commit. You can install it using: + +```bash +pre-commit install +``` + +This will run the same checks as `make check_code_quality` on every commit. You can also run it manually on all files: + +```bash +pre-commit run --all-files +``` + +So far, **there is no types checking with mypy**. See [issue](https://github.com/roboflow-ai/template-python/issues/4). ### Tests ๐Ÿงช @@ -49,7 +62,7 @@ So far, **there is no types checking with mypy**. See [issue](https://github.com ### Publish on PyPi ๐Ÿš€ -**Important**: Before publishing, edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version. +**Important**: Before publishing, edit `__version__` in [src/sandbox/__init__.py](/src/sandbox/__init__.py) to match the wanted new version. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier. You can publish by using @@ -77,10 +90,10 @@ We use [GitHub actions](https://github.com/features/actions) to automatically ru On any pull request, we will check the code quality and tests. -When a new release is created, we will try to push the new code to PyPi. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier. +When a new release is created, we will try to push the new code to PyPi. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier. The **correct steps** to create a new realease are the following: -- edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version. +- edit `__version__` in [src/sandbox/__init__.py](/src/sandbox/__init__.py) to match the wanted new version. - create a new [`tag`](https://git-scm.com/docs/git-tag) with the release name, e.g. `git tag v0.0.1 && git push origin v0.0.1` or from the GitHub UI. - create a new release from GitHub UI @@ -93,4 +106,4 @@ This is a template repo, it's meant to be used inside GitHub upon repo creation. ## Why reinvent the wheel? -There are several very good templates on GitHub, but I prefer to use code we wrote instead of blinding taking the most starred template and having features we don't need. From experience, it's better to keep it simple and general enough for our specific use cases. +There are several very good templates on GitHub, I prefer to use code we wrote instead of blinding taking the most starred template and having features we don't need. From experience, it's better to keep it simple and general enough for our specific use cases. diff --git a/pyproject.toml b/pyproject.toml index 9cc7d73..ea52a93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,9 +23,7 @@ dependencies = [] [dependency-groups] dev = [ - "flake8", - "black==22.3.0", - "isort", + "pre-commit", "twine", "pytest", "wheel", diff --git a/test/test_hello.py b/test/test_hello.py index 58b4c15..24593a5 100644 --- a/test/test_hello.py +++ b/test/test_hello.py @@ -3,4 +3,4 @@ def test_hello(): res = hello() - assert res == "World" \ No newline at end of file + assert res == "World" From fa512ff995f8c8aafc4f16c1b3f0c8d3414cf105 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 14:38:03 +0100 Subject: [PATCH 03/18] Switch to `ruff` for linting and formatting --- .pre-commit-config.yaml | 18 +++++------------- README.md | 4 ++-- pyproject.toml | 11 ++++++++--- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b578f40..2c37a9f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,17 +7,9 @@ repos: - id: check-yaml - id: check-toml - id: check-added-large-files - - repo: https://github.com/psf/black - rev: 22.3.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.9.1 hooks: - - id: black - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - args: ["--profile", "black"] - - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - args: ["--max-line-length=88", "--extend-ignore=E203,E501,W503", "--ignore=D"] + - id: ruff + args: [ --fix ] + - id: ruff-format diff --git a/README.md b/README.md index 8afb6da..ee345a9 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ The project has the following structure We provide two handy commands inside the `Makefile`, which both use `pre-commit` internally: -- `make style` to format the code and run checks -- `make check_code_quality` to check code quality (PEP8 basically) +- `make style` to format the code and run checks (using ruff) +- `make check_code_quality` to check code quality (using ruff) We also use `pre-commit` to ensure code quality before each commit. You can install it using: diff --git a/pyproject.toml b/pyproject.toml index ea52a93..a1cf4a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,8 +38,13 @@ package-dir = {"" = "src"} [tool.setuptools.packages.find] where = ["src"] -[tool.black] +[tool.ruff] line-length = 120 +target-version = "py39" -[tool.isort] -profile = "black" +[tool.ruff.lint] +select = ["E", "F", "I", "W"] +#ignore = ["D"] + +[tool.ruff.lint.isort] +known-first-party = ["sandbox"] From 5ef4127dc6a06a6f92f53439fa738a56a9b5d647 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 14:42:20 +0100 Subject: [PATCH 04/18] Remove Makefile and update README to reflect changes... --- Makefile | 16 ---------------- README.md | 41 ++++++++++++++++++----------------------- 2 files changed, 18 insertions(+), 39 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 9ee1409..0000000 --- a/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -.PHONY: style check_code_quality - -export PYTHONPATH = src -check_dirs := src/sandbox - -style: - pre-commit run --all-files - -check_code_quality: - pre-commit run --all-files - -publish: - python3 -m build - twine upload -r testpypi dist/* -u ${PYPI_USERNAME} -p ${PYPI_TEST_PASSWORD} --verbose - twine check dist/* - twine upload dist/* -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} --verbose diff --git a/README.md b/README.md index ee345a9..0b609bd 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ The project has the following structure โ”‚ โ””โ”€โ”€ workflows โ”‚ โ””โ”€โ”€ test.yml # holds our github action config โ”œโ”€โ”€ .gitignore -โ”œโ”€โ”€ Makefile โ”œโ”€โ”€ README.md โ”œโ”€โ”€ pyproject.toml โ”œโ”€โ”€ src @@ -37,18 +36,13 @@ The project has the following structure ### Code Quality ๐Ÿงน -We provide two handy commands inside the `Makefile`, which both use `pre-commit` internally: - -- `make style` to format the code and run checks (using ruff) -- `make check_code_quality` to check code quality (using ruff) - -We also use `pre-commit` to ensure code quality before each commit. You can install it using: +We use `pre-commit` to ensure code quality. You can install it using: ```bash pre-commit install ``` -This will run the same checks as `make check_code_quality` on every commit. You can also run it manually on all files: +You can run the checks manually on all files: ```bash pre-commit run --all-files @@ -58,31 +52,32 @@ So far, **there is no types checking with mypy**. See [issue](https://github.com ### Tests ๐Ÿงช -[`pytests`](https://docs.pytest.org/en/7.1.x/) is used to run our tests. +[`pytest`](https://docs.pytest.org/en/7.1.x/) is used to run our tests. + +```bash +export PYTHONPATH=src +pytest +``` ### Publish on PyPi ๐Ÿš€ **Important**: Before publishing, edit `__version__` in [src/sandbox/__init__.py](/src/sandbox/__init__.py) to match the wanted new version. -We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier. You can publish by using +We use [`twine`](https://twine.readthedocs.io/en/stable/) to upload our package. -``` -export PYPI_USERNAME="you_username" -export PYPI_PASSWORD="your_password" -export PYPI_TEST_PASSWORD="your_password_for_test_pypi" -make publish -e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD -e PYPI_TEST_PASSWORD=$PYPI_TEST_PASSWORD -``` +```bash +# Build the package +python3 -m build -You can also use token for auth, see [pypi doc](https://pypi.org/help/#apitoken). In that case, +# Upload to TestPyPI (to verify everything is correct) +# Note: For TestPyPI you need to use your TestPyPI credentials +twine upload -r testpypi dist/* --verbose -``` -export PYPI_USERNAME="__token__" -export PYPI_PASSWORD="your_token" -export PYPI_TEST_PASSWORD="your_token_for_test_pypi" -make publish -e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD -e PYPI_TEST_PASSWORD=$PYPI_TEST_PASSWORD +# Upload to PyPI +twine upload dist/* --verbose ``` -**Note**: We will try to push to [test pypi](https://test.pypi.org/) before pushing to pypi, to assert everything will work +**Note**: For authentication, we recommend using [API tokens](https://pypi.org/help/#apitoken). Set `TWINE_USERNAME` to `__token__` and `TWINE_PASSWORD` to your token value. ### CI/CD ๐Ÿค– From 74901f5506c6512f6f6128f730b5ed8b616ae2e3 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 14:47:12 +0100 Subject: [PATCH 05/18] Update project metadata to reflect Roboflow ownership --- README.md | 2 +- pyproject.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0b609bd..c3f1bb6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Python Template ๐Ÿ -A template repo holding our common setup for a python project. +A template repo holding Roboflow's common setup for a python project. ## Installation diff --git a/pyproject.toml b/pyproject.toml index a1cf4a2..aa1298f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,9 +6,9 @@ build-backend = "setuptools.build_meta" name = "sandbox-template" dynamic = ["version"] authors = [ - { name="zuppif", email="francesco.zuppichini@gmail.com" }, + { name="Roboflow", email="develop@roboflow.com" }, ] -description = "" +description = "Roboflow Python Sandbox Template" readme = "README.md" requires-python = ">=3.9" license = "MIT" @@ -19,7 +19,7 @@ classifiers = [ dependencies = [] [project.urls] -"Homepage" = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" +"Homepage" = "https://roboflow.com" [dependency-groups] dev = [ From a666a155083304bdefabc7e08d3dbe65526a6cb8 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 15:25:06 +0100 Subject: [PATCH 06/18] Enhance linting rules, update docstrings, and upgrade pre-commit dependencies --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 13 +++++++++++-- src/sandbox/__init__.py | 2 ++ src/sandbox/hello.py | 4 ++++ test/test_hello.py | 3 +++ 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2c37a9f..09c9246 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -8,7 +8,7 @@ repos: - id: check-toml - id: check-added-large-files - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.1 + rev: v0.14.10 hooks: - id: ruff args: [ --fix ] diff --git a/pyproject.toml b/pyproject.toml index aa1298f..f02b027 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,8 +43,17 @@ line-length = 120 target-version = "py39" [tool.ruff.lint] -select = ["E", "F", "I", "W"] -#ignore = ["D"] +select = [ + "E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#pycodestyle-e-w + "F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f + "I", # isort - https://docs.astral.sh/ruff/rules/#isort-i + "W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#pycodestyle-e-w + "UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up + "B", # flake8-bugbear - https://docs.astral.sh/ruff/rules/#flake8-bugbear-b + "SIM", # flake8-simplify - https://docs.astral.sh/ruff/rules/#flake8-simplify-sim + "N", # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n + "D", # pydocstyle - https://docs.astral.sh/ruff/rules/#pydocstyle-d +] [tool.ruff.lint.isort] known-first-party = ["sandbox"] diff --git a/src/sandbox/__init__.py b/src/sandbox/__init__.py index b44315b..929ae6a 100644 --- a/src/sandbox/__init__.py +++ b/src/sandbox/__init__.py @@ -1 +1,3 @@ +"""Sandbox package.""" + __version__ = "0.0.0.dev0" diff --git a/src/sandbox/hello.py b/src/sandbox/hello.py index 3676faf..3614038 100644 --- a/src/sandbox/hello.py +++ b/src/sandbox/hello.py @@ -1,2 +1,6 @@ +"""Module containing a hello world function.""" + + def hello() -> str: + """Return the string "World".""" return "World" diff --git a/test/test_hello.py b/test/test_hello.py index 24593a5..39aab3d 100644 --- a/test/test_hello.py +++ b/test/test_hello.py @@ -1,6 +1,9 @@ +"""Test the hello module.""" + from sandbox.hello import hello def test_hello(): + """Test the hello function.""" res = hello() assert res == "World" From 4ccb28f3bb74d1b91da52dfec8f16d1b11fe4161 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 15:28:29 +0100 Subject: [PATCH 07/18] Add `mdformat` pre-commit hook and minor README formatting adjustments --- .pre-commit-config.yaml | 4 ++++ README.md | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 09c9246..393fc4a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,3 +13,7 @@ repos: - id: ruff args: [ --fix ] - id: ruff-format + - repo: https://github.com/hukkin/mdformat + rev: 1.0.0 + hooks: + - id: mdformat diff --git a/README.md b/README.md index c3f1bb6..d976a21 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Python Template ๐Ÿ + A template repo holding Roboflow's common setup for a python project. ## Installation @@ -88,6 +89,7 @@ On any pull request, we will check the code quality and tests. When a new release is created, we will try to push the new code to PyPi. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier. The **correct steps** to create a new realease are the following: + - edit `__version__` in [src/sandbox/__init__.py](/src/sandbox/__init__.py) to match the wanted new version. - create a new [`tag`](https://git-scm.com/docs/git-tag) with the release name, e.g. `git tag v0.0.1 && git push origin v0.0.1` or from the GitHub UI. - create a new release from GitHub UI @@ -97,6 +99,7 @@ The CI will run when you create the new release. # Q&A ## Why no cookiecutter? + This is a template repo, it's meant to be used inside GitHub upon repo creation. ## Why reinvent the wheel? From fccb8bf407bd6d6a4f6dc2a0f481274df901a4f5 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 15:41:07 +0100 Subject: [PATCH 08/18] Add `validate-pyproject` and `pyproject-fmt` pre-commit hooks, update `pyproject.toml` formatting and metadata --- .pre-commit-config.yaml | 8 +++++ pyproject.toml | 72 +++++++++++++++++++++-------------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 393fc4a..659c144 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,11 @@ repos: rev: 1.0.0 hooks: - id: mdformat + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.23 + hooks: + - id: validate-pyproject + - repo: https://github.com/tox-dev/pyproject-fmt + rev: v2.9.0 + hooks: + - id: pyproject-fmt diff --git a/pyproject.toml b/pyproject.toml index f02b027..b5d4984 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,59 +1,61 @@ [build-system] -requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" +requires = [ "setuptools>=61" ] [project] name = "sandbox-template" -dynamic = ["version"] -authors = [ - { name="Roboflow", email="develop@roboflow.com" }, -] description = "Roboflow Python Sandbox Template" readme = "README.md" -requires-python = ">=3.9" license = "MIT" +authors = [ + { name = "Roboflow", email = "develop@roboflow.com" }, +] +requires-python = ">=3.9" classifiers = [ - "Programming Language :: Python :: 3", - "Operating System :: OS Independent", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] -dependencies = [] +dynamic = [ "version" ] +dependencies = [ ] -[project.urls] -"Homepage" = "https://roboflow.com" +urls."Homepage" = "https://roboflow.com" [dependency-groups] dev = [ - "pre-commit", - "twine", - "pytest", - "wheel", + "pre-commit", + "pytest", + "twine", + "wheel", ] -[tool.setuptools.dynamic] -version = {attr = "sandbox.__version__"} - [tool.setuptools] -package-dir = {"" = "src"} +package-dir = { "" = "src" } + +[tool.setuptools.dynamic] +version = { attr = "sandbox.__version__" } [tool.setuptools.packages.find] -where = ["src"] +where = [ "src" ] [tool.ruff] -line-length = 120 target-version = "py39" -[tool.ruff.lint] -select = [ - "E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#pycodestyle-e-w - "F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f - "I", # isort - https://docs.astral.sh/ruff/rules/#isort-i - "W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#pycodestyle-e-w - "UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up - "B", # flake8-bugbear - https://docs.astral.sh/ruff/rules/#flake8-bugbear-b - "SIM", # flake8-simplify - https://docs.astral.sh/ruff/rules/#flake8-simplify-sim - "N", # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n - "D", # pydocstyle - https://docs.astral.sh/ruff/rules/#pydocstyle-d +line-length = 120 +lint.select = [ + "B", # flake8-bugbear - https://docs.astral.sh/ruff/rules/#flake8-bugbear-b + "D", # pydocstyle - https://docs.astral.sh/ruff/rules/#pydocstyle-d + "E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#pycodestyle-e-w + "F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f + "I", # isort - https://docs.astral.sh/ruff/rules/#isort-i + "N", # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n + "SIM", # flake8-simplify - https://docs.astral.sh/ruff/rules/#flake8-simplify-sim + "UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up + "W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#pycodestyle-e-w ] - -[tool.ruff.lint.isort] -known-first-party = ["sandbox"] +lint.isort.known-first-party = [ "sandbox" ] From a4b19706eb87a9769565b24182d1aab6a8562bd2 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 15:49:44 +0100 Subject: [PATCH 09/18] Add `codespell` pre-commit hook and fix typo in README --- .pre-commit-config.yaml | 4 ++++ README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 659c144..92b4777 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,3 +25,7 @@ repos: rev: v2.9.0 hooks: - id: pyproject-fmt + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell diff --git a/README.md b/README.md index d976a21..d7c8e9c 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ On any pull request, we will check the code quality and tests. When a new release is created, we will try to push the new code to PyPi. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier. -The **correct steps** to create a new realease are the following: +The **correct steps** to create a new release are the following: - edit `__version__` in [src/sandbox/__init__.py](/src/sandbox/__init__.py) to match the wanted new version. - create a new [`tag`](https://git-scm.com/docs/git-tag) with the release name, e.g. `git tag v0.0.1 && git push origin v0.0.1` or from the GitHub UI. From 1748b872953490fece187b9106648226955cad76 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 16:08:27 +0100 Subject: [PATCH 10/18] Remove `welcome.yml` GitHub Actions workflow for first interactions --- .github/workflows/welcome.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/workflows/welcome.yml diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml deleted file mode 100644 index facf9b0..0000000 --- a/.github/workflows/welcome.yml +++ /dev/null @@ -1,16 +0,0 @@ -on: - issues: - types: [opened] - pull_request_target: - types: [opened] - -jobs: - build: - name: ๐Ÿ‘‹ Welcome - runs-on: ubuntu-latest - steps: - - uses: actions/first-interaction@v1.1.1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "Hello there, thank you for opening an Issue ! ๐Ÿ™๐Ÿป The team was notified and they will get back to you asap." - pr-message: "Hello there, thank you for opening an PR ! ๐Ÿ™๐Ÿป The team was notified and they will get back to you asap." From 092f7b485573a68fec853c0dce2d191f9b3a481b Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 16:14:00 +0100 Subject: [PATCH 11/18] Add `.github/CODEOWNERS` file to define code ownership --- .github/CODEOWNERS | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..0bfa3ba --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,13 @@ +# CODEOWNERS +# +# This file specifies which people or teams own code in this repository. +# Directives are specified using one of the following forms: +# +# * @org/team-name # entire repo +# /path/to/file @user-name # specific file +# /docs/** @team-name # all files in docs folder +# *.js @js-owner # all JS files +# +# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners +# +# Order is important; the last matching pattern takes precedence. \ No newline at end of file From 853c64c1474082024657ac7a6d8512b7695a0c0b Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 16:19:58 +0100 Subject: [PATCH 12/18] Add `.github/dependabot.yml` for automated dependency updates --- .github/dependabot.yml | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0611105 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,46 @@ +# Dependabot configuration file +# Enables automated dependency updates for pip (individual PRs) and GitHub Actions (grouped PR). +# Full documentation: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 + +updates: + # Pip dependencies from pyproject.toml ([project].dependencies and [dependency-groups]) + - package-ecosystem: pip + directory: "/" + target-branch: "main" + schedule: + interval: "weekly" + # day: "monday" # Optional: Restrict to specific weekday + open-pull-requests-limit: 5 # Limit number of open PRs + rebase-strategy: "auto" # Options: auto, safe, noop + labels: + - "dependencies" + versioning-strategy: "increase" # lockfile-only, increase, increase-if-necessary + # Useful: Ignore outdated/unwanted packages + # ignore: + # - dependency-name: "legacy-package" + # Useful: Periodically update lockfile even without dep changes (requires lockfile) + # lockfile-maintenance: + # enabled: true + + # GitHub Actions in .github/workflows/*.yml + - package-ecosystem: "github-actions" + directory: "/" # Root; scans .github/**/workflow yml files + target-branch: "main" + schedule: + interval: "monthly" + # day: "monday" + open-pull-requests-limit: 5 + rebase-strategy: "auto" + labels: + - "CI" + groups: + gha-updates: + patterns: + - "*" # Groups ALL GitHub Actions updates into single PR + +# Additional notes: +# - Pip updates: Individual PRs per package (no group). +# - Reviews: Uses .github/CODEOWNERS automatically. +# - Automerge: Enable via branch protection rules or 'automerge: true' (experimental). \ No newline at end of file From f8aba6af1196e751c6db2bc46272dd4d032fc22c Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 16:29:44 +0100 Subject: [PATCH 13/18] Update `publish.yml` workflow: refine steps, use updated actions, and improve dependency management --- .github/workflows/publish.yml | 39 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9ca6e19..0f66c57 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,31 +2,30 @@ name: Publish WorkFlow on: release: - types: [created] + types: [published] jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8] steps: - name: ๐Ÿ›Ž๏ธ Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - name: ๐Ÿ Set up Python + uses: actions/setup-python@v5 with: - ref: ${{ github.head_ref }} - - name: ๐Ÿ Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: ๐Ÿฆพ Install dependencies - run: | - python -m pip install --upgrade pip - pip install ".[dev]" - - name: ๐Ÿš€ Publish to PyPi - env: - PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} - PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - PYPI_TEST_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }} + python-version: "3.10" + cache: "pip" + - name: ๐Ÿฆพ Install build dependencies run: | - make publish -e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD -e PYPI_TEST_PASSWORD=$PYPI_TEST_PASSWORD + python -m pip install --upgrade pip build + - name: ๐Ÿ“ฆ Build package + run: python -m build + - name: Upload to release + uses: AButler/upload-release-assets@v3.0 + with: + files: "dist/*" + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: ๐Ÿš€ Publish to PyPI + uses: pypa/gh-action-pypi-publish@v1.1.0 + with: + password: ${{ secrets.PYPI_PASSWORD }} From 1376c7723ad5238ecf15cc7d15e97fec40ad73bf Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 16:57:53 +0100 Subject: [PATCH 14/18] Update `test.yml` workflow: expand Python version matrix, upgrade actions, and integrate `uv` --- .github/workflows/test.yml | 19 +++++++------------ README.md | 3 +-- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d58f87..fbb1056 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,22 +9,17 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: ๐Ÿ›Ž๏ธ Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.head_ref }} + uses: actions/checkout@v4 - name: ๐Ÿ Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: ๐Ÿ”ง Set up uv + uses: astral-sh/setup-uv@v5 - name: ๐Ÿฆพ Install dependencies - run: | - python -m pip install --upgrade pip - pip install ".[dev]" - - name: ๐Ÿงน Lint with flake8 - run: | - make check_code_quality + run: uv sync --dev - name: ๐Ÿงช Test - run: "python -m pytest ./test" + run: uv run pytest test/ diff --git a/README.md b/README.md index d7c8e9c..f35fefb 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,7 @@ So far, **there is no types checking with mypy**. See [issue](https://github.com [`pytest`](https://docs.pytest.org/en/7.1.x/) is used to run our tests. ```bash -export PYTHONPATH=src -pytest +pytest . -v ``` ### Publish on PyPi ๐Ÿš€ From d87c1844246b4094d146e1769ee482b688f040d6 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 16:58:47 +0100 Subject: [PATCH 15/18] Update `.gitignore` to include JetBrains IDE files --- .github/CODEOWNERS | 2 +- .github/dependabot.yml | 2 +- .gitignore | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0bfa3ba..f5036b7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,4 +10,4 @@ # # See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners # -# Order is important; the last matching pattern takes precedence. \ No newline at end of file +# Order is important; the last matching pattern takes precedence. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0611105..e51e585 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -43,4 +43,4 @@ updates: # Additional notes: # - Pip updates: Individual PRs per package (no group). # - Reviews: Uses .github/CODEOWNERS automatically. -# - Automerge: Enable via branch protection rules or 'automerge: true' (experimental). \ No newline at end of file +# - Automerge: Enable via branch protection rules or 'automerge: true' (experimental). diff --git a/.gitignore b/.gitignore index b6e4761..23a9e4f 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ dmypy.json # Pyre type checker .pyre/ + +# JetBrain IDE +.idea/ From d89734778827a5024cb4b86bd197c1bde721035d Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 17:22:33 +0100 Subject: [PATCH 16/18] Update formatting rules, expand pre-commit hooks, and refine test workflow --- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 4 ++++ pyproject.toml | 8 ++++++++ src/sandbox/hello.py | 6 +++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fbb1056..2b92709 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,4 +22,4 @@ jobs: - name: ๐Ÿฆพ Install dependencies run: uv sync --dev - name: ๐Ÿงช Test - run: uv run pytest test/ + run: uv run pytest test/ src/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92b4777..4475b25 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,10 @@ repos: - id: check-yaml - id: check-toml - id: check-added-large-files + - id: check-ast + - id: check-docstring-first + - id: detect-private-key + - id: check-symlinks - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.14.10 hooks: diff --git a/pyproject.toml b/pyproject.toml index b5d4984..d22c330 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,8 @@ where = [ "src" ] target-version = "py39" line-length = 120 +format.indent-style = "space" +format.quote-style = "double" lint.select = [ "B", # flake8-bugbear - https://docs.astral.sh/ruff/rules/#flake8-bugbear-b "D", # pydocstyle - https://docs.astral.sh/ruff/rules/#pydocstyle-d @@ -59,3 +61,9 @@ lint.select = [ "W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#pycodestyle-e-w ] lint.isort.known-first-party = [ "sandbox" ] + +[tool.pytest.ini_options] +addopts = [ + "--color=yes", + "--doctest-modules", +] diff --git a/src/sandbox/hello.py b/src/sandbox/hello.py index 3614038..807b8f4 100644 --- a/src/sandbox/hello.py +++ b/src/sandbox/hello.py @@ -2,5 +2,9 @@ def hello() -> str: - """Return the string "World".""" + """Return the string "World". + + >>> hello() + 'World' + """ return "World" From 7fed9ab2f4e6be114857004ad79fbf45205eb716 Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 18:01:38 +0100 Subject: [PATCH 17/18] Expand `.pre-commit-config.yaml` with additional hooks, comments, and pre-commit.ci configuration --- .pre-commit-config.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4475b25..cd63a7d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,22 @@ +# .pre-commit-config.yaml +# +# Pre-commit configuration for: +# - Local git hooks: `pre-commit install` & `pre-commit run --all-files` +# - pre-commit.ci bot: PR checks, auto hook updates, etc. +# +# Docs: https://pre-commit.ci/ +# +ci: + autoupdate_schedule: monthly # Monthly bot PRs to update hook revs + submodules: true # Include git submodules in checks + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + for more information, see https://pre-commit.ci # Custom commit message for bot autofixes + skip: [~draft, ~WIP] # Skip bot on PRs with these labels (regex prefix match) + repos: - repo: https://github.com/pre-commit/pre-commit-hooks + # Basic file checks/fixes: whitespace, EOF, YAML/TOML validation, large files, security, symlinks rev: v6.0.0 hooks: - id: trailing-whitespace @@ -12,24 +29,29 @@ repos: - id: detect-private-key - id: check-symlinks - repo: https://github.com/astral-sh/ruff-pre-commit + # Python linter (ruff --fix) & formatter (ruff-format) rev: v0.14.10 hooks: - id: ruff args: [ --fix ] - id: ruff-format - repo: https://github.com/hukkin/mdformat + # Markdown formatter (mdformat) rev: 1.0.0 hooks: - id: mdformat - repo: https://github.com/abravalheri/validate-pyproject + # Validate pyproject.toml schema/content rev: v0.23 hooks: - id: validate-pyproject - repo: https://github.com/tox-dev/pyproject-fmt + # Format pyproject.toml rev: v2.9.0 hooks: - id: pyproject-fmt - repo: https://github.com/codespell-project/codespell + # Spell checker for code, comments, docs rev: v2.4.1 hooks: - id: codespell From 04925ad1dea7e5fee769c017c35f920a4be7c1ec Mon Sep 17 00:00:00 2001 From: jirka Date: Thu, 8 Jan 2026 18:09:48 +0100 Subject: [PATCH 18/18] Add GitHub templates for PRs, bug reports, and feature requests --- .github/ISSUE_TEMPLATE/bug_report.yml | 28 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 20 ++++++++++++++++ .github/pull_request_template.md | 13 ++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..8580266 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,28 @@ +name: "Bug Report" +description: Report a bug +title: "[Bug]: " +labels: ["bug", "triage"] +body: + - type: textarea + id: bug + attributes: + label: Bug description + description: Expected vs. actual behavior. + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to reproduce + description: Minimal steps. + placeholder: | + 1. ... + 2. ... + See error. + validations: + required: true + - type: textarea + id: environment + attributes: + label: Environment (optional) + description: OS, Python, toolchain. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..0e4dcee --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,20 @@ +name: "Feature Request" +description: Suggest a feature +title: "[Feature]: " +labels: ["feature", "triage"] +body: + - type: textarea + id: problem + attributes: + label: Problem + description: What problem does it solve? + placeholder: I'm frustrated when... + validations: + required: true + - type: textarea + id: solution + attributes: + label: Solution + description: Describe the feature. + validations: + required: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..53e2625 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,13 @@ +# PR Checklist + +- [ ] Tests pass +- [ ] Docs if needed +- [ ] pre-commit passes + +## Changes + +Brief description. + +## Related + +Closes #