The native compile slotnative 컴파일 슬롯

How TypedPython's generated C becomes extension modules at the native level.

native 레벨에서 TypedPython 이 생성한 C 가 확장 모듈이 되는 방식.

Draft under review in #33 (#19). The interface exists as types only; nothing implements or calls it, and names may still change.

#33 (#19) 에서 검토 중인 초안입니다. 인터페이스는 타입으로만 있고, 아무것도 구현하거나 호출하지 않으며, 이름은 바뀔 수 있습니다.

Where it sits어디에 놓이나

TypedPython turns a typed Python module into one C file. The slot turns that C into a CPython extension module for one target, so the resource bundler can ship it at the native level in place of the module's source.

TypedPython 은 타입이 붙은 Python 모듈을 C 파일 하나로 바꿉니다. 슬롯은 그 C 를 한 타깃용 CPython 확장 모듈로 바꾸고, resource 번들러가 native 레벨에서 모듈 소스 대신 그것을 담습니다.

toolchain  compileLevel = "native"
   │  BundleRequest(buildLevel = "native", nativeModules, pythonAbi, cpythonIncludeDir, extensionSuffix)
   ▼
ResourceBundler
   ├─ ExtensionCompilerInterface.checkSupport(target, abi, …)      fail early, before any work
   ├─ ExtensionCompilerInterface.compile(ExtensionCompileRequest)  one .c per module → <name><suffix>
   └─ bytecode pass for every module that was not compiled

What goes in입력

Field필드Holds내용
ExtensionModuleSourcemoduleName, its generated sources, plus per-module includeDirs and defines.moduleName, 생성된 sources, 모듈별 includeDirs, defines.
ExtensionCompileOptionsFlags shared by the request. TypedPython's header-only runtime (runtime/tp_runtime.h) arrives through includeDirs and is compiled into each extension. Consumer cFlags come last and win.요청 전체의 플래그. TypedPython 의 헤더 전용 런타임 (runtime/tp_runtime.h) 은 includeDirs 로 들어와 각 확장에 함께 컴파일됩니다. 사용자 cFlags 가 마지막에 붙어 이깁니다.
target, pythonAbiThe canonical triple, and the CPython ABI (version, GIL or free-threaded).정식 트리플과 CPython ABI (버전, GIL 또는 free-threaded).
includeDir, extensionSuffixCPython's headers and the target's extension suffix, from the runtime the app ships.앱이 담는 런타임의 CPython 헤더와 타깃의 확장 접미사.
buildDirObjects and cache, under build/packpack/compile/<triple>/<abi tag>/<build type>, so GIL and free-threaded builds never share objects.오브젝트와 캐시. build/packpack/compile/<triple>/<abi tag>/<build type> 아래에 있어 GIL 빌드와 free-threaded 빌드가 오브젝트를 공유하지 않습니다.

What the slot promises슬롯이 약속하는 것

Concern관심사Promise약속
Floating point부동소수점Floating-point flags are semantics: -ffp-contract=off -fno-fast-math, and no build type ever adds fast-math.부동소수점 플래그는 의미의 일부입니다: -ffp-contract=off -fno-fast-math, 어떤 빌드 타입도 fast-math 를 더하지 않습니다.
Caching캐시Two layers: TypedPython caches source → C; the slot caches C → extension in buildDir, keyed by the C, the headers it includes, the target and minSdk.두 층: TypedPython 이 소스 → C 를, 슬롯이 C → 확장을 buildDir 에 캐시합니다. 키는 C, 그것이 포함하는 헤더, 타깃, minSdk.
Free threadingfree threadingPy_mod_gil is declared not-used only when the module is free-threading safe.Py_mod_gil 은 모듈이 free-threading 에 안전할 때만 not-used 로 선언합니다.
Reproducible output재현 가능한 결과Relative source paths, -ffile-prefix-map, stripped release output, ZERO_AR_DATE on Apple.상대 소스 경로, -ffile-prefix-map, release 결과 strip, Apple 에서 ZERO_AR_DATE.
Failures실패A module whose C does not compile or link fails the request, naming the module and the stage. See what native means for modules with no C.C 가 컴파일, 링크되지 않는 모듈은 모듈과 단계를 밝히며 요청을 실패시킵니다. C 가 없는 모듈은 native 의 뜻을 보세요.