Python: Module vs Package vs Library vs Framework

Module is a file which contains various Python functions and global variables. It is simply just .py extension file which has python executable code.

Package is a collection of modules. It must contains an __init__.py file as a flag so that the python interpreter processes it as such. The __init__.py could be an empty file without causing issues.

Library is a collection of packages.

Framework is a collection of libraries. This is the architecture of the program.

Application is an application. Yah, I’m sure about this one.

7 thoughts on “Python: Module vs Package vs Library vs Framework”

    1. Libraries:
      1. Apache Libcloud: accessing multiple cloud providers through a single, consistent, unified API
      2. Invoke: executing scripts on remote machines

      Frameworks:
      1. Django: open-source full-stack Python web framework.
      2. Bottle: to build lightweight and fast web apps. This is in the grey area between microframeworks and libraries

    2. Use django as an example
      Django is a web framework which has libraries
      Each library has a set of reusable packages
      Each package has modules in them
      Look up the django Web framework Sanchit đź‘Ť

  1. F.W>library>package>Module
    Ok i think i got it now
    Thanks for the help

    Question : can a application contain many frameworks ? Example of app and frameworks!

    1. The quick answer is ‘yes’, you may combine 2 or more frameworks to create an application, especially the frameworks are complimentary. In practice, frameworks often overlap in some properties/functions of their libraries. Thus, combining multiple frameworks can lead to unexpected clobbering.

Leave a Reply to Sanchit Sharma Cancel reply

Your email address will not be published. Required fields are marked *