1

I have a repository with multiple namespace packages in this format:

package_dir/

  • package_1
    • setup.py
  • package_2
    • setup.py

and so on. I'd like to install all packages in the overall package_dir directory in editable mode using a wildcard. If I run:

pip install -e package_dir/package_*/

Only the first package that is "discovered" by pip is installed in editable mode. Is there a way to install all matching directories in editable mode using a wildcard?

I have a Makefile that is running the pip command, and packages are getting added to package_dir on a regular basis. I'd rather not have to add a new line to the Makefile every time a small script is added to the repository.

edit:

Makefile target:

$(VENV_DIR): $(RELEASE_ROOT)/dev_requirements.txt
    rm -rf $@
    $(PYTHON_BIN) -m venv $@
    $(DEV_BIN)/pip3 install -U pip
    $(DEV_BIN)/pip3 install -r $(RELEASE_ROOT)/dev_requirements.txt
    $(DEV_BIN)/pip3 install -e $(RELEASE_ROOT)/package_dir/package_*/
  • I don't think you can. See https://stackoverflow.com/a/66335962/7976758 Found in https://stackoverflow.com/search?q=%5Bpip%5D+editable+namespace – phd Sep 30 '21 at 16:46

1 Answers1

1

I guess you need a loop, like this:

for dir in package_dir/package_*/; do pip install -e "$dir"; done

If you want to put this into a makefile (you really should include the makefile rule in your question if you want help with it) you'll need to double the $ in $dir to escape it from make: $$dir.

MadScientist
  • 92,819
  • 9
  • 109
  • 136