I’m developing a plugin, is there a recommended wa...
# plugins
f
I’m developing a plugin, is there a recommended way to setup my IDE (vscode or intellij) to resolve pants imports correctly? I’d like auto-complete and definition click through to aid in development
f
I feel like there used to be a bit in the docs about this but I can't find it. Basically you need to configure Pants for in-repo plugin development, and then export the virtualenv that from that resolve, and point your editor at that.
also tagging @wide-midnight-78598 who is working on a proper vscode integration to see if plugin dev use cases are on the radar there
w
Even though I'm largely a plugin developer, plugin dev wasn't on my primary roadmap (but, will kinda just come through for the most part)
f
Yeah I think the
pants_requirements()
bit will make sure that the appropriate packages are in the set of dependencies and then it should work just like developing anything else
f
got it working! I feel like the docs could be more clear about this particular setup, was hard to cut through the noise to figure this out for a standalone plugin repository for a non-python person like myself In case anyone else needs this, I needed to configure the pants.toml to enable “resolves”, setup a lockfile for plug-in dev
Copy code
[python]
enable_resolves = true
interpreter_constraints = ["CPython>=3.9.*"]

[python.resolves]
pants-plugins = "lock.txt"

[python.resolves_to_interpreter_constraints]
pants-plugins = ["==3.9.*"]
and use that resolve name in the BUILD for the pants_requirements
Copy code
pants_requirements(
    name="pants",
    resolve="pants-plugins",
)
Export that lockfile to a virtual env
Copy code
pants export --resolve=pants-plugins
Then in VSCode set the python interpreter path
Copy code
{
  "python.defaultInterpreterPath": "dist/export/python/virtualenvs/pants-plugins/3.9.18"
}
👍🏻 1
f
Yeah we could definitely improve the developer docs there
h
@fresh-mechanic-68429 docs are now hosted in the repo, so a PR improving them would be welcome!
f
I’ll put it on my todo list, hopefully I free up enough to get a pr up 😅
🙏 1