diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 932fa6b..65b7825 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,6 +14,9 @@ on: permissions: contents: read +env: + FORCE_COLOR: 1 + jobs: # Always build & lint package. build-package: @@ -24,6 +27,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + persist-credentials: false - uses: hynek/build-and-inspect-python-package@v2 diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 859c948..75a47d2 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -1,8 +1,5 @@ name: Sync labels -permissions: - pull-requests: write - on: push: branches: @@ -13,9 +10,13 @@ on: jobs: sync: + permissions: + pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: micnncim/action-label-syncer@v1 with: prune: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3893025..bd89106 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,33 +4,34 @@ on: [push, pull_request, workflow_dispatch] env: FORCE_COLOR: 1 - PIP_DISABLE_PIP_VERSION_CHECK: 1 permissions: contents: read jobs: - pre-commit: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-python@v5 with: python-version: "3.x" - cache: pip - - uses: pre-commit/action@v3.0.1 + - uses: tox-dev/action-pre-commit-uv@v1 mypy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - 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 1c0e668..a2548a7 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: @@ -20,6 +19,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 @@ -30,18 +31,14 @@ jobs: - name: Install uv uses: hynek/setup-cached-uv@v2 - - name: Install dependencies - run: | - uv pip install --system -U tox-uv - - name: Tox tests run: | - tox -e py + uvx --with tox-uv tox -e py - name: Cog if: matrix.python-version == '3.11' && 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 diff --git a/pyproject.toml b/pyproject.toml index bf45872..b38b2f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,9 +62,9 @@ fix = true lint.select = [ "C4", # flake8-comprehensions - "E", # pycodestyle errors + "E", # pycodestyle "EM", # flake8-errmsg - "F", # pyflakes errors + "F", # pyflakes "I", # isort "ICN", # flake8-import-conventions "ISC", # flake8-implicit-str-concat @@ -74,14 +74,15 @@ lint.select = [ "RUF022", # unsorted-dunder-all "RUF100", # unused noqa (yesqa) "UP", # pyupgrade - "W", # pycodestyle warnings + "W", # pycodestyle "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" ] diff --git a/tox.ini b/tox.ini index 40024a0..073d4ea 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,13 @@ env_list = extras = tests commands = - {envpython} -m pytest --cov linkotron --cov tests --cov-report html --cov-report term --cov-report xml {posargs} + {envpython} -m pytest \ + --cov linkotron \ + --cov tests \ + --cov-report html \ + --cov-report term \ + --cov-report xml \ + {posargs} linky --version linky --help @@ -32,7 +38,7 @@ commands = [testenv:mypy] deps = httpx - mypy==1.10.1 + mypy==1.12 platformdirs pyperclip pytest