[Distutils] __init__.py files missing from my eggs
Phillip J. Eby
pje at telecommunity.com
Fri Nov 11 18:16:45 CET 2005
At 04:51 PM 11/11/2005 +0000, Richard Cooper wrote:
>In the plugin's setup.py I'm doing the following for each plugin:
>
>setup(
> name = pluginName,
> packages = ['My.Project.plugin.'+pluginName],
> namespace_packages = ['My.Project.plugin'],
> package_dir = {'':'../../..'},
> package_data = ...
>)
>
>This is producing an egg file containing the following structure:
>My/
> Project/
> plugin/
> Plugin1/
> ...
>
>Which is what I expected except that there is no __init__.py(c|o)? files
>in "My" or "Project" or "plugin".
I would guess that your problem is that you need to do:
packages = [
'My', 'My.Project', 'My.Project.plugin',
'MyProject.plugin.'+pluginName
]
Because it is otherwise not including those packages (and their __init__.py
files).
On an unrelated note, I would caution you that your unconventional project
layout is likely to lead to other problems, such as an inability to create
usable source distributions. Neither setuptools nor the distutils are
designed to work with setup.py in any directory other than the distribution
root of the project.
What you probably want is a layout like this:
app/
setup.py
My/
Project/
app
Plugin1/
setup.py
My/
Project/
plugin1/
etc.
Then, each project can have a source distribution built, be managed by
easy_install, etc. Each project can also use 'find_packages()' to get the
list of packages to install, without having to manually list them or the
package directory names. If you are working on these projects at the same
time, you need only run "setup.py develop" in each one to set up a sys.path
structure that merges all the packages into one.
Note, by the way, that you don't need namespace packages to have plugins
for an application. Plugins can be in any package structure you like, as
eggs' "entry points" system can be used by plugins to advertise the
functions they provide, and the importing can be done automatically for you.
More information about the Distutils-SIG
mailing list