Reputation: 399
The package dir structure is this
repodir/
-------- setup.py
-------- MANIFEST.in
-------- bin/
----------- awsm.sh
-------- sound/
------------ init.py
------------ echo/
----------------- init.py
----------------- module1.py
----------------- module2.py
------------ effects/
------------------- init.py
------------------- module3.py
------------------- module4.py
setup.py
from setuptools import setup
setup(
name = 'sound',
version = '0.1',
author = 'awesomeo',
author_email = '[email protected]',
description = 'awesomeo',
license = 'Proprietary',
packages = ['sound'],
scripts = ['bin/awsm.sh'],
install_requires = ['Django==1.8.2', 'billiard', 'kombu', 'celery', 'django-celery' ],
zip_safe = False,
)
When I do - python setup.py install, only sound/init.py is copied to /Library/Python/2.7/site-packages/sound/ directory.
The rest of the subpackages echo, surround and effects are not copied at all. Setuptools creates an sound.egg-info which contain SOURCES.txt file
SOURCES.txt
MANIFEST.in
setup.py
bin/awsm.sh
sound/__init__.py
sound.egg-info/PKG-INFO
sound.egg-info/SOURCES.txt
sound.egg-info/dependency_links.txt
sound.egg-info/not-zip-safe
sound.egg-info/requires.txt
sound.egg-info/top_level.txt
Looks like setup does not include the subpackages in the SOURCES.txt file to be copied on install and that is what is creating the problem.
Any idea why this might happen?
Upvotes: 15
Views: 10944
Reputation: 645
from setuptools import setup
setup(
# ...
package_dir = {'': 'sound'} # folder_name
# ...
)
package_dir
takes mapping of your packages from where you want your sub-modules or packages to be discovered. Make sure you add __init__.py
file for your packages.
As per documentation:
If your packages are not in the root of the repository or do not correspond exactly to the directory structure, you also need to configure package_dir:
You can have a look around linked documentation for more detailed example.
Upvotes: 0
Reputation: 7088
You're already using setuptools so you can import find_packages
to get all sub packages:
from setuptools import setup, find_packages
setup(
...
packages=find_packages(),
...
)
Upvotes: 26
Reputation: 7033
Add sound.echo
and sound.effects
to packages
. distutils
won't recursively collect sub-packages.
As per the fine documentation:
Distutils will not recursively scan your source tree looking for any directory with an
__init__.py
file
Note: Also be sure to create __init__.py
files for your packages (In your question you named them init.py
).
Upvotes: 9