how to structure a directory with many scripts and shared code

Jean-Michel Pichavant jeanmichel at sequans.com
Tue Feb 16 11:45:04 EST 2010


Benedict Verheyen wrote:
> 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.
>   
You should care about this only if your scripts exceeed a faire amount 
of Ko.
Are you sure you've written Mo of python code ?

JM



More information about the Python-list mailing list