0

I have several namespace packages. I followed the outline that is sketched in PEP420 and the docs. They are spread out over a few repositories that sometimes bundle them in a deeper namespace.

Setup

For example we could have the structure below.

Repo1
 /ns_example/src/ns/example/__init__.py
 /ns_example/setup.py

 /ns_another/src/ns/another/__init__.py
 /ns_another/setup.py

Repo2
 /ns_deep/src/ns/deep/one/__init__.py
 /ns_example/setup.py

 /ns_deep/src/ns/deep/two/__init__.py
 /ns_example/setup.py

In setup.py I create the different packages. Below I specify the two different cases I have from the example above.

from setuptools import setup, find_namespace_packages
import datetime

setup(
    name="ns_example",
    version=datetime.datetime.now().strftime('%Y.%m.%d.%H%M'),
    description='Namespace example',
    packages=find_namespace_packages(where='src', include=['ns.*']),
)
from setuptools import setup, find_namespace_packages
import datetime

setup(
    name="ns_deep_one",
    version=datetime.datetime.now().strftime('%Y.%m.%d.%H%M'),
    description='Namespace example',
    packages=find_namespace_packages(where='src', include=['ns.deep.*']),
)

Problem

This all works, and I can install them with pip install ns_example or pip install ns_deep_one, but now i want to be able to do pip install ns which would install all the packages in the namespace. That however does not seem to work. Why?

Roelant
  • 4,508
  • 1
  • 32
  • 62
  • 1
    How does the `setup.py` for the `ns` project look like? – sinoroc Feb 11 '20 at 15:20
  • I don't have another setup, so that might explain ^^ Just used the example from the docs. So you need to make a setup for a package that then requires all the individual packages? – Roelant Feb 11 '20 at 16:15
  • 1
    Yes, you could create a `ns` project that doesn't have any code itself but has the other projects as dependencies. I gave an answer to a somewhat related question here: https://stackoverflow.com/a/58167603/11138259 – sinoroc Feb 11 '20 at 16:23

0 Answers0