Pre-commit PyO3 setup python requirements

When setting up pre-commit for the first time, PyO3 complained that I was using Python 3.14 when it currently only supports up to Python 3.13. PyO3 supports an env variable PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 with the following explanation:

the configured Python interpreter version (3.14) is newer than PyO3’s maximum supported version (3.13)
please check if an updated version of PyO3 is available. Current version: 0.22.5
set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI

Using that environment variable got me past the first time setup. However, when trying to investigate the issue for future contributors in the same boat, I haven’t yet been able to reproduce the problem. I can remove the compatibility environment variable, and delete everything in ~/.cache/pre-commit, and no longer get complaints from PyO3. It may be that PyO3 was performing some one-time setup elsewhere on my machine?

I’m not sure where to go from here if I can’t reproduce the issue. We don’t want first time contributors to have to guess at how to set up pre-commit like I did. Do we just need to suggest setting that env var in the first time contributor documentation?

Please report this problem to GitHub - PyO3/pyo3: Rust bindings for the Python interpreter; this forum is for the Python project itself.

A

Moved this from Core Workflow to Python Help

I would have tried two other things: clearing the pip cache itself, as the built wheels might still be there (pre-commit installing from pip), or if you think that the pre-commit tool used a rust binary, or that the cached content is on the rust side, to clear the cargo cache location. I would be surprised if the second approach would be the one that works.