I'd like to install some special sub-package from a package.
For example, I want to create package with pkg_a and pkg_b. But I want to allow the user to choose which he wants to install.
What I'd like to do:
git clone https://github.com/pypa/sample-namespace-packages.git
cd sample-namespace-packages
touch setup.py
setup-py:
import setuptools
setup(
name='native',
version='1',
packages=setuptools.find_packages()
)
# for all packages
pip install -e native #Successfully installed native
# for specific
# Throws ERROR: native.pkg_a is not a valid editable requirement.
# It should either be a path to a local project
pip install -e native.pkg_a native.pkg_b
# for specific
cd native
pip install -e pkg_a # Successfully installed example-pkg-a
I've seen this in another questions answer so it must be possible: Python install sub-package from package
Also I've read the Packaging namespace packages documentation and tried to do the trick with the repo
I've tried some variants with an additional setup.py in the native directory, but I can't handle it and I am thankful for all help.
Update
In addition to the answer from sinoroc I've made an own repo. I created a package Nmspc, with subpackages NmspcPing and NmspcPong. But I want to allow the user to choose which he wants to install. Also it must to be possible to install the whole package.
What I'd like to do is something like that:
git clone https://github.com/cj-prog/Nmspc.git
cd Nmspc
# for all packages
pip install Nmspc
# Test import
python3 -c "import nmspc; import nmspc.pong"
# for specific
pip install -e Nmspc.pong # or
pip install -e pong
# Test import
python3 -c "import pong;"