cool-easter-32542
03/17/2023, 5:35 PM[pylint].source_plugins
etc, which expects addresses to python_source
targets. Those can depend on third-party requirement like any normal code, via python_requirement
.
We currently consume the requirements via the tool lockfile:
pants/src/python/pants/backend/python/lint/pylint/rules.py
Lines 103 to 113 in </pantsbuild/pants/commit/f258544f8cf9a3fe135a40e587d27ff8fa0e42c8|f258544>
Our tool lockfile generation knows to include those requirements:
pants/src/python/pants/backend/python/lint/pylint/subsystem.py
Lines 292 to 296 in </pantsbuild/pants/commit/f258544f8cf9a3fe135a40e587d27ff8fa0e42c8|f258544>
That means that that tool lockfile codepath is ignoring the resolve
field of those python_requirements
.
--
However, resolve
is still relevant! You can run Pants goals on that first party plugin code directly, like anything else. When you do that, those targets will be the inputs to our pex_from_targets.py
code, which determines the resolve
by inspecting the input targets:
pants/src/python/pants/backend/python/lint/pylint/rules.py
Lines 91 to 102 in </pantsbuild/pants/commit/f258544f8cf9a3fe135a40e587d27ff8fa0e42c8|f258544>
--
Practically, what this all means is that multiple resolves is very useful for source plugins.
You can define a distinct resolve for your plugin code, which lets you avoid introducing dependencies just needed for your plugin into your main projects. When you run Pants on that plugin code directly, it will do the right thing.
When you run Pants on code that uses a different resolve than your plugin, Pants can still handle that. It won't complain about conflicting resolves, and the tool lockfile will still have the requirements you need to make things work.
If you're fine with using a single resolve for everything, you can ignore all this nuance and Pants will do the right thing.
pantsbuild/pantscool-easter-32542
03/17/2023, 5:35 PM