PIP - The hardway¶
Overview¶
PIP is **P**ackage **I**nstaller for **P**ython. It's tool recommendation from PyPA to management dependency for application section.
Command¶
PIP has total of 14 commands.
flowchart LR
pip[PIP command]
pip --> install --> 1[Install package]
pip --> unintall --> 2[Uninstall package]
pip --> inspect --> 3[Install package]
pip --> list --> 4[Install package]
pip --> show --> 5[Install package]
pip --> freeze --> 6[Install package]
pip --> check --> 7[Install package]
pip --> download --> 8[Install package]
pip --> wheel --> 9[Install package]
pip --> hash --> 10[Install package]
pip --> search --> 11[Install package]
pip --> cache --> 12[Install package]
pip --> config --> 13[Install package]
pip --> debug --> 14[Install package]
How PIP actually work¶
Architechture¶
Decode PIP architechture design from GitHub codebase
flowchart LR
code[PIP codebase]
code --> i[Internal <_internal>]
code --> v[Vendor <_vendor>]
ref: https://github.com/pypa/pip/tree/main/src/pip/_internal
PIP search package¶
https://pip.pypa.io/en/latest/development/architecture/package-finding/
Cache strategy¶
Target:
The reason why we need cached:
-
Using for dev-mode to reduced built time
-
Using for slim CICD for internal testing purpose
-
Some when deduplication on prod when not changing
Strategy:
-
[1] Follow the Git SHA
-
[2] Follow Git Branch
Implement:
ref: https://pip.pypa.io/en/stable/topics/caching/
Alternative with PIP¶
Tool that alternative with PIP
Recommendation¶
Using with Hash
Reference¶
https://docs.python.org/3/installing/index.html
PIP - Wheel https://realpython.com/python-wheels/