Library versions

P

Peo

Hi,

I'm writing a library for doing sysadmin tasks at my workplace. These
kind of
scripts have a tendency to live for decades and I want to make sure
that I don't break anything when I'm updating the library.

My current plan is to call the library something like 'foo1' and
import it into
scripts like 'import foo1 as foo'. Releases that change the API would
be installed
as 'foo2', 'foo3' and so on. This works fine but it will be quite
difficult
to create new releases (documentation and library code are littered
with
references to 'foo1').

Is there some other smart way to do acheive this?

Thanks / Paul
 
C

Carl Banks

Hi,

I'm writing a library for doing sysadmin tasks at my workplace. These
kind of
scripts have a tendency to live for decades and I want to make sure
that I don't break anything when I'm updating the library.

My current plan is to call the library something like 'foo1' and
import it into
scripts like 'import foo1 as foo'. Releases that change the API would
be installed
as 'foo2', 'foo3' and so on. This works fine but it will be quite
difficult
to create new releases (documentation and library code are littered
with
references to 'foo1').

Is there some other smart way to do acheive this?

The typical way to do this is to delegate responsibility to load the
most recent release to another module. Create a module called foo.py,
and it have it import all the objects from the most recent release
module. IOW, you should have a foo.py module that looks like this:


from foo1 import *


Which you update whenever there's a new release. Then in your code
you simply use:


import foo


This is, incidentally, one of the few cases where it's recommended to
use from module import *.


Carl Banks
 
L

Lawrence D'Oliveiro

In message
Peo said:
My current plan is to call the library something like 'foo1' and
import it into scripts like 'import foo1 as foo'. Releases that change the
API would be installed as 'foo2', 'foo3' and so on. This works fine but it
will be quite difficult to create new releases (documentation and library
code are littered with references to 'foo1').

I don’t understand why this is a problem. The references to “foo1†are
because it is “foo1†that implements those facilities, is it not? When
“foo2†comes along, you will introduce that name where specifying the
facilities specific to it, will you not? Where both modules provide the same
facilities, you will have to mention both names, and only in those cases.

I don’t see how you can possibly short-cut this process and still produce
correct documentation.
 
C

Chris Withers

Peo said:
Is there some other smart way to do acheive this?

Just turn them info python packages, and use buildout, pip or some other
python package management tool to create the versions.

You may, of course, just be able to svn the lot of them...
(then you don't need to worry about numbering them at all)

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top