Hi, I upgraded to pants `2.18.0rc5` and I am not a...
# general
l
Hi, I upgraded to pants
2.18.0rc5
and I am not able to export any tools. For example:
pants export --resolve=black
fails with: `ExportError: No resolve named black found in [python].resolves.`Am I using the wrong command?
b
Sorry for the trouble! What version were you on before? Are there any warnings from pants? Do other commands (like
pants fmt ::
) still work normally?
l
Before I was on version
2.17.1rc3
. Yes, everything works as expected, I am just not able to export. To be honest I am not sure if the problem existed in
2.17.1rc3
, because I tend to forget to export if I do not have any issues with autocompletion, etc.
b
Ah, I see. • Is there a chance you could return to when you used 2.17.1rc3 and/or 2.17.0 (if ever) and see if the export works? • Can you share your
pants.toml
? (Background: I'm trying to assess if this is a regression for 2.18.0, that we need to fix before the release.)
l
I will create a repository that reproduces this issue.
https://github.com/cponfick/pants-tool-export-bug I tried all the
2.17.*
versions. It seems the issue was introduced with pants
2.18.0rc1
.
👍 1
👀 1
b
Thanks! From the description, maybe @happy-kitchen-89482 has insight.
l
Maybe I missed something and the way tools are exported changed?
h
There were changes, but I think they were all in 2.17, so this sounds like a regression. I'll look.
Ah, I missed some context. This is the expected behavior.
You don't have a resolve called "black", so you can't export one. (in 2.17 there was a ton of special-casing to support pseudo-resolves for each tool, but we got rid of it in favor of simplification).
You can create a custom resolve for black if you want to, and use
[black].install_from_resolve
to point to it (or you can add black to your default lockfile and point to that if you prefer)
And then you can export it
But the default is an internal lockfile that doesn't correspond to a resolve, and so can't be exported
b
Ah. Maybe it’s worth updating the 2.18 release notes and/or Python resolve/tool documentation to call out this breaking change specifically?
l
Ok. I feel like this change makes the UX of IDE integration more complicated then before. With
2.17.
I just exported all tools and could integrate them inside my IDE/Editor. With
2.18.0
I am only able to get an export if I install from resolve. In my specific case this leads to some issues. Currently, we are using two lockfiles: • One for all our python dependencies, constraint to
python 3.10
. For me the focus is to get the tool integration working for this environment. • One for pants plugins, constraint to
python 3.9
Copy code
resolves_to_interpreter_constraints = { python-default = [
    ">=3.10,<3.11",
], pants-plugins = [
    ">=3.9,<3.10",
] }
For example adding
flake8
to my default lock file is not possible with this configuration, because it requires to run on the same python version as the code it is linting. As a result I have to create a third lockfile for
flake8
, just to integrate
flake8
into our IDEs. My current work around is to add the tools to the default lockfile requirements file, but not use
[flake8].install_from_resolve
. This is not perfect, but I am able to export the tools without creating separate lockfiles for them. I think IDE tool integration is a bit of a draw back in general when using
pants
. For example, integration of
mypy
always was an issue, since it has to be in the default lockfile to provide a working VSCode integration. When I work on plugins I just deactivate it and rely on
pants check ::
, which is ok in that case.