fresh-cat-90827
12/08/2021, 3:12 PMpython_library
into a notebook? I am able to load pex_binary
(and other binary targets are documented to be supported). However, what about loading plain sources? My ultimate goal is to be able to write from projectA.module import function
in Jupyter (because projectA
is on the sys.path
).export PYTHONPATH=$(source .env; echo $PYTHONPATH); jupyter lab
where the .env
file is
PYTHONPATH="./projectA:./projectB:./projectC:$PYTHONPATH"
The .env
file is handy for VSCode as it loads the directories by picking the file up automatically.
Is modifying the PYTHONPATH
before starting jupyter lab
my only option or can I ask Pants nicely to load python_sources
?enough-analyst-54434
12/08/2021, 3:27 PMfresh-cat-90827
12/08/2021, 3:29 PMenough-analyst-54434
12/08/2021, 3:31 PMfresh-cat-90827
12/08/2021, 3:32 PMenough-analyst-54434
12/08/2021, 7:07 PMfresh-cat-90827
12/08/2021, 8:04 PMpex_binary
; there is a need to be able to work with the monorepo without packaging everything. Jupyter notebooks work great OOTB in VScode thanks to the .env
file I mentioned earlier and in PyCharm thanks to the directories marked as sources. You can just run from projectA import foo
with any of the the monorepo directories, so it’s alright. So I wouldn’t worry too much about Pants plugin support for python_library
— it’s essentially unnecessary given how easy it’s to change the PYTHONPATH
before starting the jupyter lab