Repository navigation
Expand file tree
/
Copy pathguide-platforms.html
More file actions
64 lines (64 loc) · 6.99 KB
/
Copy pathguide-platforms.html
File metadata and controls
64 lines (64 loc) · 6.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Set up each platform · python-multiplatform</title>
<meta name="description" content="Real CPython inside Kotlin Multiplatform: Kotlin calls Python, Python calls Kotlin, on every target.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+KR:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/style.css">
<script src="assets/site.js"></script>
</head>
<body>
<span hidden data-title-en="Set up each platform · python-multiplatform" data-title-ko="플랫폼별 준비 · python-multiplatform"></span>
<header class="site-header">
<div class="wrap bar">
<a class="brand" href="index.html"><svg class="mark" viewBox="0 0 24 24" aria-hidden="true"><rect x="2" y="2" width="9" height="9" rx="2.5" fill="none" stroke="currentColor" stroke-width="1.8"/><rect x="13" y="13" width="9" height="9" rx="2.5" fill="var(--accent)"/><path d="M11 6.5h4.5a2 2 0 0 1 2 2V13M13 17.5H8.5a2 2 0 0 1-2-2V11" fill="none" stroke="var(--accent)" stroke-width="1.8" stroke-linecap="round"/></svg><span translate="no">python-multiplatform</span></a>
<button class="tool menu-toggle" id="menu-toggle" aria-expanded="false" aria-controls="site-nav"><span data-lang="en">Menu</span><span data-lang="ko">메뉴</span></button>
<nav class="nav" id="site-nav" aria-label="Primary">
<a href="index.html"><span data-lang="en">Home</span><span data-lang="ko">홈</span></a>
<a href="getting-started.html"><span data-lang="en">Get started</span><span data-lang="ko">시작하기</span></a>
<a href="concepts.html"><span data-lang="en">Concepts</span><span data-lang="ko">개념</span></a>
<a href="guides.html" aria-current="page"><span data-lang="en">Guides</span><span data-lang="ko">가이드</span></a>
<a href="ecosystem.html"><span data-lang="en">Ecosystem</span><span data-lang="ko">생태계</span></a>
<a href="status.html"><span data-lang="en">Status & FAQ</span><span data-lang="ko">상태 · FAQ</span></a>
</nav>
<div class="tools">
<button class="tool" id="lang-toggle" type="button">한국어</button>
<button class="tool" id="theme-toggle" type="button" aria-label="Toggle colour theme">☀</button>
</div>
</div>
</header>
<div class="page-head"><div class="wrap">
<div class="eyebrow"><span data-lang="en">Guide</span><span data-lang="ko">가이드</span></div>
<h1><span data-lang="en">Set up each platform</span><span data-lang="ko">플랫폼별 준비</span></h1>
<p><span data-lang="en">CPython reads its standard library from the file system. Each platform gets one there differently.</span><span data-lang="ko">CPython 은 표준 라이브러리를 파일 시스템에서 읽는다. 플랫폼마다 그것을 두는 방법이 다르다.</span></p>
</div></div>
<main><div class="wrap"><div class="prose">
<h2><span class="num">01</span><span data-lang="en">Desktop</span><span data-lang="ko">데스크톱</span></h2>
<p><span data-lang="en">Apply the Gradle plugin. Its <code>stagePythonHome</code> task downloads the matching CPython, verifies it against the release's <code>SHA256SUMS</code>, caches it for the whole machine, and sets <code>PYTHONHOME</code> on <code>run</code> and <code>test</code>. A <code>PYTHONHOME</code> you set yourself is never touched.</span><span data-lang="ko">Gradle 플러그인을 적용한다. <code>stagePythonHome</code> 태스크가 맞는 CPython 을 내려받아 릴리스의 <code>SHA256SUMS</code> 로 검증하고, 기기 전체용 캐시에 두고, <code>run</code> 과 <code>test</code> 에 <code>PYTHONHOME</code> 을 설정한다. 직접 설정한 <code>PYTHONHOME</code> 은 건드리지 않는다.</span></p>
<pre translate="no"><code class="language-kotlin">pythonBindings { stagePythonHome.set(false) } // opt out</code></pre>
<h2><span class="num">02</span><span data-lang="en">Android</span><span data-lang="ko">Android</span></h2>
<pre translate="no"><code class="language-kotlin">class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
PythonBootstrap.initialize(this)
}
}</code></pre>
<p><span data-lang="en">The stdlib ships inside the APK and is unpacked to app-private storage on first launch (237–480 ms measured on API 26–36), then skipped by a stamp check (4–28 ms). The stamp is written last, so an interrupted copy is never mistaken for a complete one.</span><span data-lang="ko">stdlib 는 APK 안에 들어 있고 첫 실행에 앱 전용 저장소로 풀린다 (API 26–36 에서 237–480 ms 측정). 이후에는 스탬프 확인으로 건너뛴다 (4–28 ms). 스탬프를 마지막에 쓰므로 중단된 복사를 완료된 것으로 착각하지 않는다.</span></p>
<h2><span class="num">03</span><span data-lang="en">iOS</span><span data-lang="ko">iOS</span></h2>
<p><span data-lang="en">The CPython framework carries no stdlib, so <code>PYTHONHOME</code> must point at one. Simulator tests receive environment variables through the <code>SIMCTL_CHILD_</code> prefix. Building requires macOS with Xcode.</span><span data-lang="ko">CPython 프레임워크에는 stdlib 가 없으므로 <code>PYTHONHOME</code> 이 stdlib 를 가리켜야 한다. 시뮬레이터 테스트는 <code>SIMCTL_CHILD_</code> 접두사로 환경 변수를 받는다. 빌드에는 Xcode 가 있는 macOS 가 필요하다.</span></p>
<h2><span class="num">04</span><span data-lang="en">Web (experimental)</span><span data-lang="ko">웹 (실험적)</span></h2>
<p><span data-lang="en">The wasmJs target runs an Emscripten build of CPython in Node and the browser. There are no threads, so <code>suspend</code> upcalls are not available there.</span><span data-lang="ko">wasmJs 타깃은 Emscripten 으로 빌드한 CPython 을 Node 와 브라우저에서 돌린다. 스레드가 없으므로 그곳에서는 <code>suspend</code> 업콜을 쓸 수 없다.</span></p>
<div class="pager"><a href="guide-binding-libraries.html">← <span data-lang="en">Bind a prebuilt library</span><span data-lang="ko">빌드된 라이브러리 바인딩</span></a><a href="ecosystem.html"><span data-lang="en">Ecosystem</span><span data-lang="ko">생태계</span> →</a></div>
</div></div></main>
<footer class="site-footer">
<div class="wrap">
<span><span data-lang="en">MIT licensed.</span><span data-lang="ko">MIT 라이선스.</span> <span translate="no">© 2024 thisisthepy</span></span>
<span><a href="https://github.com/thisisthepy/python-multiplatform">GitHub</a> · <a href="https://github.com/thisisthepy/python-multiplatform/blob/develop/docs/locale/README_ko.md"><span data-lang="en">Korean README</span><span data-lang="ko">한국어 README</span></a></span>
</div>
</footer>
</body>
</html>