I’m running into some issues when trying to use a ...
# plugins
n
I’m running into some issues when trying to use a Pants plugin published to a private PyPI registry in another Pants-powered repository:
Copy code
ERROR: Cannot install foobar-plugin==0.1.0 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit <https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts>

 The conflict is caused by:
     foobar-plugin 0.1.0 depends on pantsbuild.pants==2.21.0.dev1
     The user requested (constraint) pantsbuild-pants==2.21.0.dev1
The
pantsbuild.pants==2.21.0.dev1
requirement on my plugin is added by
python_distribution()
and seems to come from the fact that I have a
pants_requirements(name="pants")
in my plugin repository’s BUILD file. If I remove
pants_requirements()
and publish a new version I can install the plugin just fine since
python_distribution()
no longer adds that dependency, but then developing the plugin gets problematic instead since I can’t run mypy or my tests locally (unless added again temporarily) or in CI. Any ideas? I assume if
pantsbuild.pants
and
pantsbuild-pants
weren’t different it would work in this case since the versions are the same, but preferably my plugin shouldn’t be tied to one exact Pants version - so I’d rather not have the dependency at all. I guess I could perhaps ignore
:pants
as a dependency on my
python_sources()
explicitly, if that’s what
python_distribution()
bases the dependency list on.
g
If I remove pants_requirements() and publish a new version I can install the plugin just fine since python_distribution() no longer adds that dependency, but then developing the plugin gets problematic instead since I can’t run mypy or my tests locally (unless added again temporarily) or in CI.
This seems like the actual problem. None of my plugins depend on pants when published and I can run tests etc fine.
https://github.com/tgolsson/pants-backends https://github.com/tgolsson/pants-cargo-porcelain If you want to look for diffs between your setup. The rust one isn't actually on PyPi yet, but packages fine with no weird deps.
n
Thanks, will take a look!
It's probably because you provide your own
pyproject.toml
? I let
python_distribution()
generate all that stuff for me, which results in my packaged distribution containing a
setup.py
file with
pantsbuild.pants
as a dependency.
g
Oh, yeah. I've never used setup.py with pants, so that's likely.
This seems like a thing that Pants should know though, it is quite weird for a plugin to depend on pants (since effectively, you'd always have a Pants version installed when you actually run it).
n
Yeah. I’ve tried excluding it as a dependency in both the
python_distribution()
and the
python_sources()
, but it still weasels its way in as a dependency in
setup.py
when the plugin is packaged. It makes sense why it behaves the way it does since
pants_requirements()
is just a generator for a couple of
python_requirement()
, but it’s annoying nonetheless 😛. I tried to manually set
install_requires
, but then Pants yell at me because it wants to own and control that field - so I guess I’ll just have to go down the route of manually creating the setup files for now.
g
Can you file an issue? It seems like what you tried should also work.
n