|
| 1 | +packaging considerations: target environment + deployment experience |
| 2 | + - target audience: |
| 3 | + - developers |
| 4 | + - data center operators |
| 5 | + - non technical end users |
| 6 | + - ... |
| 7 | + - runtime environment: |
| 8 | + - servers |
| 9 | + - mobile devices |
| 10 | + - embedded systems |
| 11 | + - ... |
| 12 | + - deployment mechanism: |
| 13 | + - one software install |
| 14 | + - large deployment batches |
| 15 | + - ... |
| 16 | + |
| 17 | + |
| 18 | +packaging scenarios: |
| 19 | + - libraries & tools: |
| 20 | + - target audience = developers AND runtime environment = development setting. |
| 21 | + - approaches: |
| 22 | + - python module: |
| 23 | + - properties: |
| 24 | + - constraints: |
| 25 | + - only depends on the standard library. |
| 26 | + - required python installed on runtime environment. |
| 27 | + - use cases: a single pure python file. |
| 28 | + - examples: |
| 29 | + - bottle.py |
| 30 | + |
| 31 | + - python source distributions: |
| 32 | + - properties: |
| 33 | + - specification: https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-format |
| 34 | + - constraints: |
| 35 | + - required python installed on runtime environment. |
| 36 | + - format: compressed zip(*.tar.gz) |
| 37 | + - alternative names: |
| 38 | + - sdist |
| 39 | + - remarks: this is Python's native distribution format. |
| 40 | + - use cases: |
| 41 | + - a collection of pure python files. |
| 42 | + |
| 43 | + - python binary distributions: |
| 44 | + - properties: |
| 45 | + - specification: https://packaging.python.org/en/latest/specifications/binary-distribution-format/#binary-distribution-format |
| 46 | + - constraints: |
| 47 | + - required python installed on runtime environment. |
| 48 | + - implementation: wheel |
| 49 | + - recommendation: default to publishing BOTH wheel and sdist archives. |
| 50 | + - remarks: |
| 51 | + - pip prefers wheel format for speed, even for source distributions. |
| 52 | + - use cases: |
| 53 | + - pure python files and compiled dependencies written in(C,C++,FORTRAN, Rust, etc) |
| 54 | + |
| 55 | + - python applications: |
| 56 | + - target audience: non-technical end users AND runtime environment = end user machines. |
| 57 | + - key: selection of tools is reasoned from dependence on the runtime environment. |
| 58 | + - console scripts(i.e. terminal programs) or plugin extensible apps: |
| 59 | + - entry points: https://setuptools.pypa.io/en/latest/userguide/entry_point.html |
| 60 | + - approaches: |
| 61 | + - depend on a framework: use the framework's/platform's packaging tools and conventions. |
| 62 | + - examples: |
| 63 | + - Platform-as-a-Service(PAAS) |
| 64 | + - web browsers: |
| 65 | + - https://brython.info |
| 66 | + - mobile applications |
| 67 | + - cross_platform: |
| 68 | + - https://beeware.org |
| 69 | + - https://github.com/kivy |
| 70 | + |
| 71 | + - depend on a preexisting Python installation: use existing Python on the target runtime environment |
| 72 | + - examples: |
| 73 | + - Python Executable (PEX) |
| 74 | + - zipapp |
| 75 | + - shiv |
| 76 | + |
| 77 | + - depend on a separate software distribution ecosystem: |
| 78 | + - python application packages(akin to apt, homebrew, pacman etc.): |
| 79 | + - Anaconda |
| 80 | + - packaging with Anaconda: https://docs.conda.io/projects/conda-build/en/latest/user-guide/tutorials/index.html |
| 81 | + - native Python to Anaconda: https://conda.io/projects/conda-build/en/latest/user-guide/tutorials/build-pkgs-skeleton.html |
| 82 | + |
| 83 | + - bring your own Python executable: |
| 84 | + - properties: |
| 85 | + - usually involves bundling the interpreter into the executable. |
| 86 | + - freezing: package Python programs in a format native to the target runtime(e.g. OS) |
| 87 | + - tools(i.e. freezers): |
| 88 | + - single-user deployment: |
| 89 | + - cross_platform: |
| 90 | + - py_installer |
| 91 | + - cx_freeze |
| 92 | + - constructor |
| 93 | + - macos: |
| 94 | + - py2app |
| 95 | + - windows: |
| 96 | + - py2exe |
| 97 | + - pynsist |
| 98 | + - only windows and macos: |
| 99 | + - osnap |
| 100 | + - multi-user deployment: |
| 101 | + - chef omnibus |
| 102 | + |
| 103 | + - bring your own userspace: Operating-System-Level virtualization or Containerization |
| 104 | + - tools: |
| 105 | + - AppImage |
| 106 | + - Docker |
| 107 | + - flatpack |
| 108 | + - snapcraft |
| 109 | + |
| 110 | + - bring your own kernel: classical virtualization |
| 111 | + - tools: |
| 112 | + - Vagrant |
| 113 | + - Virtual Hard Disk(VHD), Amazon Machine Image(AMI) |
| 114 | + - Openstack |
| 115 | + |
| 116 | + - bring your own hardware: Python programs bundled with the hardware as a deployment unit: |
| 117 | + - tools: |
| 118 | + - MicroPython and CircuitPython for small devices and embedded devices |
| 119 | + - Conventional hardware to install in data centers. |
| 120 | + |
| 121 | + - other approaches: |
| 122 | + - operating system packages(i.e. deb, rpm, etc): |
| 123 | + - tools: FPM |
| 124 | + - virtualenv |
| 125 | +References: |
| 126 | + PyPA. 2025. Overview of Python Packaging. https://packaging.python.org/en/latest/overview/ |
0 commit comments