Build levels & bundles빌드 레벨과 번들

From source to a deployment unit: the build command, the four levels and the five bundle types.

소스에서 배포 단위까지: 빌드 명령, 네 가지 레벨, 다섯 가지 번들 유형.

Four stages네 단계

Stage단계Meaning뜻Today지금
compileSource → an executable intermediate artifact.소스 → 실행 가능한 중간 산출물.ppp build, through MesonMeson 을 거친 ppp build
bundleThe artifact plus resources, dependencies and metadata → one deployment unit.산출물 + 리소스, 의존성, 메타데이터 → 배포 단위 하나.ppp build <package> source|resource, or the library APIppp build <package> source|resource 또는 라이브러리 API 만
buildCoordinates dependency checks, compile and bundle.의존성 확인, 컴파일, 번들을 조율.Compiles, then bundles when given a bundle kind컴파일하고, 번들 종류를 주면 번들까지 수행
deployUploads a bundle to PyPI, FastTrack or ResourceHub.번들을 PyPI, FastTrack, ResourceHub 로 업로드.code single|fat to PyPI (uv publish); the rest refusescode single|fat 은 PyPI 로 (uv publish). 나머지는 거부

ppp buildppp build

ppp build <package> source [binary|fat|single|patch] [--type debug|release] [--level <level>] [--target <target>] [--overwrite]
ppp build <package> resource [--target <target>]
ppp build <package> [--type debug|release] [--level <level>] [--target <triple>] [--overwrite]

source compiles, then bundles the chosen type (binary, the default, is not implemented yet and says so). resource bundles the source for python-multiplatform without compiling. With no bundle kind, build only compiles. A bundle kind accepts a target alias and defaults to this machine; bundle warnings are printed as warning: ….

source 는 컴파일한 뒤 고른 유형으로 번들합니다 (기본값 binary 는 아직 구현되지 않았고 그렇게 알립니다). resource 는 컴파일 없이 소스를 python-multiplatform 용으로 번들합니다. 번들 종류가 없으면 build 는 컴파일만 합니다. 번들 종류를 주면 타깃 별칭을 받고 기본값은 이 컴퓨터이며, 번들 경고는 warning: … 으로 출력됩니다.

Source-root discovery checks [tool.ppp].python-dir (when set in pyproject.toml), then src/main, src, python, <package>/python, and finally the package root. Inside the discovered root, .c/.cc/.cpp/.cxx files become py.extension_module() C/C++ extension targets only when their filename starts with _ or their source references PyInit_, PyModExport_, or Python.h; other .c/.cpp files (such as data or template files) are installed as package data. Python sources (.py, .pyi, py.typed) and non-.py package data files are preserved, excluding __pycache__, *.pyc, *.pyo, dot-entries, Thumbs.db, and Rust crate directories. Output lands in dist/<target>/<type>/<level>; the wheel bundlers read it from there.

소스 루트 탐색은 pyproject.toml 에 지정된 경우 [tool.ppp].python-dir 을 먼저 보고, 이어서 src/main, src, python, <package>/python, 마지막으로 패키지 루트 순서로 찾습니다. 찾은 루트 안에서 .c/.cc/.cpp/.cxx 파일은 파일 이름이 _ 로 시작하거나 소스 안에 PyInit_, PyModExport_, Python.h 가 언급될 때만 py.extension_module() C/C++ 확장 대상이 되며, 그 밖의 .c/.cpp 데이터·템플릿 파일은 패키지 데이터로 설치됩니다. Python 소스(.py, .pyi, py.typed)와 .py 가 아닌 패키지 데이터 파일은 __pycache__, *.pyc, *.pyo, 점(.)으로 시작하는 항목, Thumbs.db, Rust crate 디렉터리를 빼고 그대로 보존됩니다. 결과는 dist/<target>/<type>/<level> 에 놓이고, 휠 번들러가 거기서 읽습니다.

[tool.ppp]
python-dir = "mypkg/python"

--level and --target only name directories today: Meson builds for the host at every level. Pass the canonical triple as --target when a wheel bundler will read the output.

