Pre-commit broken on Python 3.12
- Dominant language
- Python
- Stars
- 172
- Forks
- 41
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 1
Description
- Platform/operating system: **docker, python:3-slim**
- Python version (run `python -version` or `python3 -version`): **3.12.2**
- Problem: `pre-commit run --all-files` crashes. (log below)
- How to reproduce:
1. checkout `main`
2. open it in docker container:
`docker run -it --rm -v "$(pwd)":/workspace -w /workspace python:latest bash`
3. run these:
```
git config --global --add safe.directory /workspace
pip install pre-commit
pre-commit run --all-files
```
**error log (relevant part)**
```
File "/tmp/pip-build-env-l7g3nkvd/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2191, in
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[end of output]
```
Contributor guide
Research direction
Start by reproducing the failure in the documented python:latest Docker container with `pip install pre-commit` and `pre-commit run --all-files`. Inspect the repository's pre-commit configuration and dependency setup to identify the Python 3.12 incompatibility. Done means the command completes successfully on Python 3.12.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100