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
If the projects are not installed from an index such as PyPI, it is not possible to take advantage of the install_requires
feature. Something like this could be done instead:
.
├── NmspcPing
│ ├── nmspc.ping
│ │ └── __init__.py
│ └── setup.py
├── NmspcPong
│ ├── nmspc.pong
│ │ └── __init__.py
│ └── setup.py
└── setup.py
NmspcPing/setup.py
(and similarly NmspcPong/setup.py
)
import setuptools
setuptools.setup(
name='NmspcPing',
version='1.2.3',
package_dir={'nmspc.ping': 'nmspc.ping'},
packages=['nmspc.ping'],
)
setup.py
import setuptools
setuptools.setup(
name='Nmspc',
version='1.2.3',
package_dir={
'nmspc.ping': 'NmspcPing/nmspc.ping',
'nmspc.pong': 'NmspcPong/nmspc.pong',
},
packages=['nmspc.ping', 'nmspc.pong'],
)
This allows to install from the root folder in any of the following combinations:
$ python3 -m pip install .
$ python3 -m pip install ./NmspcPing
$ python3 -m pip install ./NmspcPong
$ python3 -m pip install ./NmspcPing ./NmspcPong