Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint and test with tox-uv #212

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ jobs:
cache: pip
- uses: pre-commit/action@v3.0.1

- name: Install dependencies
run: |
python3 -m pip install -U tox
mypy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install uv
uses: hynek/setup-cached-uv@v2
- name: Mypy
run: tox -e mypy
run: uvx --with tox-uv tox -e mypy
13 changes: 6 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Test

on: [push, pull_request, workflow_dispatch]

permissions:
contents: read

env:
FORCE_COLOR: 1

Expand All @@ -22,7 +25,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip

- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
Expand All @@ -34,19 +36,16 @@ jobs:
run: |
brew install gettext

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U wheel
python -m pip install -U tox
- name: Install uv
uses: hynek/setup-cached-uv@v2

- name: Generate translation binaries
run: |
scripts/generate-translation-binaries.sh

- name: Tox tests
run: |
tox -e py
uvx --with tox-uv tox -e py

- name: Upload coverage
uses: codecov/codecov-action@v3.1.5
Expand Down
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
rev: v0.7.0
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -26,28 +26,28 @@ repos:
exclude: \.github/ISSUE_TEMPLATE\.md|\.github/PULL_REQUEST_TEMPLATE\.md

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.2
rev: 0.29.4
hooks:
- id: check-github-workflows
- id: check-renovate

- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
rev: v1.7.3
hooks:
- id: actionlint

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.2.3
rev: 2.4.3
hooks:
- id: pyproject-fmt

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.19
rev: v0.21
hooks:
- id: validate-pyproject

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.3.2
rev: 1.4.1
hooks:
- id: tox-ini-fmt

Expand Down
12 changes: 5 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ lint.select = [
"YTT", # flake8-2020
]
lint.ignore = [
"E203", # Whitespace before ':'
"E221", # Multiple spaces before operator
"E226", # Missing whitespace around arithmetic operator
"E241", # Multiple spaces after ','
"E203", # Whitespace before ':'
"E221", # Multiple spaces before operator
"E226", # Missing whitespace around arithmetic operator
"E241", # Multiple spaces after ','
"UP038", # Makes code slower and more verbose
]
lint.per-file-ignores."tests/*" = [
"D",
Expand All @@ -94,9 +95,6 @@ lint.isort.known-first-party = [ "humanize" ]
lint.isort.required-imports = [ "from __future__ import annotations" ]
lint.pydocstyle.convention = "google"

[tool.pyproject-fmt]
max_supported_python = "3.13"

[tool.pytest.ini_options]
addopts = "--color=yes"
filterwarnings = [
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ commands =

[testenv:mypy]
deps =
mypy==1.11.2
mypy==1.12
pytest
types-freezegun
types-setuptools
commands =
mypy --strict --pretty --show-error-codes . {posargs}
mypy . {posargs}

[pytest]
addopts = --color=yes --doctest-modules
Loading