snugpy 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snugpy-0.1.0.data/data/share/snugpy/configs/distributions.toml +179 -0
- snugpy-0.1.0.data/data/share/snugpy/configs/profiles.toml +79 -0
- snugpy-0.1.0.data/data/share/snugpy/configs/release-selection.toml +7 -0
- snugpy-0.1.0.data/data/share/snugpy/configs/targets.toml +51 -0
- snugpy-0.1.0.data/data/share/snugpy/configs/versions.toml +17 -0
- snugpy-0.1.0.dist-info/METADATA +338 -0
- snugpy-0.1.0.dist-info/RECORD +27 -0
- snugpy-0.1.0.dist-info/WHEEL +5 -0
- snugpy-0.1.0.dist-info/entry_points.txt +2 -0
- snugpy-0.1.0.dist-info/licenses/LICENSE +21 -0
- snugpy-0.1.0.dist-info/licenses/THIRD_PARTY_LICENSES.md +57 -0
- snugpy-0.1.0.dist-info/licenses/licenses/CPython-PSF-LICENSE.txt +277 -0
- snugpy-0.1.0.dist-info/top_level.txt +1 -0
- snugpy_build/__init__.py +3 -0
- snugpy_build/build.py +411 -0
- snugpy_build/cli.py +227 -0
- snugpy_build/config.py +317 -0
- snugpy_build/distributions.py +125 -0
- snugpy_build/metrics.py +536 -0
- snugpy_build/package.py +402 -0
- snugpy_build/paths.py +105 -0
- snugpy_build/profiles.py +209 -0
- snugpy_build/report.py +361 -0
- snugpy_build/resources.py +38 -0
- snugpy_build/source.py +302 -0
- snugpy_build/util.py +328 -0
- snugpy_build/validate.py +557 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
schema_version = 1
|
|
2
|
+
default = "headless"
|
|
3
|
+
|
|
4
|
+
[variants.headless]
|
|
5
|
+
description = "Runtime without tests, development archives, IDLE, or Tk GUI support."
|
|
6
|
+
exclude = [
|
|
7
|
+
"lib/python*/test",
|
|
8
|
+
"lib/python*/idlelib",
|
|
9
|
+
"lib/python*/tkinter",
|
|
10
|
+
"lib/python*/lib-dynload/_tkinter*",
|
|
11
|
+
"lib/python*/lib-dynload/_test*",
|
|
12
|
+
"lib/python*/lib-dynload/_ctypes_test*",
|
|
13
|
+
"lib/python*/lib-dynload/xxlimited*",
|
|
14
|
+
"lib/python*/lib-dynload/xxsubtype*",
|
|
15
|
+
"lib/python*/lib-dynload/_xxtestfuzz*",
|
|
16
|
+
"lib/python*/config-*/libpython*.a",
|
|
17
|
+
"lib/libpython*.a",
|
|
18
|
+
"lib/python*/config-*/python.o",
|
|
19
|
+
"bin/idle*",
|
|
20
|
+
]
|
|
21
|
+
smoke_imports = ["ssl", "sqlite3", "ctypes"]
|
|
22
|
+
|
|
23
|
+
[variants.headed]
|
|
24
|
+
description = "Runtime with IDLE and Tk GUI support, without tests or development archives."
|
|
25
|
+
exclude = [
|
|
26
|
+
"lib/python*/test",
|
|
27
|
+
"lib/python*/lib-dynload/_test*",
|
|
28
|
+
"lib/python*/lib-dynload/_ctypes_test*",
|
|
29
|
+
"lib/python*/lib-dynload/xxlimited*",
|
|
30
|
+
"lib/python*/lib-dynload/xxsubtype*",
|
|
31
|
+
"lib/python*/lib-dynload/_xxtestfuzz*",
|
|
32
|
+
"lib/python*/config-*/libpython*.a",
|
|
33
|
+
"lib/libpython*.a",
|
|
34
|
+
"lib/python*/config-*/python.o",
|
|
35
|
+
]
|
|
36
|
+
smoke_imports = ["ssl", "sqlite3", "ctypes", "tkinter"]
|
|
37
|
+
|
|
38
|
+
[variants.test]
|
|
39
|
+
description = "Complete installation including the CPython test suite and development files."
|
|
40
|
+
exclude = []
|
|
41
|
+
smoke_imports = ["ssl", "sqlite3", "ctypes", "test"]
|
|
42
|
+
|
|
43
|
+
[variants.micro]
|
|
44
|
+
description = "Runtime-only: no package installer, tests, docs, headers, or development files."
|
|
45
|
+
exclude = [
|
|
46
|
+
"lib/python*/test",
|
|
47
|
+
"lib/python*/idlelib",
|
|
48
|
+
"lib/python*/tkinter",
|
|
49
|
+
"lib/python*/lib-dynload/_tkinter*",
|
|
50
|
+
"lib/python*/ensurepip",
|
|
51
|
+
"lib/python*/site-packages",
|
|
52
|
+
"lib/python*/pydoc_data",
|
|
53
|
+
"lib/python*/unittest",
|
|
54
|
+
"lib/python*/turtledemo",
|
|
55
|
+
"lib/python*/venv",
|
|
56
|
+
"lib/python*/config-*",
|
|
57
|
+
"lib/python*/lib-dynload/_test*",
|
|
58
|
+
"lib/python*/lib-dynload/_curses*",
|
|
59
|
+
"lib/python*/lib-dynload/_dbm*",
|
|
60
|
+
"lib/python*/lib-dynload/_gdbm*",
|
|
61
|
+
"lib/python*/lib-dynload/readline*",
|
|
62
|
+
"lib/python*/lib-dynload/xxlimited*",
|
|
63
|
+
"lib/python*/lib-dynload/_xxtestfuzz*",
|
|
64
|
+
"include",
|
|
65
|
+
"share",
|
|
66
|
+
"lib/pkgconfig",
|
|
67
|
+
"lib/libpython*.a",
|
|
68
|
+
"bin/pip*",
|
|
69
|
+
"bin/idle*",
|
|
70
|
+
"bin/python*-config",
|
|
71
|
+
]
|
|
72
|
+
smoke_imports = ["ssl", "sqlite3", "ctypes", "json", "asyncio"]
|
|
73
|
+
|
|
74
|
+
[variants.nano]
|
|
75
|
+
description = "Micro runtime without precompiled bytecode; modules compile on first import."
|
|
76
|
+
exclude = [
|
|
77
|
+
"lib/python*/test",
|
|
78
|
+
"lib/python*/idlelib",
|
|
79
|
+
"lib/python*/tkinter",
|
|
80
|
+
"lib/python*/lib-dynload/_tkinter*",
|
|
81
|
+
"lib/python*/ensurepip",
|
|
82
|
+
"lib/python*/site-packages",
|
|
83
|
+
"lib/python*/pydoc_data",
|
|
84
|
+
"lib/python*/unittest",
|
|
85
|
+
"lib/python*/turtledemo",
|
|
86
|
+
"lib/python*/venv",
|
|
87
|
+
"lib/python*/config-*",
|
|
88
|
+
"lib/python*/lib-dynload/_test*",
|
|
89
|
+
"lib/python*/lib-dynload/_curses*",
|
|
90
|
+
"lib/python*/lib-dynload/_dbm*",
|
|
91
|
+
"lib/python*/lib-dynload/_gdbm*",
|
|
92
|
+
"lib/python*/lib-dynload/readline*",
|
|
93
|
+
"lib/python*/lib-dynload/xxlimited*",
|
|
94
|
+
"lib/python*/lib-dynload/_xxtestfuzz*",
|
|
95
|
+
"lib/python*/__pycache__",
|
|
96
|
+
"include",
|
|
97
|
+
"share",
|
|
98
|
+
"lib/pkgconfig",
|
|
99
|
+
"lib/libpython*.a",
|
|
100
|
+
"bin/pip*",
|
|
101
|
+
"bin/idle*",
|
|
102
|
+
"bin/python*-config",
|
|
103
|
+
]
|
|
104
|
+
smoke_imports = ["ssl", "sqlite3", "ctypes", "json", "asyncio"]
|
|
105
|
+
|
|
106
|
+
[variants.runtime]
|
|
107
|
+
description = "Micro layout with preinstalled site-packages, but no pip or ensurepip."
|
|
108
|
+
exclude = [
|
|
109
|
+
"lib/python*/test",
|
|
110
|
+
"lib/python*/idlelib",
|
|
111
|
+
"lib/python*/tkinter",
|
|
112
|
+
"lib/python*/lib-dynload/_tkinter*",
|
|
113
|
+
"lib/python*/ensurepip",
|
|
114
|
+
"lib/python*/pydoc_data",
|
|
115
|
+
"lib/python*/unittest",
|
|
116
|
+
"lib/python*/turtledemo",
|
|
117
|
+
"lib/python*/venv",
|
|
118
|
+
"lib/python*/config-*",
|
|
119
|
+
"lib/python*/lib-dynload/_test*",
|
|
120
|
+
"lib/python*/lib-dynload/_curses*",
|
|
121
|
+
"lib/python*/lib-dynload/_dbm*",
|
|
122
|
+
"lib/python*/lib-dynload/_gdbm*",
|
|
123
|
+
"lib/python*/lib-dynload/readline*",
|
|
124
|
+
"lib/python*/lib-dynload/xxlimited*",
|
|
125
|
+
"lib/python*/lib-dynload/_xxtestfuzz*",
|
|
126
|
+
"lib/python*/site-packages/pip",
|
|
127
|
+
"lib/python*/site-packages/pip-*.dist-info",
|
|
128
|
+
"lib/python*/site-packages/setuptools",
|
|
129
|
+
"lib/python*/site-packages/setuptools-*.dist-info",
|
|
130
|
+
"lib/python*/site-packages/pkg_resources",
|
|
131
|
+
"lib/python*/site-packages/_distutils_hack",
|
|
132
|
+
"lib/python*/site-packages/distutils-precedence.pth",
|
|
133
|
+
"include",
|
|
134
|
+
"share",
|
|
135
|
+
"lib/pkgconfig",
|
|
136
|
+
"lib/libpython*.a",
|
|
137
|
+
"bin/pip*",
|
|
138
|
+
"bin/idle*",
|
|
139
|
+
"bin/python*-config",
|
|
140
|
+
]
|
|
141
|
+
smoke_imports = ["ssl", "sqlite3", "ctypes", "json", "asyncio"]
|
|
142
|
+
|
|
143
|
+
[variants.runtime-nano]
|
|
144
|
+
description = "Runtime layout without precompiled bytecode; modules compile on first import."
|
|
145
|
+
exclude = [
|
|
146
|
+
"lib/python*/test",
|
|
147
|
+
"lib/python*/idlelib",
|
|
148
|
+
"lib/python*/tkinter",
|
|
149
|
+
"lib/python*/lib-dynload/_tkinter*",
|
|
150
|
+
"lib/python*/ensurepip",
|
|
151
|
+
"lib/python*/pydoc_data",
|
|
152
|
+
"lib/python*/unittest",
|
|
153
|
+
"lib/python*/turtledemo",
|
|
154
|
+
"lib/python*/venv",
|
|
155
|
+
"lib/python*/config-*",
|
|
156
|
+
"lib/python*/lib-dynload/_test*",
|
|
157
|
+
"lib/python*/lib-dynload/_curses*",
|
|
158
|
+
"lib/python*/lib-dynload/_dbm*",
|
|
159
|
+
"lib/python*/lib-dynload/_gdbm*",
|
|
160
|
+
"lib/python*/lib-dynload/readline*",
|
|
161
|
+
"lib/python*/lib-dynload/xxlimited*",
|
|
162
|
+
"lib/python*/lib-dynload/_xxtestfuzz*",
|
|
163
|
+
"lib/python*/__pycache__",
|
|
164
|
+
"lib/python*/site-packages/pip",
|
|
165
|
+
"lib/python*/site-packages/pip-*.dist-info",
|
|
166
|
+
"lib/python*/site-packages/setuptools",
|
|
167
|
+
"lib/python*/site-packages/setuptools-*.dist-info",
|
|
168
|
+
"lib/python*/site-packages/pkg_resources",
|
|
169
|
+
"lib/python*/site-packages/_distutils_hack",
|
|
170
|
+
"lib/python*/site-packages/distutils-precedence.pth",
|
|
171
|
+
"include",
|
|
172
|
+
"share",
|
|
173
|
+
"lib/pkgconfig",
|
|
174
|
+
"lib/libpython*.a",
|
|
175
|
+
"bin/pip*",
|
|
176
|
+
"bin/idle*",
|
|
177
|
+
"bin/python*-config",
|
|
178
|
+
]
|
|
179
|
+
smoke_imports = ["ssl", "sqlite3", "ctypes", "json", "asyncio"]
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
schema_version = 1
|
|
2
|
+
|
|
3
|
+
[profiles.baseline]
|
|
4
|
+
description = "Upstream default optimization with shared libpython"
|
|
5
|
+
cc = "gcc"
|
|
6
|
+
cxx = "g++"
|
|
7
|
+
configure = ["--enable-shared", "--with-ensurepip=install"]
|
|
8
|
+
cflags = ""
|
|
9
|
+
cppflags = ""
|
|
10
|
+
cxxflags = ""
|
|
11
|
+
ldflags = ""
|
|
12
|
+
experimental = false
|
|
13
|
+
|
|
14
|
+
[profiles.size]
|
|
15
|
+
description = "Size-oriented code generation with shared libpython"
|
|
16
|
+
cc = "gcc"
|
|
17
|
+
cxx = "g++"
|
|
18
|
+
configure = ["--enable-shared", "--with-ensurepip=install"]
|
|
19
|
+
cflags = "-Os"
|
|
20
|
+
cppflags = ""
|
|
21
|
+
cxxflags = ""
|
|
22
|
+
ldflags = ""
|
|
23
|
+
experimental = false
|
|
24
|
+
|
|
25
|
+
[profiles.lto]
|
|
26
|
+
description = "Size optimization plus link-time optimization"
|
|
27
|
+
cc = "gcc"
|
|
28
|
+
cxx = "g++"
|
|
29
|
+
configure = ["--enable-shared", "--with-ensurepip=install", "--with-lto"]
|
|
30
|
+
cflags = "-Os"
|
|
31
|
+
cppflags = ""
|
|
32
|
+
cxxflags = ""
|
|
33
|
+
ldflags = ""
|
|
34
|
+
experimental = false
|
|
35
|
+
|
|
36
|
+
[profiles.static]
|
|
37
|
+
description = "Static libpython linkage into the executable"
|
|
38
|
+
cc = "gcc"
|
|
39
|
+
cxx = "g++"
|
|
40
|
+
configure = ["--disable-shared", "--with-ensurepip=install"]
|
|
41
|
+
cflags = "-Os"
|
|
42
|
+
cppflags = ""
|
|
43
|
+
cxxflags = ""
|
|
44
|
+
ldflags = ""
|
|
45
|
+
experimental = false
|
|
46
|
+
|
|
47
|
+
[profiles."clang-oz"]
|
|
48
|
+
description = "Aggressive size-oriented code generation with Clang"
|
|
49
|
+
cc = "clang"
|
|
50
|
+
cxx = "clang++"
|
|
51
|
+
configure = ["--enable-shared", "--with-ensurepip=install"]
|
|
52
|
+
cflags = "-Oz"
|
|
53
|
+
cppflags = ""
|
|
54
|
+
cxxflags = ""
|
|
55
|
+
ldflags = ""
|
|
56
|
+
experimental = true
|
|
57
|
+
|
|
58
|
+
[profiles.lean]
|
|
59
|
+
description = "Clang -Oz with docstrings removed and unused sections discarded"
|
|
60
|
+
cc = "clang"
|
|
61
|
+
cxx = "clang++"
|
|
62
|
+
configure = ["--enable-shared", "--with-ensurepip=install", "--without-doc-strings"]
|
|
63
|
+
cflags = "-Oz -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-ident"
|
|
64
|
+
cppflags = ""
|
|
65
|
+
cxxflags = ""
|
|
66
|
+
ldflags = "-Wl,--gc-sections -Wl,--build-id=none"
|
|
67
|
+
experimental = true
|
|
68
|
+
|
|
69
|
+
[profiles."static-lean"]
|
|
70
|
+
description = "Static libpython with Clang -Oz, Debian system external libs, non-PIE link, safe LLD ICF, and no unwind tables"
|
|
71
|
+
cc = "clang"
|
|
72
|
+
cxx = "clang++"
|
|
73
|
+
configure = ["--disable-shared", "--with-ensurepip=install", "--without-doc-strings"]
|
|
74
|
+
cflags = "--no-default-config --gcc-toolchain=/usr -Oz -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-ident -fvisibility=hidden -fno-semantic-interposition"
|
|
75
|
+
cppflags = ""
|
|
76
|
+
cxxflags = "--no-default-config --gcc-toolchain=/usr -Oz -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-ident -fvisibility=hidden -fvisibility-inlines-hidden -fno-semantic-interposition"
|
|
77
|
+
ldflags = "--no-default-config --gcc-toolchain=/usr -fuse-ld=lld -no-pie -Wl,--gc-sections -Wl,--icf=safe -Wl,--build-id=none -Wl,--as-needed -Wl,--export-dynamic -Wl,-O2"
|
|
78
|
+
external_libs = "system"
|
|
79
|
+
experimental = true
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
schema_version = 1
|
|
2
|
+
|
|
3
|
+
[targets."linux-x86_64"]
|
|
4
|
+
platform = "linux"
|
|
5
|
+
arch = "x86_64"
|
|
6
|
+
runner = "ubuntu-24.04"
|
|
7
|
+
container_image = "debian:bookworm"
|
|
8
|
+
glibc_baseline = "2.36"
|
|
9
|
+
apt_packages = [
|
|
10
|
+
"binutils",
|
|
11
|
+
"build-essential",
|
|
12
|
+
"ca-certificates",
|
|
13
|
+
"clang",
|
|
14
|
+
"curl",
|
|
15
|
+
"file",
|
|
16
|
+
"g++",
|
|
17
|
+
"gcc",
|
|
18
|
+
"git",
|
|
19
|
+
"gzip",
|
|
20
|
+
"hyperfine",
|
|
21
|
+
"libbrotli-dev",
|
|
22
|
+
"libbz2-dev",
|
|
23
|
+
"libdb-dev",
|
|
24
|
+
"libexpat1-dev",
|
|
25
|
+
"libffi-dev",
|
|
26
|
+
"libgdbm-compat-dev",
|
|
27
|
+
"libgdbm-dev",
|
|
28
|
+
"liblzma-dev",
|
|
29
|
+
"libncurses-dev",
|
|
30
|
+
"libreadline-dev",
|
|
31
|
+
"libsqlite3-dev",
|
|
32
|
+
"libssl-dev",
|
|
33
|
+
"libzstd-dev",
|
|
34
|
+
"lld",
|
|
35
|
+
"llvm",
|
|
36
|
+
"make",
|
|
37
|
+
"netbase",
|
|
38
|
+
"patch",
|
|
39
|
+
"patchelf",
|
|
40
|
+
"pkg-config",
|
|
41
|
+
"python3",
|
|
42
|
+
"python3-pip",
|
|
43
|
+
"python3-venv",
|
|
44
|
+
"tar",
|
|
45
|
+
"time",
|
|
46
|
+
"tk-dev",
|
|
47
|
+
"uuid-dev",
|
|
48
|
+
"xz-utils",
|
|
49
|
+
"zlib1g-dev",
|
|
50
|
+
]
|
|
51
|
+
notes = "Conda profiles build on the Ubuntu runner. The static-lean profile builds in Debian 12 against system libraries and targets glibc 2.36. Verify artifact symbol requirements with objdump -T before any release claim."
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
schema_version = 1
|
|
2
|
+
|
|
3
|
+
[zerodep]
|
|
4
|
+
repo = "https://github.com/Oaklight/zerodep.git"
|
|
5
|
+
tag = "v2026.11.20"
|
|
6
|
+
commit = "9f872e8d652272c34600b9fda6448fe4fd4436c3"
|
|
7
|
+
requires_python = ">=3.10"
|
|
8
|
+
notes = "Pinned for compatibility tests. Do not edit the zerodep source tree."
|
|
9
|
+
|
|
10
|
+
[versions."3.14"]
|
|
11
|
+
enabled = true
|
|
12
|
+
version = "3.14.9"
|
|
13
|
+
tag = "v3.14.9"
|
|
14
|
+
url = "https://www.python.org/ftp/python/3.14.9/Python-3.14.9.tar.xz"
|
|
15
|
+
sha256 = "e02d9ac21cebda6e46435369744a92c65cc7cd8669697694122cf97ffacd1e53"
|
|
16
|
+
git_commit = "ead82c07db1f111d613926ed1b6667411d768125"
|
|
17
|
+
source_dir = "sources/cpython-3.14.9"
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snugpy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Build and measure compact, full-compatibility CPython distributions
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Repository, https://github.com/Oaklight/snugpy
|
|
7
|
+
Project-URL: Issues, https://github.com/Oaklight/snugpy/issues
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
License-File: THIRD_PARTY_LICENSES.md
|
|
19
|
+
License-File: licenses/CPython-PSF-LICENSE.txt
|
|
20
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# SnugPy
|
|
24
|
+
|
|
25
|
+
**Whole Python. Small footprint.**
|
|
26
|
+
|
|
27
|
+
SnugPy builds compact, deployable Python runtimes and measures each candidate
|
|
28
|
+
against a full CPython baseline. It starts from pinned upstream CPython rather
|
|
29
|
+
than reimplementing the language, so compatibility comes first. Every profile
|
|
30
|
+
build preserves the standard library, `ensurepip`, `venv`, `idlelib`, `tkinter`,
|
|
31
|
+
`test`, and optional native extensions. Packaging then derives seven deployable
|
|
32
|
+
variants from the same stripped tree: `headless`, `headed`, `test`, `micro`,
|
|
33
|
+
`nano`, `runtime`, and `runtime-nano`. The `micro`, `nano`, `runtime`, and
|
|
34
|
+
`runtime-nano` variants drop the installer, headers, docs, and development files
|
|
35
|
+
for runtime-only sandboxes.
|
|
36
|
+
|
|
37
|
+
**Status:** 0.1.0. `static-lean` on `linux-x86_64` passed the full CPython
|
|
38
|
+
3.14.9 regression suite and the `zerodep` tests with network access. The other
|
|
39
|
+
profiles remain experimental. GitHub Actions is the build, verification, and
|
|
40
|
+
release path.
|
|
41
|
+
|
|
42
|
+
## Origin
|
|
43
|
+
|
|
44
|
+
SnugPy started from the same observation as MicroPython and PocketPy: most
|
|
45
|
+
deployments do not need the full CPython source tree or every development
|
|
46
|
+
artifact. Unlike those projects, SnugPy starts from CPython to keep full
|
|
47
|
+
compatibility, then removes deployment-irrelevant parts. Future work may modify
|
|
48
|
+
the interpreter more aggressively; the name does not promise an unmodified
|
|
49
|
+
CPython.
|
|
50
|
+
|
|
51
|
+
## Version policy
|
|
52
|
+
|
|
53
|
+
The compatibility floor for the SnugPy tooling and for `zerodep` is Python 3.10.
|
|
54
|
+
That does **not** mean SnugPy must build or distribute CPython 3.10, 3.11, 3.12,
|
|
55
|
+
and 3.13. CPython has a different ABI in each minor release. The initial target
|
|
56
|
+
is one pinned CPython 3.14 maintenance release. A future version is added as its
|
|
57
|
+
own pinned source, build matrix, and release decision; compiled objects,
|
|
58
|
+
prefixes, and configuration are never shared between versions.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
The `snugpy` package on PyPI is the build and measurement tool, not the
|
|
63
|
+
interpreter runtime. Use a distribution archive or a Docker image for the
|
|
64
|
+
runtime.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
python -m pip install snugpy
|
|
68
|
+
snugpy list
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The installed CLI reads configuration bundled in the wheel and writes build
|
|
72
|
+
outputs under the current directory. Running from a clone uses that clone's
|
|
73
|
+
`configs/` instead.
|
|
74
|
+
|
|
75
|
+
### Docker Hub
|
|
76
|
+
|
|
77
|
+
Runtime images are published at
|
|
78
|
+
[`oaklight/snugpy`](https://hub.docker.com/r/oaklight/snugpy). They are
|
|
79
|
+
`linux/amd64` only.
|
|
80
|
+
|
|
81
|
+
| Tag | Distribution | Base | Shell | pip |
|
|
82
|
+
| --- | --- | --- | --- | --- |
|
|
83
|
+
| `0.1.0`, `latest` | `runtime-nano` | `scratch` | no | no |
|
|
84
|
+
| `0.1.0-runtime` | `runtime` | `scratch` | no | no |
|
|
85
|
+
| `0.1.0-distroless` | `runtime` | distroless `cc-debian12` | no | no |
|
|
86
|
+
| `0.1.0-debian` | `runtime` | Debian 12 slim | yes | no |
|
|
87
|
+
|
|
88
|
+
`runtime` keeps preinstalled `site-packages` and precompiled bytecode.
|
|
89
|
+
`runtime-nano` removes precompiled bytecode, so it starts smaller but compiles
|
|
90
|
+
modules on first import. The scratch images run as UID 65532 and contain no
|
|
91
|
+
shell or package manager.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
docker run --rm --entrypoint python3.14 oaklight/snugpy:0.1.0 \
|
|
95
|
+
-c 'import ssl, sqlite3; print("runtime-ok")'
|
|
96
|
+
|
|
97
|
+
docker run --rm --entrypoint python3.14 oaklight/snugpy:0.1.0-debian \
|
|
98
|
+
-c 'import ssl, sqlite3; print("runtime-ok")'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The release workflow builds, smoke-tests, and pushes these tags. It does not
|
|
102
|
+
publish multi-architecture manifests.
|
|
103
|
+
|
|
104
|
+
## Quick start
|
|
105
|
+
|
|
106
|
+
The toolchain is a conda-forge environment. It contains Python 3.12, GCC 16,
|
|
107
|
+
Clang 23, `lld`, binutils, `patchelf`, `hyperfine`, GNU `time`, ShellCheck,
|
|
108
|
+
`go-shfmt`, and the libraries needed by CPython's optional extensions.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
git clone git@github.com:Oaklight/snugpy.git
|
|
112
|
+
cd snugpy
|
|
113
|
+
|
|
114
|
+
# New prefixes are created from the exact lock file when it exists.
|
|
115
|
+
./scripts/setup-conda.sh "$HOME/ml_lab/envs/snugpy"
|
|
116
|
+
|
|
117
|
+
source "$(conda info --base)/etc/profile.d/conda.sh"
|
|
118
|
+
conda activate "$HOME/ml_lab/envs/snugpy"
|
|
119
|
+
|
|
120
|
+
./scripts/check-deps.sh
|
|
121
|
+
./scripts/fetch.sh 3.14 --zerodep
|
|
122
|
+
./scripts/build.sh 3.14 baseline linux-x86_64
|
|
123
|
+
./scripts/test.sh 3.14 baseline linux-x86_64 --smoke
|
|
124
|
+
./scripts/package.sh 3.14 baseline linux-x86_64
|
|
125
|
+
./scripts/measure.sh 3.14 baseline linux-x86_64 --runs 10
|
|
126
|
+
./scripts/report.sh
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`scripts/setup-conda.sh` prefers `conda-linux-64.lock` for a new prefix. It
|
|
130
|
+
falls back to `environment.yml`, and it updates an existing prefix from
|
|
131
|
+
`environment.yml`. Set `SNUGPY_CONDA_USE_LOCK=0` to force the YAML path.
|
|
132
|
+
|
|
133
|
+
`scripts/package.sh` copies the install prefix once, strips debug symbols from
|
|
134
|
+
ELF binaries, relocatable objects, and static archives in the staging tree, and
|
|
135
|
+
writes deterministic `tar.xz` archives for every configured distribution. The
|
|
136
|
+
original `out/` prefix keeps its symbols for debugging. Run packaging before
|
|
137
|
+
measurement so the report can record archive and stripped installation sizes.
|
|
138
|
+
Use `--distribution headless` to build one variant while iterating; repeated
|
|
139
|
+
flags select several.
|
|
140
|
+
|
|
141
|
+
To use the environment without activating it, which is how CI runs builds:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
export SNUGPY_CONDA_PREFIX="$HOME/ml_lab/envs/snugpy"
|
|
145
|
+
export PATH="$SNUGPY_CONDA_PREFIX/bin:$PATH"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`SNUGPY_CONDA_PREFIX` takes precedence over `CONDA_PREFIX`. Conda activation
|
|
149
|
+
exports optimized and hardened `CFLAGS`, `CPPFLAGS`, and `LDFLAGS`; SnugPy
|
|
150
|
+
discards those values and supplies only the selected profile flags plus the
|
|
151
|
+
conda include and library paths. This keeps `baseline` and the size profiles
|
|
152
|
+
comparable.
|
|
153
|
+
|
|
154
|
+
Regenerate the lock after an intentional environment change:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
./scripts/lock-conda.sh "$HOME/ml_lab/envs/snugpy"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Profiles
|
|
161
|
+
|
|
162
|
+
| Profile | Compiler | Configuration | Purpose |
|
|
163
|
+
| --- | --- | --- | --- |
|
|
164
|
+
| `baseline` | GCC | upstream default optimization, shared libpython | Reference build |
|
|
165
|
+
| `size` | GCC `-Os` | shared libpython | Size-oriented code generation |
|
|
166
|
+
| `lto` | GCC `-Os` | `--with-lto`, shared libpython | Size plus link-time optimization |
|
|
167
|
+
| `static` | GCC `-Os` | `--disable-shared` | Static libpython linkage; not a fully static system binary |
|
|
168
|
+
| `clang-oz` | Clang `-Oz` | shared libpython | Aggressive size experiment |
|
|
169
|
+
| `lean` | Clang `-Oz` | shared libpython, `--without-doc-strings`, `--gc-sections` | Smallest shared experiment; removes C docstrings and unwind tables |
|
|
170
|
+
| `static-lean` | Clang `-Oz` | `--disable-shared`, `--without-doc-strings`, non-PIE, safe LLD ICF, Debian 12 system libraries | Smallest deployment core; non-PIE link, hidden symbols, no unwind tables, section GC |
|
|
171
|
+
|
|
172
|
+
`static-lean` links the interpreter as a non-PIE executable. This removes
|
|
173
|
+
dynamic relocations and shrinks the core, but it disables address-space layout
|
|
174
|
+
randomization for the interpreter process. Use it only where container or VM
|
|
175
|
+
isolation is the security boundary. It is also the only profile linked against
|
|
176
|
+
Debian 12 system libraries instead of conda-forge libraries.
|
|
177
|
+
|
|
178
|
+
The consolidated profile and distribution sizes are in
|
|
179
|
+
`docs/version-matrix.md`. External library and image details are in
|
|
180
|
+
`docs/runtime-libraries.md`.
|
|
181
|
+
|
|
182
|
+
Each profile has a separate work tree, install prefix, logs, and result
|
|
183
|
+
directory. A profile is release-eligible only after full CPython regression
|
|
184
|
+
tests, zerodep tests, ABI checks, stdlib inventory checks, and measurements
|
|
185
|
+
pass. Measurement reports a Pareto frontier; the smallest build is not selected
|
|
186
|
+
automatically.
|
|
187
|
+
|
|
188
|
+
## Distributions
|
|
189
|
+
|
|
190
|
+
Every profile produces a complete install prefix. Packaging derives seven
|
|
191
|
+
archives from one stripped staging tree, so the profile result and all variants
|
|
192
|
+
stay consistent.
|
|
193
|
+
|
|
194
|
+
| Distribution | Excludes | Smoke imports | Intended use |
|
|
195
|
+
| --- | --- | --- | --- |
|
|
196
|
+
| `headless` (default) | tests, test-only extensions, IDLE, Tk, `config-*/libpython*.a`, `config-*/python.o` | `ssl`, `sqlite3`, `ctypes` | Servers and general containers |
|
|
197
|
+
| `headed` | tests, test-only extensions, development archives and objects | `ssl`, `sqlite3`, `ctypes`, `tkinter` | Workstations that need Tk/IDLE |
|
|
198
|
+
| `test` | nothing | `ssl`, `sqlite3`, `ctypes`, `test` | Compatibility testing and redistribution analysis |
|
|
199
|
+
| `micro` | installer, docs, tests, headers, development files, Tk, curses, dbm, readline | `ssl`, `sqlite3`, `ctypes`, `json`, `asyncio` | Stdlib-only agent sandboxes |
|
|
200
|
+
| `nano` | `micro` plus `__pycache__` | `ssl`, `sqlite3`, `ctypes`, `json`, `asyncio` | Smallest stdlib-only image; imports compile from source |
|
|
201
|
+
| `runtime` | `micro` minus installer, keeps `site-packages` | `ssl`, `sqlite3`, `ctypes`, `json`, `asyncio` | Agent sandboxes with preinstalled packages |
|
|
202
|
+
| `runtime-nano` | `runtime` plus no `__pycache__` | `ssl`, `sqlite3`, `ctypes`, `json`, `asyncio` | Smallest agent sandbox with preinstalled packages |
|
|
203
|
+
|
|
204
|
+
`headless`, `headed`, and `test` keep `include/`, `config-*/Makefile`,
|
|
205
|
+
`ensurepip`, `venv`, and `site-packages`, so `pip install cffi` and `venv`
|
|
206
|
+
work. `micro`, `nano`, `runtime`, and `runtime-nano` are runtime-only: no pip,
|
|
207
|
+
no venv, no headers, no build scripts, no `pydoc_data`, and no test or
|
|
208
|
+
terminal-UI extension modules. `headless` and `headed` drop only the test-only
|
|
209
|
+
extensions (`_test*`, `_ctypes_test`, `xxlimited*`, `xxsubtype`, `_xxtestfuzz`)
|
|
210
|
+
and keep curses and readline. `runtime` keeps `site-packages`, so packages
|
|
211
|
+
installed at image-build time (numpy, pandas, and others) survive; only `pip`,
|
|
212
|
+
`pip-*.dist-info`, `ensurepip`, and `bin/pip*` are removed. `nano` and
|
|
213
|
+
`runtime-nano` also drop precompiled bytecode, so each process compiles modules
|
|
214
|
+
on first import; expect a small startup cost when the runtime filesystem is
|
|
215
|
+
read-only.
|
|
216
|
+
|
|
217
|
+
Three runtime Dockerfiles are provided:
|
|
218
|
+
|
|
219
|
+
- `docker/runtime.Dockerfile`: Debian slim, with a shell and apt.
|
|
220
|
+
- `docker/runtime-distroless.Dockerfile`: distroless `cc-debian12`, no shell.
|
|
221
|
+
- `docker/runtime-scratch.Dockerfile`: `scratch` root filesystem with only the
|
|
222
|
+
required sonames, CA certificates, tzdata, NSS files, and runtime directories.
|
|
223
|
+
|
|
224
|
+
The scratch image with `runtime-nano` measured 33,500,721 bytes in CI, about
|
|
225
|
+
32 MiB. It keeps the standard library, HTTPS, SQLite, `ctypes`, compression
|
|
226
|
+
modules, time zones, and `site-packages`. Edit `configs/distributions.toml` to
|
|
227
|
+
change the variants; the default distribution is `headless`.
|
|
228
|
+
|
|
229
|
+
Variant names are appended to archive filenames, for example
|
|
230
|
+
`snugpy-0.1.0-cpython3.14.9-linux-x86_64-baseline-headless.tar.xz`. The package
|
|
231
|
+
metadata keeps one entry per variant. The report matrix uses the default
|
|
232
|
+
distribution and lists every variant's installed and archive size separately.
|
|
233
|
+
|
|
234
|
+
## Commands
|
|
235
|
+
|
|
236
|
+
| Command | Action |
|
|
237
|
+
| --- | --- |
|
|
238
|
+
| `make conda` | Create or update the conda toolchain |
|
|
239
|
+
| `make lock` | Write `conda-linux-64.lock` from the current prefix |
|
|
240
|
+
| `make check` | Unit tests, `compileall`, ShellCheck, and `shfmt -d` |
|
|
241
|
+
| `make fetch` | Verify and extract pinned CPython and zerodep sources |
|
|
242
|
+
| `make build PROFILE=size` | Build one isolated profile |
|
|
243
|
+
| `make test PROFILE=size` | Run smoke and ABI gates |
|
|
244
|
+
| `make test-full PROFILE=size` | Run full CPython and zerodep gates |
|
|
245
|
+
| `make measure PROFILE=size RUNS=20` | Collect size, startup, RSS, and workload data |
|
|
246
|
+
| `make package PROFILE=size` | Create stripped archives for every distribution and smoke-test them |
|
|
247
|
+
| `make package PROFILE=size DISTRIBUTION=headless` | Create and test one distribution |
|
|
248
|
+
| `make report` | Write `results/summary.csv` and `results/report.md` |
|
|
249
|
+
| `make matrix` | Run all seven profiles without stopping on unrelated failures |
|
|
250
|
+
| `make images PROFILE=static-lean IMAGE_TAG=0.1.0` | Build the four runtime images locally |
|
|
251
|
+
| `make publish-images PROFILE=static-lean IMAGE_TAG=0.1.0` | Build, smoke-test, and push the images and `latest` |
|
|
252
|
+
| `make clean` | Remove `work/`, `out/`, and `dist/` |
|
|
253
|
+
|
|
254
|
+
The direct scripts accept `VERSION`, `TARGET`, and `PROFILE` as positional
|
|
255
|
+
arguments. Use `python -m snugpy_build.cli list` to see the configured values.
|
|
256
|
+
|
|
257
|
+
## Pins
|
|
258
|
+
|
|
259
|
+
- CPython `3.14.9`, tag `v3.14.9`, commit
|
|
260
|
+
`ead82c07db1f111d613926ed1b6667411d768125`, SHA256
|
|
261
|
+
`e02d9ac21cebda6e46435369744a92c65cc7cd8669697694122cf97ffacd1e53`
|
|
262
|
+
- zerodep `v2026.11.20`, commit
|
|
263
|
+
`9f872e8d652272c34600b9fda6448fe4fd4436c3`
|
|
264
|
+
- Target `linux-x86_64`
|
|
265
|
+
- conda-forge sysroot glibc `2.34` for the conda-linked profiles
|
|
266
|
+
- Debian 12 system libraries for `static-lean`; measured `GLIBC_2.35`,
|
|
267
|
+
allowed `GLIBC_2.36`, OpenSSL `3.0`
|
|
268
|
+
- Toolchain: Python `3.12`, GCC `16`, Clang `23`, `lld`, GNU binutils
|
|
269
|
+
|
|
270
|
+
The conda sysroot is 2.34 even though the CI runner is Ubuntu 24.04.
|
|
271
|
+
`static-lean` does not use that sysroot; it builds in `debian:bookworm` and
|
|
272
|
+
links Debian system libraries. The actual symbol requirements of each artifact
|
|
273
|
+
must be checked with `scripts/check-abi.sh` or `objdump -T` before any
|
|
274
|
+
portability or release claim. These archives are not general-purpose Linux
|
|
275
|
+
distributions.
|
|
276
|
+
|
|
277
|
+
Native extensions in the conda-linked profiles link conda-forge libraries such
|
|
278
|
+
as OpenSSL, SQLite, and `libffi`. `static-lean` extensions link the Debian
|
|
279
|
+
sonames instead. In both cases the archive does not bundle those libraries. Run
|
|
280
|
+
an extracted artifact with the matching library set available, or bundle the
|
|
281
|
+
required libraries before redistribution.
|
|
282
|
+
|
|
283
|
+
The conda-forge `gdbm` package omits its ndbm compatibility library. The conda
|
|
284
|
+
setup step builds `libgdbm_compat` from pinned GDBM `1.18` source so both
|
|
285
|
+
`_dbm` and `_gdbm` are available. `tests/smoke.py` verifies an ndbm round trip.
|
|
286
|
+
|
|
287
|
+
## Layout
|
|
288
|
+
|
|
289
|
+
```text
|
|
290
|
+
configs/ immutable versions, targets, profiles, release decisions
|
|
291
|
+
snugpy_build/ CLI, source verification, build, validation, metrics, packaging
|
|
292
|
+
scripts/ shell entry points and conda environment setup
|
|
293
|
+
tests/ unit tests, runtime smoke test, C ABI smoke module
|
|
294
|
+
benchmarks/ CPU and I/O workloads
|
|
295
|
+
patches/ exceptional common and version-specific patches
|
|
296
|
+
sources/ verified upstream source trees (ignored)
|
|
297
|
+
work/ per-cell generated build trees (ignored)
|
|
298
|
+
out/ per-cell install prefixes (ignored)
|
|
299
|
+
dist/ distribution archives (ignored)
|
|
300
|
+
results/ metadata per cell; summary.csv and report.md are tracked
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## CI
|
|
304
|
+
|
|
305
|
+
`.github/workflows/ci.yml` runs the unit checks, then builds the six
|
|
306
|
+
conda-linked profiles as independent matrix jobs with `fail-fast: false`. Each
|
|
307
|
+
job creates its conda environment from `conda-linux-64.lock`, runs fetch, build,
|
|
308
|
+
smoke tests, packaging, and measurement, and uploads its JSON results and
|
|
309
|
+
archives. A separate `static-lean` job runs inside `debian:bookworm`, links
|
|
310
|
+
Debian system libraries, and runs the ABI gate. A dependent job measures the
|
|
311
|
+
Debian slim, distroless, scratch `runtime`, and scratch `runtime-nano` images.
|
|
312
|
+
An aggregate job downloads all profile results and regenerates the report.
|
|
313
|
+
|
|
314
|
+
`.github/workflows/benchmark.yml` is the manual full-regression and repeated
|
|
315
|
+
measurement path. It runs the full CPython suite and zerodep tests with network
|
|
316
|
+
access, then packages and measures one selected profile.
|
|
317
|
+
|
|
318
|
+
`.github/workflows/release.yml` is the release path. It verifies the source
|
|
319
|
+
version and the approved release profile, builds and fully tests `static-lean`,
|
|
320
|
+
publishes the Python package to PyPI, pushes the Docker Hub images, and creates
|
|
321
|
+
the GitHub Release with archives, checksums, and the report. Set
|
|
322
|
+
`DOCKERHUB_USERNAME`, `DOCKERHUB_TOKEN`, and `PYPI_API_TOKEN` as repository
|
|
323
|
+
secrets before running it.
|
|
324
|
+
|
|
325
|
+
## Documentation
|
|
326
|
+
|
|
327
|
+
- `CHANGELOG.md`: release history and known limitations
|
|
328
|
+
- `docs/version-matrix.md`: Python versions, profiles, distributions, and sizes
|
|
329
|
+
- `docs/runtime-libraries.md`: ABI gate, library inventory, and image sizes
|
|
330
|
+
|
|
331
|
+
## License
|
|
332
|
+
|
|
333
|
+
SnugPy is licensed under the MIT License. See `LICENSE`.
|
|
334
|
+
|
|
335
|
+
A distribution archive also contains CPython-derived files. CPython keeps its
|
|
336
|
+
own PSF License Agreement, which is included in every archive at
|
|
337
|
+
`licenses/CPython-PSF-LICENSE.txt`. Third-party components are listed in
|
|
338
|
+
`THIRD_PARTY_LICENSES.md`.
|