cjolowicz / nox-poetry

Use Poetry inside Nox sessions
https://nox-poetry.readthedocs.io/
MIT License
166 stars 18 forks source link

Add support for Python 3.12 #1222

Open ammar-khan opened 5 months ago

ammar-khan commented 5 months ago

Please add Python 3.12 support

edgarrmondragon commented 4 months ago

This project is compatible with Python 3.12. What problem(s) are you running into?

johnthagen commented 2 weeks ago

Probably related to the fact there hasn't been a release in over a year and as such the trove classifier does not indicate that Python 3.12 is officially tested/supported

gatoniel commented 2 weeks ago

When using Python 3.12, I get the following error

AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

It can be solved by prepending to the session.install command the following (based on https://stackoverflow.com/a/77364602/10106730)

session.run("python", "-m", "ensurepip", "--upgrade")
session.run("python", "-m", "pip", "install", "--upgrade", "setuptools")
# now comes the
session.install(...)

However, after doing so, I got the warning that nox-poetry was using the pip from .pyenv/shims and not the one from the temporally created virtualenv. Hence, I switched all session.install to session.run("python", "-m", "pip", "install", ...).