Getting NoSourceRootError when trying to get depen...
# general
n
Getting NoSourceRootError when trying to get dependees, even though Pants recognizes the correct roots? See screenshot.
h
Huh. Well, it's right that
.
has no source root, but why the hell is it looking at
.
in the first place...
This is a private repo I assume?
I.e., we can't get a look at a repro?
n
Unfortunately no, it's hosted internally, but it's just a proto so I can replicate it publicly if we have more isuses. The script in question simply imports asyncio and sys, so it should not be looking anywhere else for dependencies. Let me try creating a build file from scratch (I used tailor).
Should just be root_patters = ["src/", "tests/"] if pants is in root w.r.t. src and tests and dir structure is just like src/projname/<modules or subpackages>?
h
Roots should point to the package roots, i.e., the part you strip off to get the top-level package/module name
So in your example, if
src
is a root, then you'd
import projname.package.foo
If
projname
is not part of the package name, then
src/projname
is the root, and you
import package.foo
Does that make sense?
But that error shouldn't happen either way
n
Yup, that is the usage. I was able to get things to work by cleaning up the BUILD files and setting setup.py in the root to the ignore list (it started complaining about that not having a source root).
By the way, stumbled upon some weirdness earlier in the day with this command, wasn't sure about reporting it because I couldn't reproduce it and didn't have Pants running with ldebug. But basically after running ./pants dependencies <build> it froze eternally. Subsequent calls to any command afterward resulted in the same behavior, and I fixed it by reinstalling (I'm sure there were less drastic solutions). When I did ps | grep py I saw over 15 python processes running from the multiple attempts to run subsequent pants commands, all of which were just hanging on something (lock files?). Anyway, on to testing hopefully the fun stuff now! 🙂