better-memory-67206
06/23/2022, 5:07 PMimport helloworld
from anywhere (as long as my virtualenv is sourced). Any ideas what command to run? (I'm on ubuntu/linux if that matters)
In general in my project, I'm hoping I'd have many packages like helloworld
, and I could "build" all of them into my virtualenv with one command.happy-kitchen-89482
06/23/2022, 6:56 PMbetter-memory-67206
06/23/2022, 7:17 PMipython
anywhere (in any directory) on my machine, and run the line import helloworld
in the interpreter, and it will know I'm talking about the helloworld package in the example-python repo.
◦ the same way I could, if I did pip install fire
in my virtualenv, import fire
in an ipython
session, and it would use the version of fire
in my virtualenv
• I'm using virutalenv to isolate my python environment for each thing I'm working on. So for the monorepo I'm trying to build, when I'm working on it, I would be in a virtualenv.happy-kitchen-89482
06/23/2022, 8:23 PMbetter-memory-67206
06/23/2022, 9:02 PMexample-python/temp/temp.py
with a single line:
import helloworld
and run python temp.py
from example-python/temp/
, I'll get the error ModuleNotFoundError: No module named 'helloworld'
happy-kitchen-89482
06/23/2022, 9:21 PM./pants run example-python/temp/temp.py
then the import should workbetter-memory-67206
06/23/2022, 9:26 PMWell, yes, since example-python/helloworld isn't on your sys.path in that caseexactly, I was looking for something that would automatically add all our internal packages with a single command. E.g. for now I can make a
setup.py
file in each internal package, and manually pip install -e PKG_PATH
to add that internal package to my virtualenv. I was just looking for a single command to automagically find our internal packages (and maybe even create the setup.py
files for me 😂 ). but I think I know now that is not what pants is for. Still excited to use pants for linting and testing!
Thanks!happy-kitchen-89482
06/23/2022, 9:27 PM./pants run ...
, ./pants test ...
, ./pants package ...
and it knits together the in-repo and external dependencies for you.better-memory-67206
06/23/2022, 9:30 PMpython ..
might be too much for my team right now 😂 . But the ./pants test
and ./pants lint
could be good starting points for us 😄happy-kitchen-89482
06/23/2022, 9:43 PM