From 13642da665a5a3767563188310d78657f93606c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Wed, 30 Oct 2024 08:42:46 -0700 Subject: [PATCH] Use dependency groups (#118) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- pyproject.toml | 29 ++++++++++++++++++++--------- tox.ini | 12 ++++-------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be80f9c..20bd8b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: - id: tox-ini-fmt args: ["-p", "fix"] - repo: https://github.com/tox-dev/pyproject-fmt - rev: "v2.4.3" + rev: "v2.5.0" hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit diff --git a/pyproject.toml b/pyproject.toml index 36aaef5..e76d832 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,11 +41,25 @@ dynamic = [ ] dependencies = [ "packaging>=24.1", - "tox<5,>=4.21.2", + "tox>=4.21.2,<5", "typing-extensions>=4.12.2; python_version<'3.10'", - "uv<1,>=0.4.18", + "uv>=0.4.18,<1", ] -optional-dependencies.testing = [ +urls.Changelog = "https://github.com/tox-dev/tox-uv/releases" +urls.Documentation = "https://github.com/tox-dev/tox-uv#tox-uv" +urls.Homepage = "https://github.com/tox-dev/tox-uv" +urls.Source = "https://github.com/tox-dev/tox-uv" +urls.Tracker = "https://github.com/tox-dev/tox-uv/issues" +entry-points.tox.tox-uv = "tox_uv.plugin" + +[dependency-groups] +dev = [ + { include-group = "lint" }, + { include-group = "pkg-meta" }, + { include-group = "test" }, + { include-group = "type" }, +] +test = [ "covdefaults>=2.3", "devpi-process>=1.0.2", "diff-cover>=9.2", @@ -53,12 +67,9 @@ optional-dependencies.testing = [ "pytest-cov>=5", "pytest-mock>=3.14", ] -urls.Changelog = "https://github.com/tox-dev/tox-uv/releases" -urls.Documentation = "https://github.com/tox-dev/tox-uv#tox-uv" -urls.Homepage = "https://github.com/tox-dev/tox-uv" -urls.Source = "https://github.com/tox-dev/tox-uv" -urls.Tracker = "https://github.com/tox-dev/tox-uv/issues" -entry-points.tox.tox-uv = "tox_uv.plugin" +type = [ "mypy==1.11.2", { include-group = "test" } ] +lint = [ "pre-commit-uv>=4.1.3" ] +pkg-meta = [ "check-wheel-contents>=0.6", "twine>=5.1.1", "uv>=0.4.18" ] [tool.hatch] build.hooks.vcs.version-file = "src/tox_uv/version.py" diff --git a/tox.ini b/tox.ini index e9b1344..42884ba 100644 --- a/tox.ini +++ b/tox.ini @@ -17,8 +17,6 @@ skip_missing_interpreters = true description = run the unit tests with pytest under {base_python} package = wheel wheel_build_env = .pkg -extras = - testing pass_env = DIFF_AGAINST PYTEST_* @@ -32,6 +30,7 @@ commands = --junitxml {work_dir}{/}junit.{env_name}.xml \ tests} diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {work_dir}{/}coverage.{env_name}.xml --fail-under 100 +dependency_groups = test [testenv:fix] description = format the code base to adhere to our styles, and complain about what we cannot do automatically @@ -43,23 +42,19 @@ commands = [testenv:type] description = run type check on code base -deps = - mypy==1.11.2 commands = mypy src mypy tests +dependency_groups = type [testenv:pkg_meta] description = check that the long description is valid skip_install = true -deps = - check-wheel-contents>=0.6 - twine>=5.1.1 - uv>=0.4.18 commands = uv build --sdist --wheel --out-dir {env_tmp_dir} . twine check {env_tmp_dir}{/}* check-wheel-contents --no-config {env_tmp_dir} +dependency_groups = pkg-meta [testenv:dev] description = generate a DEV environment @@ -67,3 +62,4 @@ package = editable commands = uv pip tree python -c 'import sys; print(sys.executable)' +dependency_groups = dev