Skip to content Skip to sidebar Skip to footer

Python Packaging Multiple Subpackages With Different Data Directories

I have a structure of the directory as such with foobar and alphabet data directories together with the code something.py: \mylibrary \packages \foobar fo

Solution 1:

Firs you have to package and publish alphabet and foobar as a separate packages as pip install mylibrary[alphabet] means

pip install mylibrary
pip install alphabet

After that add alphabet and foobar as extras:

setup(
    …,
    extras = {
        'alphabet': ['alphabet'],
        'foobar': ['foobar'],
    }
)

The keys in the dictionary are the names used in pip install mylibrary[EXTRA_NAME], the values are a list of package names that will be installed from PyPI.

PS. And no, you cannot use extras to install some data files that are not available as packages from PyPI.

Post a Comment for "Python Packaging Multiple Subpackages With Different Data Directories"