happy-psychiatrist-90774
05/20/2025, 10:53 PMpants.toml
[GLOBAL]
pants_version = "2.26.0"
pythonpath = ["%(buildroot)s/pants-plugins"]
backend_packages = [
"pants.backend.python",
"pants.backend.plugin_development",
"myplugin",
]
[python]
interpreter_constraints = ["==3.9.*"]
enable_resolves = true
[python.resolves]
pants-plugins = "pants-plugins/lock.json"
pants-plugins/BUILD
pants_requirements(resolve='pants-plugins')
python_requirement(
requirements=['requests'],
resolve='pants-plugins',
name='requests',
)
pants-plugins/myplugin/register.py
import requests
def rules():
return []
Running basically any pants
command at this point I get
ModuleNotFoundError: No module named 'requests'
What am I doing wrong? I'm pretty sure that I'm following all the instructions to the letter...gorgeous-winter-99296
05/21/2025, 5:29 AMplugins = ["requests"]
in your pants.toml.
I believe the docs go into a bit more detail, but the pants-plugins resolve is only used for linting, tests, etc. When used as a pants backend your code runs with the code in the pants launcher itself, which doesn't even have to match what the resolve uses.happy-psychiatrist-90774
05/21/2025, 5:50 AMrequirements.txt
and it works as expected!
I searched everywhere but couldn't find any documentation on thathappy-psychiatrist-90774
05/21/2025, 5:50 AM