You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
On Python 3.12 the pre-commit hook fails with ModuleNotFoundError: No module named 'pkg_resources' on Python 3.12.
The usage pkg_resources has been deprecated and should be replaced by their equivalent importlib modules.
To Reproduce
Install Python 3.12 (or use container image)
Run pip install pre-commit to install pre-commit
Create .pre-commit-config.yaml with content from below
Create test.py with content from below
Run git init to create an empty repository
Run pre-commit run --files test.py prospector
See error ModuleNotFoundError: No module named 'pkg_resources'
A workaround is to use pip to install prospector and it's hidden dependency, setuptools. Then run pre-commit in "local" mode.
.pre-commit-config.yaml:
repos:
# # this will fail on run in Python 3.12 without setuptools
# - repo: https://github.com/PyCQA/prospector
# #rev: v1.10.3
# rev: master
# hooks:
# - id: prospector
# this works fine
- repo: local
hooks:
- id: prospector
name: Prospector
description: Analyze Python code using Prospector
entry: prospector
language: python
Describe the bug
On Python 3.12 the pre-commit hook fails with
ModuleNotFoundError: No module named 'pkg_resources'
on Python 3.12.The usage pkg_resources has been deprecated and should be replaced by their equivalent importlib modules.
To Reproduce
pip install pre-commit
to install pre-commitgit init
to create an empty repositorypre-commit run --files test.py prospector
ModuleNotFoundError: No module named 'pkg_resources'
.pre-commit-config.yaml
test.py
Expected behavior
The prospector hook passes without errors.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: