12

I'm interested to know which parts of the python standard library are absolutely guaranteed to be available, and which parts might not be installed, dependent on distribution.

I've seen this question but it doesn't quite provide the answer I'm looking for.

I'm aware that these modules aren't always available and that the math module always is. How about other modules? Are there any modules besides math that are guaranteed to be available?

Edit: the sys module is also always available.

Community
  • 1
  • 1
Paul Etherton
  • 391
  • 3
  • 11
  • I'd say as stated there that It's down to a matter of what the maintainers of each distribution ported – Alexander Nov 11 '12 at 19:28
  • 3
    anyone can build python and exclude/include whatever they want ... typically the modules listed at http://docs.python.org are the ones included but really you can not guarantee even those will always be available ... It might be better to understand why you want to know? (as you can often bundle your program with required bits/ or at least have as a requirement) – Joran Beasley Nov 11 '12 at 19:36
  • 2
    even if it says its always available ... you could make a build in which it is not (or is available under a different name)... – Joran Beasley Nov 11 '12 at 20:06

1 Answers1

5

If you are talking about the standard Python implementation (CPython), then the http://docs.python.org/3/library/index.html page lists the modules it provides (you can choose the Python version on the top of the page).

These are the standard modules included in the Python implementation, but some of them are operating-system specific or may depend on some other platform component. This is usually noted in the documentation of a module with such dependency. E.g.: http://docs.python.org/3/library/posix.html – there is „Platform: POSIX” annotation at the top.

Other dependencies may not be that explicit – http://docs.python.org/3/library/sqlite3.html doesn't say that this module is built only if the sqlite3 was available during Python build, but it is something one can expect.

Anyway, the Python Standard Library reference is always the best place to start. If a module documentation there doesn't say anything about platform and nothing suggests it depends on any external library or platform specific mechanism, then you may assume it is safe to use. But us other had said – anyone is free to remove anything from his Python build.

Anything not from the Standard Library must be considered optional in any Python installation, but the 'pure python' modules from http://pypi.python.org/pypi may be more available for the target audience that some binary modules from the Standard Library.

Jacek Konieczny
  • 8,283
  • 2
  • 23
  • 35