지금 --level 과 --target 은 디렉터리 이름만 정합니다. Meson 은 모든 레벨에서 호스트용으로 빌드합니다. 휠 번들러가 결과를 읽을 것이라면 --target 에 정식 트리플을 주세요.

Rust extension modulesRust 확장 모듈

Declare Rust extension crates under [tool.ppp.rust] in pyproject.toml. Entries map an import module path to either a crate path string or an inline table with path, abi, features, and default-features / no-default-features. The same keys can sit at the top of [tool.ppp.rust] as package-level defaults.

pyproject.toml 의 [tool.ppp.rust] 아래에 Rust 확장 crate 를 선언합니다. 각 항목은 임포트 모듈 경로를 crate 경로 문자열이나 path, abi, features, default-features / no-default-features 를 담은 인라인 테이블에 연결합니다. 같은 키를 [tool.ppp.rust] 최상위에 두면 패키지 전체 기본값으로 적용됩니다.

[tool.ppp.rust]
abi = "abi3t-py315"
features = ["simd"]
default-features = true

"torch._C" = "rust/torch_c"
"torch._extra" = { path = "rust/torch_c", abi = "abi3-py313", features = ["extra"], default-features = false }
abi modeabi 모드Meaning뜻
abi3t-py315 (or abi3t, default)(또는 abi3t, 기본값)Free-threaded stable ABI (PEP 803).Free-threaded 안정 ABI (PEP 803).
abi3-py3<minor> (e.g. abi3-py313)(예: abi3-py313)Standard CPython stable ABI targeting 3.<minor>+.3.<minor>+ 를 대상으로 하는 표준 CPython 안정 ABI.
cp3<minor>[t] (e.g. cp315t)(예: cp315t)Version-pinned CPython build without pyo3/abi3*.pyo3/abi3* 없이 특정 버전에 고정된 CPython 빌드.

Linux cross-building (manylinux_2_17 / manylinux_2_28) runs maturin --zig with the ziglang wheel via uv tool run, which requires uv, rustup target add <triple>, and the target Python (ppp python install 3.15t <triple>). Host, Android, and iOS targets build through the Cargo backend.

Linux 크로스 빌드(manylinux_2_17 / manylinux_2_28)는 uv tool run 으로 ziglang 휠과 함께 maturin --zig 를 실행하며, uv, rustup target add <triple>, 타깃 Python(ppp python install 3.15t <triple>) 이 필요합니다. 호스트, Android, iOS 타깃은 Cargo 백엔드로 빌드합니다.

Windows Rust builds are host-only: run them on a Windows host or runner (there is no xwin or llvm cross-toolchain). WASM (wasm32-emscripten) waits for python-multiplatform#175.

Windows Rust 빌드는 호스트 전용입니다. Windows 호스트나 러너에서 실행해야 합니다 (xwin 또는 llvm 크로스 툴체인은 없습니다). WASM(wasm32-emscripten) 은 python-multiplatform#175 를 기다리고 있습니다.

Build levels빌드 레벨

Level레벨Ships담는 것Status상태
instantPython source, almost as-is.Python 소스, 거의 그대로.implemented구현 resource, single, fat, patchresource, single, fat, patch
bytecode.pyc beside each module (compileall -b) by the project's .venv interpreter; debug keeps the .py, release drops it.프로젝트 .venv 의 인터프리터로 모듈 옆에 .pyc (compileall -b). debug 는 .py 를 남기고 release 는 뺍니다.partial부분 resource, single, fat, patchresource, single, fat, patch
nativeSee below.아래를 보세요.partial부분 resource (macOS, Linux host, Android arm64), single, fat, patchresource (macOS, Linux 호스트, Android arm64), single, fat, patch
mixedSee below.아래를 보세요.partial부분 resource, single, fat, patchresource, single, fat, patch

What native and mixed meannative 와 mixed 의 뜻

Decided by the maintainer (from toolchain's example build file: compileLevel = "native" is native code only, "mixed" is bytecode for the developer's code plus native code for libraries). Implemented for resource and the wheel bundles (single, fat, patch); the native path builds on the compile slot.

