From 6f41a6cf9d378b4a7da0ae96ccda7e26ff14c1df Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Thu, 12 Sep 2024 13:58:01 +0300 Subject: [PATCH] ci(tox): add tox config --- .gitignore | 1 + pyproject.toml | 12 +++++++++--- requirements-dev.lock | 15 +++++++++++++++ tox.ini | 28 ++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index ae8554d..be7f1fd 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ build/ dist/ wheels/ *.egg-info +.tox/ # venv .venv diff --git a/pyproject.toml b/pyproject.toml index ed4d540..72a4c95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.1.0" description = "Bunyan Formatter for Python" dependencies = [] readme = "README.md" -requires-python = ">= 3.8" +requires-python = ">=3.12" authors = [{ name = "Kristofers Solo", email = "dev@kristofers.xyz" }] [build-system] @@ -13,7 +13,13 @@ build-backend = "hatchling.build" [tool.rye] managed = true -dev-dependencies = ["mypy~=1.11", "ruff~=0.6", "pre-commit~=3.8", "pytest~=8.3"] +dev-dependencies = [ + "mypy~=1.11", + "ruff~=0.6", + "pre-commit~=3.8", + "pytest~=8.3", + "tox~=4.18", +] [tool.hatch.metadata] allow-direct-references = true @@ -25,7 +31,7 @@ packages = ["src/bunyan_formatter"] show-fixes = true line-length = 120 indent-width = 4 -target-version = "py38" +target-version = "py312" [tool.ruff.lint] extend-select = [ diff --git a/requirements-dev.lock b/requirements-dev.lock index 140a887..625e937 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -10,11 +10,18 @@ # universal: false -e file:. +cachetools==5.5.0 + # via tox cfgv==3.4.0 # via pre-commit +chardet==5.2.0 + # via tox +colorama==0.4.6 + # via tox distlib==0.3.8 # via virtualenv filelock==3.16.0 + # via tox # via virtualenv identify==2.6.0 # via pre-commit @@ -26,17 +33,25 @@ mypy-extensions==1.0.0 nodeenv==1.9.1 # via pre-commit packaging==24.1 + # via pyproject-api # via pytest + # via tox platformdirs==4.3.2 + # via tox # via virtualenv pluggy==1.5.0 # via pytest + # via tox pre-commit==3.8.0 +pyproject-api==1.7.1 + # via tox pytest==8.3.3 pyyaml==6.0.2 # via pre-commit ruff==0.6.4 +tox==4.18.1 typing-extensions==4.12.2 # via mypy virtualenv==20.26.4 # via pre-commit + # via tox diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..7989431 --- /dev/null +++ b/tox.ini @@ -0,0 +1,28 @@ +[tox] +envlist = py312, format, lint, type, test +skipsdist = True + +[testenv] +deps = + hatchling + -rrequirements-dev.lock + +[testenv:format] +description = Run ruff to format the code +skip_install = true +deps = ruff +commands = ruff format + +[testenv:lint] +description = Run ruff to lint the code +skip_install = true +deps = ruff +commands = ruff check --fix + +[testenv:type] +description = Run mypy to check type annotations +commands = mypy . + +[testenv:test] +description = Run pytest to execute the tests +commands = pytest