pythonsetuptoolssetup.pytooling

How to deploy user packages to shared folder "repo"?


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?


Solution

  • 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