메인테이너가 결정했습니다 (toolchain 의 예시 빌드 파일: compileLevel = "native" 는 네이티브 코드만, "mixed" 는 개발자 코드는 바이트코드 + 라이브러리는 네이티브 코드). resource 번들과 휠 번들(single, fat, patch)에 구현되어 있으며, native 경로는 컴파일 슬롯 위에 만들어집니다.

Part of the payload페이로드의 부분mixedmixednativenative
Developer modules개발자 모듈Bytecode. TypedPython's C is not used.바이트코드. TypedPython 의 C 는 쓰지 않습니다.Compiled from the C TypedPython produced for the module.TypedPython 이 그 모듈에 만든 C 를 컴파일.
A developer module with no CC 가 없는 개발자 모듈Bytecode.바이트코드.Allowed as an exception: shipped as bytecode, with a build warning naming the module and the reason.예외로 허용: 바이트코드로 담고, 모듈과 이유를 밝히는 빌드 경고.
C that fails to compile컴파일에 실패한 C--Fails the build. It is never silently shipped as bytecode.빌드 실패. 조용히 바이트코드로 대신하지 않습니다.
Libraries라이브러리Their prebuilt native wheels for the target.타깃용으로 미리 빌드된 네이티브 휠.Their prebuilt native wheels for the target.타깃용으로 미리 빌드된 네이티브 휠.

Bundle types번들 유형

Bundling runs from ppp build <package> source|resource, or as a library API: BundlerInterface.create(BundleType.X).bundle(BundleRequest(…)). Output goes to <package>/build/packpack/<type>/<build type>/<level>.

번들링은 ppp build <package> source|resource 로 실행하거나 라이브러리 API 로 씁니다: BundlerInterface.create(BundleType.X).bundle(BundleRequest(…)). 결과는 <package>/build/packpack/<type>/<build type>/<level> 에 놓입니다.

Type유형Produces만드는 것Status상태
resourceA directory: python/ (for sys.path) beside resource-manifest.json (identity, target, per-file SHA-256). Reads source: src/main, then src/<family>, then metaDirs, then libDirs; later wins. This is what toolchain stages into the desktop jar and the APK.디렉터리: python/ (sys.path 용) 과 resource-manifest.json (식별 정보, 타깃, 파일별 SHA-256). 소스를 읽습니다: src/main, src/<family>, metaDirs, libDirs 순서이며 나중 것이 이깁니다. toolchain 이 데스크톱 jar 와 APK 에 넣는 것이 이것입니다.implemented구현
singleA wheel of the package alone, from dist/, native extensions kept. Android tags use minSdk.패키지만 담은 휠. dist/ 에서 읽고 네이티브 확장 포함. Android 태그는 minSdk 를 씁니다.implemented구현 instant, bytecode, mixed, nativeinstant, bytecode, mixed, native
fatA wheel with workspace dependencies and the third-party ones from build/crossenv/<triple> (run sync first).워크스페이스 의존성과 build/crossenv/<triple> 의 서드파티 의존성까지 담은 휠 (먼저 sync).implemented구현 instant, bytecode, mixed, nativeinstant, bytecode, mixed, native
patchAdded and changed files against the single baseline, removals in PATCH-MANIFEST.single 기준선 대비 추가, 변경 파일과 PATCH-MANIFEST 의 삭제 목록.implemented구현 instant, bytecode, mixed, nativeinstant, bytecode, mixed, native
binaryA target-specific binary layout.타깃별 바이너리 레이아웃.planned계획

single and fat render full PEP 621 [project] metadata into <dist-info>/METADATA (Metadata-Version: 2.4, including license-files under <dist-info>/licenses/) and derive wheel tags from payload extension filenames: *.abi3t* → abi3.abi3t, *.abi3* → abi3, and *.cpython-<XY>t* → cp<XY>-cp<XY>t.

single 과 fat 은 PEP 621 [project] 메타데이터 전체를 <dist-info>/METADATA (Metadata-Version: 2.4, <dist-info>/licenses/ 아래 license-files 포함)에 기록하며, 페이로드 확장 파일 이름에서 휠 태그를 도출합니다: *.abi3t* → abi3.abi3t, *.abi3* → abi3, *.cpython-<XY>t* → cp<XY>-cp<XY>t.