0

I'm new to the Python project tooling and currently finding my ways around it. I'd like to standardize a set of Python projects and to that end I'm doing the following:

  1. Using pyscaffold to generate project templates i.e. conda install pyscaffold && putup my_project.
  2. Testing using python setup.py test
  3. Build source dist using python setup.py sdist bdist_wheel

Provided that I have set the PYTHONPATH to a shared drive /dev/shared/dist/Lib/site-packages/ and where Lib/site-packages/ is the suffix needed by Python AFAIK. How can I have the standardized projects built to output distributions either binary or source to that folder so that pip install my_project or for that matter building dependent projects will pick my packages from there?

SkyWalker
  • 13,729
  • 18
  • 91
  • 187

1 Answers1

1

You can use the -t (target) flag to install to a folder. So for instance:

mkdir target_folder
TARGET=target_folder

python -m pip install -t $TARGET requests

or using a wheel/dist that you've generated:

python -m pip install -t $TARGET my_package.tar.gz

This should also work for a mounted directory

C.Nivs
  • 12,353
  • 2
  • 19
  • 44
  • Thank you! will it work too for dependant projects e.g. `my_project2` lists `my_project` as dependency? – SkyWalker Mar 17 '20 at 14:45
  • 1
    That's a good question, if the dependencies live on a `pip` server that is either Pypi or a pip server that you own, it should work. If they are packaged projects that live locally on your machine, I'm not so sure – C.Nivs Mar 17 '20 at 14:47