After upgrading Pants 2.14.0, I'm seeing warnings ...
# general
r
After upgrading Pants 2.14.0, I'm seeing warnings like the attachment. I've fixed all other occurrences of similar warnings, but this particular set of warnings is from Pants plugins inside the mon-repo, where I don't explicitly add Pants itself to the unified
requirements.txt
.... What is the proper way to fix these?
1
I tried to make a new separate resolve & lockfile for pants plugins, but it didn't work for me because
pantsbuild-pants
requires Python 3.7 to 3.9 while my repo uses Python 3.10...
h
You probably want one of these targets: https://www.pantsbuild.org/docs/reference-pants_requirements
👀 1
r
hmmm
image.png
the problem is that my repo uses Python 3.10.8 (strictly exactly) while
pants_requirements()
still requires the Python interpreter version compatible with Pants
image.png
tried to set
interpreter_constraints
but it seems that it still tries to resolve "pants-plugins" with 3.10.8
c
Do you have a
.python-version
file in the project created by pyenv?
r
No, I don't have it and I'm not adding it since migration to Pants
(Instead I'm utilizing
./pants export
and exported venvs when necessary)
h
You’ll need a separate resolve for the pants plugin, as it cannot use 3.10.8
Do you have multiple resolves/lockfiles already in your repo? If so, this would be one more. If not, I guess you do now 🙂
r
@happy-kitchen-89482 I already know how to setup multiple resolves & lockfiles. The issue is about using different Python versions for each resolve. Please check out the above screenshots (diff).
h
I believe you can have different python interpreter constraints for each resolve. You’d set up ICs on the target(s) that own your pants plugin code, that override the repo default ones.
r
@happy-kitchen-89482 yes, that’s what i shared as acreenshots in this thread. I already did so. What i’m asking is whether i need to add/modify things as it does not work as intended.
h
Ah, you want to use resolves_to_interpreter_constraints (https://www.pantsbuild.org/docs/reference-python#resolves_to_interpreter_constraints) to set the constraints for the resolve
💯 1
r
great,
resolves_to_interpreter_constraints = "{'python-kernel': ['==3.9.*'], 'pants-plugins': ['>=3.7,<3.10']}"
in pants.toml seems to do the work... but there's another problem....
ah, okay, re-running lockfile generation does the work
image.png
ah, these were due to yesterday's mypy 0.990 update
now everything is in fit!
h
Excellent! Glad to hear it