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

Pre-commit checks failing in GitHub Actions with Python 3.12(ubuntu:latest) #754

Closed
1 task done
nasudadada opened this issue Jan 11, 2025 · 0 comments · Fixed by #755
Closed
1 task done

Pre-commit checks failing in GitHub Actions with Python 3.12(ubuntu:latest) #754

nasudadada opened this issue Jan 11, 2025 · 0 comments · Fixed by #755

Comments

@nasudadada
Copy link
Contributor

Issue summary

Pre-commit checks failing in GitHub Actions with Python 3.12(ubuntu:latest)

This issue was discovered while working on #752 #753

Expected behavior

  • Pre-commit checks should run successfully in GitHub Actions environment

Actual behavior

Current Error Log from GitHub Actions (link to failed job)
Error Log
/home/runner/.local/bin/pre-commit run --show-diff-on-failure --color=always --all-files
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[WARNING] repo `[https://github.com/pre-commit/pre-commit-hooks`](https://github.com/pre-commit/pre-commit-hooks%60) uses deprecated stage names (commit, push) which will be removed in a future version.  Hint: often `pre-commit autoupdate --repo [https://github.com/pre-commit/pre-commit-hooks`](https://github.com/pre-commit/pre-commit-hooks%60) will fix this.  if it does not -- consider reporting an issue to that repo.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/PyCQA/pylint.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/PyCQA/pylint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/runner/.cache/pre-commit/repo8dfyi049/py_env-python3/bin/python', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing /home/runner/.cache/pre-commit/repo8dfyi049
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'error'
stderr:
      error: subprocess-exited-with-error
      
      × Getting requirements to build wheel did not run successfully.
      │ exit code: 1
      ╰─> [33 lines of output]
          Traceback (most recent call last):
            File "/home/runner/.cache/pre-commit/repo8dfyi049/py_env-python3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
              main()
            File "/home/runner/.cache/pre-commit/repo8dfyi049/py_env-python3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
              json_out['return_val'] = hook(**hook_input['kwargs'])
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/home/runner/.cache/pre-commit/repo8dfyi049/py_env-python3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
              backend = _build_backend()
                        ^^^^^^^^^^^^^^^^
            File "/home/runner/.cache/pre-commit/repo8dfyi049/py_env-python3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
              obj = import_module(mod_path)
                    ^^^^^^^^^^^^^^^^^^^^^^^
            File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
              return _bootstrap._gcd_import(name[level:], package, level)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
            File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
            File "<frozen importlib._bootstrap>", line [131](https://github.com/Shopify/shopify_python_api/actions/runs/12671334535/job/35455806742#step:4:133)0, in _find_and_load_unlocked
            File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
            File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
            File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
            File "<frozen importlib._bootstrap>", line [133](https://github.com/Shopify/shopify_python_api/actions/runs/12671334535/job/35455806742#step:4:135)1, in _find_and_load_unlocked
            File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
            File "<frozen importlib._bootstrap_external>", line 995, in exec_module
            File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
            File "/tmp/pip-build-env-ziat_u1i/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
              import setuptools.version
            File "/tmp/pip-build-env-ziat_u1i/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
              import pkg_resources
            File "/tmp/pip-build-env-ziat_u1i/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2191, in <module>
              register_finder(pkgutil.ImpImporter, find_on_path)
                              ^^^^^^^^^^^^^^^^^^^
          AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error
    
    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> See above for output.
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
Check the log at /home/runner/.cache/pre-commit/pre-commit.log
Error: The process '/home/runner/.local/bin/pre-commit' failed with exit code 3

Steps to reproduce the problem

  1. Create any Pull Request to this repository
  2. Wait for GitHub Actions to run
  3. Pre-commit check will fail with the error shown above

Reduced test case

Not applicable - This is a configuration/environment issue rather than a code issue.

Proposed solution

Upgrade pylint to v3.x.x series. I've confirmed this resolves the issue in my local environment:

  - repo: https://github.com/PyCQA/pylint
    rev: v3.3.3
    hooks:
      - id: pylint

Note: After upgrading to pylint v3.x.x, new lint warnings appear in the codebase.
These will need to be addressed in a separate PR after the version upgrade is approved.

This issue appears to be caused by deprecated features in Python 3.12 that pylint v2.15.8 depends on.


Checklist

  • I have described this issue in a way that is actionable (if possible)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant