Hi team, quick question. I updated my `pants.toml`...
# general
s
Hi team, quick question. I updated my
pants.toml
to use
2.19.0
. 1. tried
pants check ::
and it's failing on
The Pip requested was pip==23.0.1 but it does not work with the interpreter selected which is CPython 3.12.1
2. I manually updated the version of pex to use (set to
v2.1.161
), adjusted know versions and under python set
pip_version = "latest"
but I'm getting the exact same error about
pip requested 23.0.1...
I'm probably missing something obvious, can someone point me in the right direction please?
Copy code
[GLOBAL]
pants_version = "2.19.0"
...
[python]
interpreter_constraints = [">=3.12.0"]
pip_version = "latest"
...
[pex-cli]
version = "v2.1.161"
known_versions = [
  "v2.1.161|macos_arm64|5bb08a677d309889b3357cd23a3a95945a4c3438cfb00ece5291dcfe89221fcc|3675619",
  "v2.1.161|macos_x86_64|5bb08a677d309889b3357cd23a3a95945a4c3438cfb00ece5291dcfe89221fcc|3675619",
  "v2.1.161|linux_x86_64|5bb08a677d309889b3357cd23a3a95945a4c3438cfb00ece5291dcfe89221fcc|3675619",
  "v2.1.161|linux_arm64|5bb08a677d309889b3357cd23a3a95945a4c3438cfb00ece5291dcfe89221fcc|3675619"
]
Running
pants help-advanced pex-cli
shows that new values are picked up, lock file was regenerated
Ok, testing a version number instead of
latest
, same error. As if param is not picked up
Copy code
16:03:59.28 [INFO] Initializing scheduler...
16:04:01.64 [INFO] Scheduler initialized.
16:04:03.57 [INFO] Canceled: Building mypy.pex from <resource://pants.backend.python.typecheck.mypy/mypy.lock>
16:04:04.35 [INFO] Completed: Building mypy.pex from <resource://pants.backend.python.typecheck.mypy/mypy.lock>
16:04:04.35 [ERROR] 1 Exception encountered:

Engine traceback:
  in `check` goal

ProcessExecutionFailure: Process 'Building mypy.pex from <resource://pants.backend.python.typecheck.mypy/mypy.lock>' failed with exit code 1.
stdout:

stderr:
The Pip requested was pip==23.0.1 but it does not work with the interpreter selected which is CPython 3.12.1 at /Users/kevin/.asdf/installs/python/3.12.1/bin/python3.12. Pip 23.0.1 requires Python <3.12,>=3.7.
c
sounds like that ought to have worked.. try running with extra logging to inspect the pex command line, as well as keeping the sandbox to allow you to check that it is indeed pex 2.1.161 that is being used.
šŸ‘€ 1
c
I think you are tripping over https://github.com/pantsbuild/pants/blob/2.19.x/src/python/pants/notes/2.19.x.md " ensure all of your tools use resolves generated with this new version (Pants' built-in ones are not, yet)." https://github.com/pantsbuild/pants/issues/20354
So if you use your own resolve for mypy it should work,but
<resource://pants.backend.python.typecheck.mypy/mypy.lock>
does not support 3.12 yet
šŸ‘ 1
s
Thanks, I'll run a few more checks and try pex
2.1.148
as indicated in the 2.19.x notes
Indeed, checking the sandbox: •
mypy.lock
as per cburroughs comment
Copy code
"requires_dists": [
    [...]
    python_version < \"3.11\""
]
•
__run.sh
has something weird about python 3.9
Copy code
[...]
PEX_PYTHON=/Users/[...]/bindings/venvs/2.19.0/bin/python3.9
PEX_ROOT=.cache/pex_root /Users/[...]/bindings/venvs/2.19.0/bin/python3.9
[...]
--pip-version 23.3.2
--python /Users/kevin/.asdf/installs/python/3.12.1/bin/python3.12
Ok, I have my own mypy setup, locks and all. I applied the setup from 2.19 docs (the 3rd party plugin https://www.pantsbuild.org/2.19/docs/python/goals/check#add-a-third-party-plugin).
pants check ::
is still picking up this lock file
<resource://pants.backend.python.typecheck.mypy/mypy.lock>
. Is there an example somewhere on how to use the newly generated
3rdparty/python/mypy.lock
?
Ok, got it to work: this part of the documentation needs an update I think:
Copy code
[python.resolves]
mypy = "3rdparty/python/mypy-lock.txt"
should be:
Copy code
mypy = "3rdparty/python/mypy.lock"
āœ…
c
hmm, do you have
Copy code
requirements = ["//3rdparty/py#mypy",]
install_from_resolve = "whatever-it-called"
set?
s
I landed on
Copy code
[python.resolves]
main_resolver = "3rdparty/python/default.lock"
mypy = "3rdparty/python/mypy.lock"

[mypy]
install_from_resolve = "mypy"
config = "mypy.ini"
so without the
requirements = ...
part