https://pantsbuild.org/ logo
#general
Title
# general
r

rhythmic-morning-87313

11/07/2022, 7:33 AM
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

happy-kitchen-89482

11/07/2022, 3:15 PM
You probably want one of these targets: https://www.pantsbuild.org/docs/reference-pants_requirements
👀 1
r

rhythmic-morning-87313

11/07/2022, 3:54 PM
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

chilly-tailor-75063

11/07/2022, 4:26 PM
Do you have a
.python-version
file in the project created by pyenv?
r

rhythmic-morning-87313

11/07/2022, 4:32 PM
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

happy-kitchen-89482

11/07/2022, 5:25 PM
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

rhythmic-morning-87313

11/08/2022, 12:56 AM
@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

happy-kitchen-89482

11/08/2022, 2:47 AM
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

rhythmic-morning-87313

11/08/2022, 3:59 AM
@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

happy-kitchen-89482

11/08/2022, 5:49 PM
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

rhythmic-morning-87313

11/09/2022, 5:03 AM
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

happy-kitchen-89482

11/09/2022, 5:53 PM
Excellent! Glad to hear it
5 Views