alert-dawn-51425
03/24/2023, 8:45 PM| => ./pants check ::
16:44:27.01 [INFO] Initializing scheduler...
16:44:27.03 [WARN] DEPRECATED: Setting `Goal.environment_behavior=EnvironmentBehavior.UNMIGRATED` for `Goal` `list-docker-build` is scheduled to be removed in version 2.17.0.dev0.
See <https://www.pantsbuild.org/v2.15/docs/plugin-upgrade-guide>
16:44:27.03 [WARN] DEPRECATED: Setting `Goal.environment_behavior=EnvironmentBehavior.UNMIGRATED` for `Goal` `dc` is scheduled to be removed in version 2.17.0.dev0.
See <https://www.pantsbuild.org/v2.15/docs/plugin-upgrade-guide>
16:44:28.42 [INFO] Scheduler initialized.
16:44:39.36 [INFO] Canceled: Building extra_type_stubs.pex from 3rdparty/python/mypy_lockfile.txt
16:44:39.47 [ERROR] 1 Exception encountered:
Engine traceback:
in `check` goal
in Typecheck using MyPy - (environment:local, mypy)
InvalidLockfileError: You are using the lockfile at build_support/plugins/deps_lock.txt to install the resolve `pants-plugins` (from `[python].resolves`). However, it is not compatible with the current targets because:
- The targets use interpreter constraints (`CPython==3.10.*`) that are not a subset of those used to generate the lockfile (`CPython<3.10,>=3.7`).
The lockfile's interpreter constraints are set by the option `[python].resolves_to_interpreter_constraints`, which determines how the lockfile is generated. Note that that option only changes how the lockfile is generated; you must still set interpreter constraints for targets via `[python].interpreter_constraints` and the `interpreter_constraints` field (<https://www.pantsbuild.org/v2.15/docs/python-interpreter-compatibility>). All targets must have interpreter constraints that are a subset of their resolve's constraints.
To fix this, you can either adjust the interpreter constraints of the targets which use the resolve 'pants-plugins', or adjust `[python].resolves_to_interpreter_constraints` then run `generate-lockfiles`.
To regenerate your lockfile, run `./pants generate-lockfiles --resolve=pants-plugins`.
Relevent pants.toml file values:
[python]
enable_resolves = true
interpreter_constraints = ["==3.10.*"]
[python.resolves_to_interpreter_constraints]
# Pants can run with 3.7-3.9, so this lets us
# use different interpreter constraints when
# generating the lockfile than the rest of our project.
#
# Warning: it's still necessary to set the `interpreter_constraints`
# field on each `python_sources` and `python_tests` target in
# our plugin! This only impacts how the lockfile is generated.
pants-plugins = [">=3.7,<3.10"]
[python.resolves]
python-default = "3rdparty/python/python3-deps_lock.txt"
pants-plugins = "build_support/plugins/deps_lock.txt"
refined-addition-53644
03/24/2023, 9:21 PM# Warning: it's still necessary to set the `interpreter_constraints`
# field on each `python_sources` and `python_tests` target in
# our plugin! This only impacts how the lockfile is
So the plugin code specific targets should have something like
python_sources(interpreter_constraints= [">=3.7,<3.10"])
python_tests(interpreter_constraints= [">=3.7,<3.10"])
___defaults___
to avoid duplicating it every where inside your plugin code
__defaults__(all=dict(interpreter_constraints=[">=3.7,<3.10"]))