ambitious-actor-36781
07/10/2025, 2:50 AMpants_plugin_sources
that sets the resolve & interpreter constraints to the right one for pants.
and a runtime_sources
that sets the resolve & interpreter for my runtime.
everything seems to work. Until you add a match/case
statement, and then it's a bit ... weird.
i.e. today black
failed with "Invalid syntax <unknown>, line <match statement>... blablabla older Python version." when doing fmt ::
Then doing pants fmt a/b/c/file.py
on that same file worked fine.
and then subsequent calls to fmt ::
work fine.
It's like, pants is picking an old 3.9 version of Python to use sometimes. Despite not having 3.9 as a resolve or interpreter any morecurved-manchester-66006
07/10/2025, 12:55 PMproud-dentist-22844
07/11/2025, 3:11 PM__defaults__
to set pants-plugins to a different interpreter constraint than the rest of the repo. I keep the pants-plugins code isolated from the rest of the code in the repo - so the pants-plugins code does not import the rest of the app code. It can run specific targets (say a script) that is in the default resolve, but it does not import that script.
You can see that here:
https://github.com/StackStorm/st2/blob/master/pants-plugins/BUILD
And these two blocks are how I run a script from the other resolve within one of the pants plugins:
• https://github.com/StackStorm/st2/blob/master/pants-plugins/sample_conf/subsystem.py#L37-L43
• https://github.com/StackStorm/st2/blob/master/pants-plugins/sample_conf/rules.py#L61-L72proud-dentist-22844
07/11/2025, 3:17 PMblack
resolve with deps: https://github.com/StackStorm/st2/blob/master/BUILD.tools#L28-L35proud-dentist-22844
07/11/2025, 3:18 PMambitious-actor-36781
07/13/2025, 10:31 PMambitious-actor-36781
07/13/2025, 10:31 PMambitious-actor-36781
07/13/2025, 10:32 PMambitious-actor-36781
07/16/2025, 3:06 AMpants fmt ::
fails with dependency on black not satisfied, 1 incompatible candidate found... requires python>=3.9
, as it can't install black, because something (pants?) is falling back to using the system python3.8 interpreter when installing things
pants fmt path/to/file.py
still works fine.ambitious-actor-36781
07/16/2025, 3:54 AM[black].interpreter_constraints
will silently ignore the resolve interpreter constraints if they're incompatible.