To support me make more contents, BuyMeACoffee at: https://www.buymeacoffee.com/umaryusuf
Source code: https://github.com/forum2k9/Python-Pr...
Script: A file with .py extension that contains variable, functions, classes etc that are intended to run when the file is executed
Example: script_1.py, file1.py, anyname.py etc
Module: it is 'Script' that is intended to be imported into another python script. It usually contains Python objects such as functions, classes, variables, constants, etc.
Example: this, antigravity, math, os, imp, importlib, re
Package: is a collection of 'Modules' in a folder that has a special file named '__init__.py'
Example: pandas, matplotlib, numpy, requests, beatifulsoup etc
Library: A complex 'Package' that contains useful functions
Example: same as packages including... TensorFlow, Keras, PyTorch, Scikit-Learn, Theano
Framework: A complex 'Library' that is used to fast track the development of an application
Example: Flask, Django, FastAPI, Web2Py, CherryPy, PyQt5, Tkinter, Kivy, wxPython, Libavg, PySimpleGUI, PyForms, Wax etc
--------------------- Working with Builtin Modules -----------------------------
Module/Package can only be imported once (however you can reload the import)
Use _file_ to see the module's file path
https://docs.python.org/3/library/ind...
https://docs.python.org/3/py-modindex...
https://docs.python.org/3/tutorial/mo...
--------------------- Working with 3rd Party Modules -----------------------------
Python Package Index - https://pypi.org/
Archived: Unofficial Windows Binaries for Python Extension Packages -
https://www.lfd.uci.edu/~gohlke/pytho...
Python modules/packages/libraries for GIS:-
GDAL/OGR, pyqgis, arcpy, pyproj, rsgislib, geopandas, folium, geemap, ipyleaflet, fiona, rasterio, shapely, pyshp, GeoDjango, geopy etc
For more see: https://github.com/sacridini/Awesome-...
https://github.com/giswqs/python-geos...
--------------------- Creating your own Modules -----------------------------
Ways of importing a module
~ import moduleName
~ from moduleName import variable, function, class
~ from moduleName import *
Rename imported module using the 'as' keyword
~ import moduleName as mn
~ from moduleName import variable as v
Avoiding name collision
~ from math import sqrt
~ from cmath import sqrt
Absolute and Relative
https://www.geeksforgeeks.org/absolut...