diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 94b1cfb..af246ed 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -36,11 +36,16 @@ jobs: - name: Install Python ${{ matrix.python-version }} run: uv python install ${{ matrix.python-version }} + - name: Install tox + run: uv tool install tox --with tox-uv + - name: Execute tests - run: uv tool run tox -e ${{ matrix.python-version }} + run: tox --runner virtualenv -e ${{ matrix.python-version }} precommit: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - uses: boidolr/actions/run-precommit@main + env: + UV_PYTHON: "3.13" diff --git a/pyproject.toml b/pyproject.toml index 8f04709..e9a499a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,10 +6,10 @@ build-backend = "setuptools.build_meta" name = "pre_commit_text" description = "Some text hooks for pre-commit." authors = [ - { name="Raphael Boidol", email="boidolr@users.noreply.github.com" }, + { name = "Raphael Boidol", email = "boidolr@users.noreply.github.com" }, ] -urls = {"Respository" = "https://github.com/boidolr/pre-commit-text"} -license = {file = "LICENSE"} +urls = { "Respository" = "https://github.com/boidolr/pre-commit-text" } +license = { file = "LICENSE" } readme = "README.md" version = "1.2.17" classifiers = [ @@ -20,23 +20,11 @@ classifiers = [ ] requires-python = ">=3.10,<4" -dependencies = [ - "ruamel.yaml==0.18.6", -] +dependencies = ["ruamel.yaml==0.18.6"] [project.optional-dependencies] -dev = [ - "pre-commit", - "ruff", - "tox", - "tox-uv", -] -tests = [ - "pytest", - "pytest-clarity", - "pytest-ruff", - "pytest-mypy", -] +dev = ["pre-commit", "ruff", "tox", "tox-uv"] +tests = ["pytest", "pytest-clarity", "pytest-ruff", "pytest-mypy"] [project.scripts] format-yaml = "pre_commit_text.format_yaml:main" @@ -52,24 +40,25 @@ fix = true [tool.ruff.lint] select = [ - "F", # Pyflakes - "E", "W", # Pycodestyle - "UP", # pyupgrade - "FURB", # refurb - "S", # flake8-bandit - "C4", # flake8-comprehensions - "G", # flake8-logging-format - "ANN", # flake8-annotations + "F", # Pyflakes + "E", + "W", # Pycodestyle + "UP", # pyupgrade + "FURB", # refurb + "S", # flake8-bandit + "C4", # flake8-comprehensions + "G", # flake8-logging-format + "ANN", # flake8-annotations # "ARG", # flake8-unused-arguments - "SIM", # flake8-simplify - "PT", # flake8-pytest-style - "RET", # flake8-return - "PTH", # flake8-use-pathlib - "TID252", # flake8-tidy-imports (relative-imports) - "PERF", # Perflint - "FLY", # flynt - "I", # isort - "RUF100" # Unneeded noqa + "SIM", # flake8-simplify + "PT", # flake8-pytest-style + "RET", # flake8-return + "PTH", # flake8-use-pathlib + "TID252", # flake8-tidy-imports (relative-imports) + "PERF", # Perflint + "FLY", # flynt + "I", # isort + "RUF100", # Unneeded noqa ] [tool.ruff.lint.per-file-ignores] @@ -92,10 +81,37 @@ ignore_missing_imports = true [tool.pytest.ini_options] addopts = "--mypy --ruff" -filterwarnings = [ - "error", -] +filterwarnings = ["error"] [[tool.mypy.overrides]] module = "tests.*" disallow_untyped_defs = false + +[tool.tox] +requires = ["tox>=4.19"] +envlist = ["py310", "py311", "py312", "py313", "pre-commit"] +isolated_build = true + +[tool.tox.env_run_base] +description = "Run test under {base_python}" +commands = [ + [ + "pytest", + { replace = "posargs", default = [ + "tests", + ], extend = true }, + ], +] +extras = ["tests", "svg", "avif"] +runner = "uv-venv-lock-runner" +uv_sync_flags = ["--python={env_python}", "--no-editable"] + +[tool.tox.env.pre-commit] +description = "run commit hooks on code base" +skip_install = true +deps = ["pre-commit"] +commands = [["pre-commit", "run", "--all-files"]] +runner = "virtualenv" + +[tool.tox.env.static] +commands = [["pytest", "--ignore", "tests"]] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index aba7154..0000000 --- a/tox.ini +++ /dev/null @@ -1,18 +0,0 @@ -[tox] -envlist = py310,py311,py312,py313,pre-commit -isolated_build = True - -[testenv] -extras = tests -commands = - pytest {posargs:tests} - -[testenv:pre-commit] -skip_install = true -deps = pre-commit -commands = pre-commit run --all-files - -[testenv:static] -extras = tests -commands = - pytest --ignore tests