So I finally added the new plugin I'm working on t...
# general
r
So I finally added the new plugin I'm working on to my
pants.toml
but I'm getting a
ModuleNotFoundError
for a dependency my plugin has when trying to run pants. There's nothing abnormal about my dependency, it's in my
pants-plugins
lockfile and using
pants dependencies
I can see the dependency inference is working correctly. What gives?
1
pants peek
for my requirement
Copy code
[
  {
    "address": "pants-plugins/plugins/my_plugin:yte",
    "target_type": "python_requirement",
    "dependencies": [],
    "dependencies_raw": null,
    "description": null,
    "entry_point": null,
    "modules": null,
    "requirements": [
      "yte"
    ],
    "resolve": "pants-plugins",
    "tags": null,
    "type_stub_modules": null
  }
]
l
Nick the docs suggest that we need to add a special line in pants.toml for a dependency of the plugin itself: https://www.pantsbuild.org/docs/plugins-overview#in-repo-plugins
Copy code
# pants.toml
[GLOBAL]
plugins = ["ansicolors==1.18.0"]
You can depend on third-party dependencies in your in-repo plugin by adding them to the
plugins
option:
r
Oh yeah that did it
👍 1
Calling that field
plugins
rather than something like
plugin_dependencies
is kinda confusing
g
No, it's just awkward UX for dependencies. The field just installs things into Pants .venv. F.ex, if you use plugins from Pypi they go there, and dependencies are pulled in via the usual mechanics. https://github.com/pantsbuild/pants/pull/19406 will improve the situation for in-repo plugins but I think it won't hit stable until 2.18.0
(Consider the difference between
backends
,
pythonpath
, and
plugins
and the pattern becomes a bit more clear. Both
plugins
and
pythonpath
add things to the "host" Pants, and the
backends
option lists modules directly inside that world.)
👍 1