oh and does anyone know, how I can find out, which...
# general
oh and does anyone know, how I can find out, which python imports to use in my monorepo? I'm debugging
could not import <http://some.path.in|some.path.in>.internal.library
Errors and would like to have something like "hey pants, list all the python import paths i could use in my monorepo"?
Perhaps try looking at what “targets” you have (that is, things that pants can work with when doing things such as build, test and package) with the
./pants list ::
command. This could give you a hint if it picks up what you expect or not..
If not, that could indicate you need to tweak the “source roots” configuration: https://www.pantsbuild.org/docs/source-roots
./pants roots
will print the import paths. You can then tweak using the info @curved-television-6568 pointed to.
👍 2
okay, and "/" is auto-translated to ".", right?
I'd love to have a python error message like "your import does not make sense, it is not included in these 28 paths you could use here (based on your repositories BUILD files): all 28 possible imports.."
ah i think I fixed it.. in one of the parents folders above the to-be-imported library there was no BUILD file. at least it works now after moving the library to the toplevel folder. a little bit weird though
Do you use
./pants tailor
No, I'm contributing in a crowded monorepo, where multiple parties have their folders. I didn't want to disturb anyone to have pants boilerplate laying around, when it's just two or three teams who opt-in for it right now.
You can run
./pants tailor <dir>
to have it run on a subset of the repo.
💯 1
ah good to know!hm it seems that this command does not produce the missing BUILD file (my_team/BUILD) either
I'll try to drill down later why it didn't work.. i was just curious whether i am missing some command how to debug import errors. since dependency management in a python monorepo seems to be a major usecase of pants, i was expecting to see some helper command or debug switch to easily see some context on a particular import error.
👍 1
Hi, check out this part of the troubleshooting guide for more recommendations: https://www.pantsbuild.org/docs/troubleshooting#import-errors-and-missing-dependencies And please feel free to keep asking for help if those don't work! Happy to help
🙌 1