dazzling-dress-95246
03/31/2023, 10:39 PM/usr/src/app:Foo
/usr/src/app/bar:Bar
/usr/src/baz:Baz
and then we set the PYTHONPATH within the image to:
/usr/src/app:/usr/src/baz
Now Foo's source root is "/". Bar gets mounted within Foo and so python modules in Foo can import python modules within Bar like so:
import bar.something
Python modules in Foo can also import python modules within Baz like so:
import baz.something
I'm currently keeping pants.toml
within Foo.
Questions:
1. what's the recommended setup here?
a. I'm currently thinking of mounting all the above within a container just like our current env and then installing pants within it.
2. should I set the pythonpath env var within the container or given that pants uses its own python binary, should I define it in pants.toml somewhere?
a. I do see this link but it refers to plugins which I don't think is right.
3. I'd like to begin by testing pants on a single file/module, let's say located at Foo/module/submodule
(which can import from across the pythonpath). However setting the source root as "/" and then calling pants tailor ::
adds BUILD files all over the repo. How can I limit it to only the one submodule?
Feel free to have me read/grep documentation if the above is covered somewhere already.dazzling-dress-95246
03/31/2023, 11:30 PMpants tailor ::
, it sadly misses adding BUILD files to the Baz repo so I think I need to tell pants to look at the PYTHONPATH too?
re: 3
looks like I do need BUILD files everywhere!enough-analyst-54434
03/31/2023, 11:35 PMtailor
docs you'll see a few ignore options: https://www.pantsbuild.org/docs/reference-tailor
You might try masking out a subtree in your repo for tailor to operate on using those.dazzling-dress-95246
03/31/2023, 11:41 PMFrom that list, you want to set up source roots to tell Pants about your 1st party code PYTHONPATHso the issue is I've defined my pants.toml within Foo and so the only sources I can put are within Foo. However, Baz gets mounted outside the Foo root. Python still treats it as a local module import because of PYTHONPATH
dazzling-dress-95246
03/31/2023, 11:42 PMenough-analyst-54434
03/31/2023, 11:42 PMdazzling-dress-95246
03/31/2023, 11:42 PMenough-analyst-54434
03/31/2023, 11:43 PMenough-analyst-54434
03/31/2023, 11:43 PMdazzling-dress-95246
03/31/2023, 11:43 PMdazzling-dress-95246
03/31/2023, 11:44 PMenough-analyst-54434
03/31/2023, 11:45 PMdazzling-dress-95246
03/31/2023, 11:46 PMenough-analyst-54434
03/31/2023, 11:46 PMenough-analyst-54434
03/31/2023, 11:47 PMdazzling-dress-95246
03/31/2023, 11:47 PMenough-analyst-54434
03/31/2023, 11:48 PMenough-analyst-54434
03/31/2023, 11:48 PMdazzling-dress-95246
03/31/2023, 11:49 PMenough-analyst-54434
03/31/2023, 11:49 PMdazzling-dress-95246
03/31/2023, 11:49 PMenough-analyst-54434
03/31/2023, 11:50 PMenough-analyst-54434
03/31/2023, 11:50 PMenough-analyst-54434
03/31/2023, 11:50 PMenough-analyst-54434
03/31/2023, 11:50 PMdazzling-dress-95246
03/31/2023, 11:51 PMenough-analyst-54434
03/31/2023, 11:51 PMdazzling-dress-95246
03/31/2023, 11:51 PMenough-analyst-54434
03/31/2023, 11:52 PMdazzling-dress-95246
03/31/2023, 11:52 PMenough-analyst-54434
03/31/2023, 11:52 PMenough-analyst-54434
03/31/2023, 11:52 PMdazzling-dress-95246
03/31/2023, 11:53 PMdazzling-dress-95246
03/31/2023, 11:53 PMenough-analyst-54434
03/31/2023, 11:54 PMenough-analyst-54434
03/31/2023, 11:54 PMdazzling-dress-95246
03/31/2023, 11:55 PMenough-analyst-54434
03/31/2023, 11:55 PM--changed-since
and anything else that relies on git.dazzling-dress-95246
03/31/2023, 11:55 PMenough-analyst-54434
03/31/2023, 11:55 PM.git
dirs IIUC.dazzling-dress-95246
03/31/2023, 11:56 PMenough-analyst-54434
03/31/2023, 11:57 PM.git
as a sibling of pants.toml
- I could be remembering that wrong though.dazzling-dress-95246
03/31/2023, 11:57 PMenough-analyst-54434
03/31/2023, 11:57 PMdazzling-dress-95246
03/31/2023, 11:57 PMdazzling-dress-95246
03/31/2023, 11:57 PMdazzling-dress-95246
03/31/2023, 11:57 PMenough-analyst-54434
03/31/2023, 11:58 PMdazzling-dress-95246
03/31/2023, 11:58 PMdazzling-dress-95246
03/31/2023, 11:59 PMenough-analyst-54434
03/31/2023, 11:59 PMdazzling-dress-95246
03/31/2023, 11:59 PMenough-analyst-54434
03/31/2023, 11:59 PMenough-analyst-54434
03/31/2023, 11:59 PMenough-analyst-54434
04/01/2023, 12:00 AMenough-analyst-54434
04/01/2023, 12:00 AMdazzling-dress-95246
04/01/2023, 12:00 AMenough-analyst-54434
04/01/2023, 12:01 AMdazzling-dress-95246
04/01/2023, 12:02 AMdazzling-dress-95246
04/01/2023, 12:02 AMenough-analyst-54434
04/01/2023, 12:03 AMenough-analyst-54434
04/01/2023, 12:03 AMdazzling-dress-95246
04/01/2023, 12:04 AMdazzling-dress-95246
04/01/2023, 12:04 AMenough-analyst-54434
04/01/2023, 12:05 AMdazzling-dress-95246
04/03/2023, 8:52 PMdazzling-dress-95246
04/03/2023, 8:52 PMdazzling-dress-95246
04/03/2023, 8:52 PM