From 855c19b3b666f0975a182a9e8a13a8c038252be8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 16 Oct 2024 22:45:06 +0300 Subject: [PATCH 1/2] Run tox with uv --- .github/workflows/lint.yml | 11 +++-------- .github/workflows/test.yml | 14 +++++--------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9ec1f20..1d7c867 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,12 +26,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.x" - cache: pip - - name: Install dependencies - run: | - python3 -m pip install -U tox + - name: Install uv + uses: hynek/setup-cached-uv@v2 - name: Mypy - run: tox -e mypy + run: uvx --with tox-uv tox -e mypy diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3def17..45e6648 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,6 @@ permissions: env: FORCE_COLOR: 1 - PIP_DISABLE_PIP_VERSION_CHECK: 1 jobs: test: @@ -26,25 +25,22 @@ jobs: with: python-version: ${{ matrix.python-version }} allow-prereleases: true - cache: pip - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U tox + - name: Install uv + uses: hynek/setup-cached-uv@v2 - name: Tox tests run: | - tox -e py + uvx --with tox-uv tox -e py - name: Test CLI run: | - tox -e cli + uvx --with tox-uv tox -e cli - name: Cog if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' run: | - tox -e cog + uvx --with tox-uv tox -e cog - name: Upload coverage uses: codecov/codecov-action@v3.1.5 From 6067ed81a11e748f3d7a737015db375f9bc27c4d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 16 Oct 2024 22:45:27 +0300 Subject: [PATCH 2/2] Update config --- pyproject.toml | 14 ++++++++++---- tox.ini | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7aef549..3222e19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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.flake8-import-conventions.aliases.datetime = "dt" lint.flake8-import-conventions.banned-from = [ "datetime" ] @@ -100,3 +101,8 @@ filterwarnings = [ "ignore:sys.monitoring isn't available, using default core:coverage.exceptions.CoverageWarning", ] testpaths = [ "tests" ] + +[tool.mypy] +pretty = true +strict = true +show_error_codes = true diff --git a/tox.ini b/tox.ini index 3c30758..2ca7b13 100644 --- a/tox.ini +++ b/tox.ini @@ -5,11 +5,14 @@ env_list = cli cog lint + mypy py{py3, 313, 312, 311, 310, 39} [testenv] extras = tests +set_env = + COVERAGE_CORE = sysmon commands = {envpython} -m pytest \ --cov pepotron \ @@ -44,7 +47,7 @@ commands = [testenv:mypy] deps = - mypy==1.11.2 + mypy==1.12 platformdirs pytest python-slugify @@ -52,4 +55,4 @@ deps = types-freezegun urllib3 commands = - mypy --strict --pretty --show-error-codes . {posargs} + mypy . {posargs}