how to structure a directory with many scripts and shared code

Benedict Verheyen benedict.verheyen at gmail.com
Tue Feb 16 17:35:09 CET 2010


ssteinerX at gmail.com wrote:
> On Feb 16, 2010, at 3:28 AM, Benedict Verheyen wrote:
<snip>

>> python_scripts
>> |
>> |-->trunk
>> ......|-----> my big script 1
>> ................|-----> setup.py
>> ......|-----> my big script 2
>> ................|-----> setup.py
>> ......|-----> database
>> ................|-----> database script 1
>> ................|-----> database script 2
>> ......|-----> tools
>> ................|-----> setup.py
>>
>> Does that look like a clear structure?
> 
> No.
> 
> Make one setup.py at the top, put related scripts (like database) into separate sub-modules,
> so they can all be imported off a common 'trunk' as you have it above i.e. as trunk.database.xxx.
> 
> Then use entry points for any command line scripts.
> 
> Slightly harder, to setup initially but much cleaner to use and maintain and, it all installs with one call to setup.py develop.
> 
> S

Hhhm, i can see how it makes the maintenance cleaner.
However, in the case of a single setup.py, i will end up installing scripts on servers
that will never use them, only some.
As with making egg files for the bigger scripts, you will only install what's needed.
Then again, the script are small so in that respect it doesn't really matter.

How would i best distribute it? Via the single setup.py or building an egg from the
setup.py or plain copying the files to the server?
The code is company specific so nobody else will benefit from it.

Thanks,
Benedict





More information about the Python-list mailing list