Module, Package, Library

sreechandan

Sree Chandan R

Posted on December 13, 2019

Module, Package, Library
December 2019

Preface:

I would like to consider myself as a newbie to coding. At some point, I got confused with a lot of coding lingos. Especially as I had to jump between python, javascript and for some time c sharp.
Hence this post is a learn-along. As I learn more I will update/modify this post with relevant elaboration and talk about some weird/edge cases.
official docs: https://docs.python.org/


For now, I will share in brief a little bit with Python in mind.

-- foo.py
Enter fullscreen mode Exit fullscreen mode

That's a python file and also a python module.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-- fooDir
   -- foo.py
Enter fullscreen mode Exit fullscreen mode

That's just a python file(module) in a folder.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-- fooDir
   -- __init__.py
   -- foo.py
Enter fullscreen mode Exit fullscreen mode

Now that's a python package. Magic. The magic is __init__.py
A Package is a collection of modules neatly "packaged-up" into a directory. The __init__.py file is just how python recognizes that the directory is meant to be a package.

Now, whats a library?
A library is a collection of functionalities. It can be just a module or a package.

Next up: library vs framework vs API. That's spicy.


Thoughts

It is said teaching makes you learn better. And for the most part, these posts are a way of self-improvement for me. If you find any corrections you want to point out please do it, but try to be respectful.

💖 💪 🙅 🚩
sreechandan
Sree Chandan R

Posted on December 13, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related