A Python Application describes required packages, entry point and constraints for the operation and development process.
- An entry point, e.g.
my_app.my_module:App
- Constraints for required packages AppR, e.g. {my_app=1.2.3, my_util=0.1.2, pandas=1.2.5, ...}
- A set of development packages Dev = {my_app, pytest, ...}
- [Optional] Constraints for required development packages DevR = {my_app=1.2.3, pytest=6.1.2, nose=3.2.1, ...}
┌───────────────────────┐ ┌──────────────────────┐
│ │ │ │
│ App │ │ Dev │
│ │ │ │
│ my_app.my_module:App │ │ my_app, pytest, ... │
│ constraints │ │ constraints │
│ │ │ │
└───────────┬───────────┘ └──────────┬───────────┘
│ │
│ │
│ generate │ generate
│ │
│ │
│ │
┌───────────▼───────────┐ ┌──────────▼───────────┐
│ │ │ │
│ AppR │ │ DevR │
│ │ │ │
│ App Requirements │ │ Dev Requirements │
│ │ │ │
└───────────────────────┘ └──────────────────────┘
- From App definition (1)-(2), generate a set of fixed required packages AppR.
- Being able to install set AppR incrementally.
- From Dev definition (1)-(2), generate a set of fixed required packages DevR.
- Being able to install set DevR incrementally.
- Do not devops with a git deploy workflow.
- Use
pip-compile
to resolve dependencies and generate an initialrequirements.txt
. Version control and curate this file: It is your App! - Use
flit
to build (and deploy) packages. - When building packages, inject the build version into
pyproject.toml
from the current git tag.
- The generated fixed required packages will generally depend on the world, i.e. on the state of PyPI at the time of generation.
- https://modelpredict.com/python-dependency-management-tools
👍pip-compile both has dependency resolution without install and supports layered requirements workflow.
👎pip-sync only works in the context of a venv.