https://pantsbuild.org/ logo
#general
Title
# general
f

famous-lock-71490

11/22/2021, 12:36 PM
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"?
c

curved-television-6568

11/22/2021, 12:39 PM
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
e

enough-analyst-54434

11/22/2021, 12:42 PM
./pants roots
will print the import paths. You can then tweak using the info @curved-television-6568 pointed to.
👍 2
f

famous-lock-71490

11/22/2021, 12:57 PM
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
e

enough-analyst-54434

11/22/2021, 1:51 PM
Do you use
./pants tailor
?
f

famous-lock-71490

11/22/2021, 2:18 PM
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.
c

curved-television-6568

11/22/2021, 2:23 PM
You can run
./pants tailor <dir>
to have it run on a subset of the repo.
💯 1
f

famous-lock-71490

11/22/2021, 2:33 PM
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
h

hundreds-father-404

11/22/2021, 4:26 PM
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
3 Views