pre-commit / action

a GitHub action to run `pre-commit`
MIT License
463 stars 145 forks source link

Positional-only parameters are only supported in Python 3.8 and greater #168

Closed crusaderky closed 2 years ago

crusaderky commented 2 years ago

The pre-commit action on https://github.com/dask/distributed has started failing with the message

/home/runner/.cache/pre-commit/repoz_illd_m/py_env-python3.10/lib/python3.10/site-packages/numpy/__init__.pyi:642: error: Positional-only parameters are only supported in Python 3.8 and greater  [syntax]
Found 1 error in 1 file (errors prevented further checking)

mypy is supposedly running on Python 3.10, checking for compatibility vs. Python 3.9.

I cannot replicate the issue locally by running pre-commit run --all-files. I've already tried wiping out my local ~/.cache/pre-commit. I've already tried changing something trivial (e.g. an already-satisfied minimum version) in .pre-commit-config.yaml in order to invalidate the github actions cache.

.github/workflows/ci-pre-commit.yaml:

name: Linting

on:
  push:
    branches: main
  pull_request:
    branches: main

jobs:
  checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.10'
      - uses: pre-commit/action@v3.0.0

.pre-commit-config.yaml:

repos:
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.971
    hooks:
      - id: mypy
        # Override default --ignore-missing-imports
        # Use setup.cfg if possible instead of adding command line parameters here
        args: [--warn-unused-configs]
        additional_dependencies:
          # Type stubs
          - pandas-stubs
          - types-docutils
          - types-requests
          - types-paramiko
          - types-PyYAML
          - types-psutil
          - types-setuptools
          # Typed libraries
          - click
          - dask
          - numpy
          - pytest
          - tornado
          - zict
          - pyarrow

setup.cfg:

[mypy]
python_version = 3.9
platform = linux
allow_incomplete_defs = false
allow_untyped_decorators = false
ignore_missing_imports = true
no_implicit_optional = true
show_error_codes = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_unreachable = true
asottile commented 2 years ago

this is neither a pre-commit/action (just runs pre-commit) or a pre-commit (just runs your configured hooks) problem

crusaderky commented 2 years ago

...could you articulate please?

How is this not a pre-commit/action issue?

asottile commented 2 years ago

there's no special code here -- it literally just installs pre-commit and runs it

so it cannot be the fault of pre-commit/action

we're also not a debugging service -- if your company wants to sponsor I can help you figure out your problem but otherwise I cannot invest my free time in your specific problem which isn't a framework issue