Search code examples
pythonmodulesemantics

Confusing semantics on Python module system


Is it wrong to refer to Python modules and packages as "libraries" ? Is there a technical differense ? Python documentation never mentions the word "library" in the packages or modules entry, but always refers to Pythons' built-in code as "library".


Solution

  • What's in a name? But as we are at it: 'library' is no technical/syntactical term in python and there is no organisational structure that would you call a python library. officially specified or mandatory way how you would organize your files and directories in your repository in order to call your project/package/module a library (while package is basically a directory with a __init__.py and a module is a *.py file.)

    But that term is widely used for modules and packages which provide a collection of features, functions, classes and so on for other python projects and applications. You would call them a library as they are not intended to be a stand-alone application.

    E.g. gentoo's portage is a python application while urllib is a library. There are python packages where this not so clear, like nosetests - I implement some of their classes and methods as if it is a library but then I call nosetests from the command line as if it is a stand-alone application.

    As @StefanPochmann pointed out, there is a thing called 'The Python Standard Library'.