Skip to content

Commit 37f5588

Browse files
Merge pull request #6 from praisetompane/packaging
docs: overview of Python packaging and distribution
2 parents 3edf3b8 + c0a9478 commit 37f5588

File tree

9 files changed

+197
-48
lines changed

9 files changed

+197
-48
lines changed

.spellcheck_exceptions_dictionary.txt

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ UTF
1010
MYINC
1111
ASGI
1212
WSGI
13+
PAAS
14+
VHD
15+
AMI
16+
FPM
1317

1418

1519
# authors
@@ -45,6 +49,10 @@ classname
4549
dunder
4650
bitwise
4751
executionmodel
52+
userspace
53+
userguide
54+
sdist
55+
exe
4856

4957

5058
# python keywords
@@ -65,6 +73,7 @@ init
6573

6674
# technology:
6775
FastAPI
76+
flexx
6877
gunicorn
6978
JVM
7079
pyspelling
@@ -81,6 +90,22 @@ sqlalchemy
8190
libpq
8291
psycopg
8392
mako
93+
pynsist
94+
snapcraft
95+
virtualenv
96+
zipapp
97+
PEX
98+
macos
99+
osnap
100+
pacman
101+
kivy
102+
homebrew
103+
flatpack
104+
cx
105+
conda
106+
beeware
107+
gz
108+
AppImage
84109

85110

86111
# institutions:
@@ -95,9 +120,11 @@ runestone
95120
stackoverflow
96121
vidhya
97122
redhat
123+
Openstack
98124

99125

100126
# urls:
127+
pkgs
101128
readthedocs
102129
src
103130
txt
@@ -157,12 +184,18 @@ makotemplates
157184
ae
158185

159186

160-
# pythons implementations:
187+
# pythons implementations or runtimes:
161188
CPython
162189
IronPython
163190
jython
164191
pypy
165192
pythonnet
193+
brython
194+
pyscript
195+
Pyodide
196+
MicroPython
197+
CircuitPython
198+
166199

167200
# domain specific - C/Python API
168201
PyTypeObject

1_implementations/0_def.txt

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
1-
Known implementations (Python Software Foundation, 2023):
2-
* CPython: Original and First Python.
3-
Implementations in C.
4-
Compiles/Interprets to machine code.
1+
- known implementations (Python Software Foundation, 2023):
2+
- CPython: Original and First Python.
3+
Implementations in C.
4+
Compiles/Interprets to machine code.
55

6-
* Jython: Python implementations in Java.
7-
Compiles/Interprets to to JVM bytecode
8-
runs on the JVM.
9-
details: https://www.jython.org/index
6+
- Jython: Python implementations in Java.
7+
Compiles/Interprets to to JVM bytecode
8+
runs on the JVM.
9+
details: https://www.jython.org/index
1010

11-
* Python for .Net: CPython running as .NET managed application.
12-
details: https://pythonnet.github.io/
11+
- Python for .Net: CPython running as .NET managed application.
12+
details: https://pythonnet.github.io/
1313

14-
* IronPython: Python Implementations using .NET framework.
15-
Compiles/Interprets to .NET IL(Intermediate Language) and .NET assemblies.
16-
runs on .NET DLR(Dynamic Language Runtime)
17-
details
14+
- IronPython: Python Implementations using .NET framework.
15+
Compiles/Interprets to .NET IL(Intermediate Language) and .NET assemblies.
16+
runs on .NET DLR(Dynamic Language Runtime)
17+
details
1818

19-
* PyPy: Python implementations in Python.
20-
details: https://www.pypy.org/
19+
- PyPy: Python implementations in Python.
20+
details: https://www.pypy.org/
21+
22+
- MicroPython
23+
24+
- Brython: https://github.com/brython-dev/brython
25+
26+
- ports:
27+
- Pyodide: https://github.com/pyodide/pyodide
28+
- platform:
29+
- PyScript: https://github.com/pyscript/pyscript
2130

2231
References:
2332
Python Software Foundation. 2023. The Python Language Reference. https://docs.python.org/3.11/reference/introduction.html#alternate-implementations.
24-
33+
PyPA. 2025. Overview of Python Packaging. https://packaging.python.org/en/latest/overview/

dictionary.dic

1.03 KB
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def: module: a collection of code
2+
1 type of module object
3+
all modules are of this type
4+
independent of technology(e..g python, C, etc)
5+
6+
has:
7+
name
8+
9+
on import:
10+
whole module code ran, top to bottom and left to right
11+
cached in sys.modules

packaging_and_distribution/modules/REAMDE.md renamed to packaging_and_distribution/1_package.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
def: module: a collection of code
2-
1 type of module object
3-
all modules are of this type
4-
independent of technology(e..g python, C, etc)
5-
6-
has:
7-
name
8-
9-
on import:
10-
whole module code ran, top to bottom and left to right
11-
cached in sys.modules
12-
131
def: package: special kind of module for organizing other modules
142
has:
153
__path__ attribute
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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/

packaging_and_distribution/README.md

Lines changed: 0 additions & 18 deletions
This file was deleted.
File renamed without changes.

packaging_and_distribution/modules/troubleshooting.md renamed to packaging_and_distribution/modules/troubleshooting.txt

File renamed without changes.

0 commit comments

Comments
 (0)