Alex Alex - 1 year ago 62
Python Question

What option do I need in to create the package in the right directory?

I am using
to create a python package, which I want to install via
. To correctly install the files under


I used the following option in

'package_dir': {'':'lib'}

as described here but get an error

error: package directory 'lib' does not exist

Well, there is no such directory as I want the current directory to be installed as package
or whatever. I also tried to use

'package_dir': {'mycode':''}

which installes the code directly in


and not under


What am I doing wrong, and where is this documented? I might overlooked the documentation of this basic feature as the documentation for
is 'suboptimal'.

Answer Source

The description to how to do this an be found in the distribute documentation... Within a directory containing all of the project (TowelStuff/ in the given example) you specify the name of the actual module (towelstuff/). To include this as your module you need to add the following line in

'packages': ['towelstuff']

After having created the sdist (from within TowelStuff/), the installation of this package will install it under site-packages/towelstuff, which can be imported as usual (from towelstuff import ...).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download