How to version python projects with modules?

Asked by Timmie

After some code or function matures one likes to put into a extra file and use it as a module. Where do you recommend to keep these in order to version them together with the other files of the specific project?

like
devel/project1/
devel/project1/data-prcessing.py
devel/project1/module/io.py
devel/project1/module/statistics.py

or

devel/project1/
devel/project1/data-prcessing.py
devel/module/io.py
devel/module/statistics.py

My aim is to be able to distribute my code or generate windows executable once it matures.

P.S.: This question is closely related to What is the recommended workflow and repository layout for single developers? - https://answers.launchpad.net/bzr/+question/15219 but I put it in a seperate quetion to make answering easier.

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Dan Watkins
Solved:
Last query:
Last reply:
Revision history for this message
Best Dan Watkins (oddbloke) said :
#1

In the latter directory structure, where 'project1' and 'module' are not versioned together (and assuming 'project1' depends on 'module'), then you will have to branch or checkout both of them to a machine where you want to use 'project1'.

If they are versioned together (as in the former directory structure) then you will only have to branch/checkout once. However, if the modules in 'module' are shared between several projects then for any other project that depends on 'module' you will have to checkout 'project1'.

To summarise, if 'module' is only used in 'project1' version them together (the former). If 'module' is used by something that is not contained within 'project1', version it separately (the latter).

Revision history for this message
Timmie (timmie) said :
#2

Thanks Daniel Watkins, that solved my question.