Supporting multiple Python module versions (with the same version of Python)

Viewed 3462

I looked around but cannot find a clear answer to my question.

I have a very legitimate need for supporting N-versions of the same Python module.

If they are stored in the same same package/directory, they would have to be uniquely named, like in the following example:

      .../some/package/my_module_1.0.py
      .../some/package/my_module_1.1.py
      .../some/package/my_module_2.0.py
              -- etc. --

And each would, in turn, store its version number via the "version" attribute.

The consuming program then imports the correct version that it needs (e.g.: import my_module_1.1).

Is this the optimal (and most pythonic) way to accomplish this multi-module version need?

Thank you!

1 Answers
Related