PageSourceSearch

https://pocketpy.dev/quick-start/

html pocketpy.dev collected 2026-09-25 21:18:51 UTC 31,671 bytes, 401 lines download raw bytes

1<!DOCTYPE html>
2<html lang="en" class="h-full">
3<head>
4    <meta charset="UTF-8">
5    <meta name="viewport" content="width=device-width,initial-scale=1">
6    <meta name="color-scheme" content="light dark">
7    <meta name="turbo-cache-control" content="no-cache" data-turbo-track="reload" data-track-token="4.6.0.843329188462">
8
9    <!-- See retype.com -->
10    <meta name="generator" content="Retype 4.6.0">
11
12    <!-- Primary Meta Tags -->
13    <title>Quick Start | Portable Python 3.x Interpreter in Modern C</title>
14    <meta name="title" content="Quick Start | Portable Python 3.x Interpreter in Modern C">
15    <meta name="description" content="You have two options to integrate pkpy into your project.">
16
17    <!-- Canonical -->
18    <link rel="canonical" href="https://pocketpy.dev/quick-start/">
19    <link rel="sitemap" type="application/xml" title="Sitemap" href="https://pocketpy.dev/sitemap.xml">
20
21    <!-- Open Graph -->
22    <meta property="og:type" content="website">
23    <meta property="og:url" content="https://pocketpy.dev/quick-start/">
24    <meta property="og:title" content="Quick Start | Portable Python 3.x Interpreter in Modern C">
25    <meta property="og:description" content="You have two options to integrate pkpy into your project.">
26    <meta property="og:site_name" content="pocketpy">
27    <meta property="og:locale" content="en_US">
28
29    <!-- Twitter -->
30    <meta name="twitter:card" content="summary_large_image">
31    <meta name="twitter:url" content="https://pocketpy.dev/quick-start/">
32    <meta name="twitter:title" content="Quick Start | Portable Python 3.x Interpreter in Modern C">
33    <meta name="twitter:description" content="You have two options to integrate pkpy into your project.">
34
35    <!-- Alternate Markdown -->
36    <link rel="alternate" type="text/markdown" href="https://pocketpy.dev/quick-start.md">
37
38    
38<script data-cfasync="false">(function(){var cl=document.documentElement.classList,ls=localStorage.getItem("retype_scheme"),hd=cl.contains("dark"),hl=cl.contains("light"),wm=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;if(ls==="dark"||(!ls&&wm&&!hd&&!hl)){cl.remove("light");cl.add("dark")}else if(ls==="light"||(!ls&&!wm&&!hd&&!hl)){cl.remove("dark");cl.add("light")}})();</script>
38
39
40    <link id="retype-favicon" rel="icon" href="../static/logo.png" />
41    <link href="../resources/css/retype.css?v=4.6.0.843329188462" rel="stylesheet">
42
43    
43<script data-cfasync="false" src="../resources/js/config.js?v=4.6.0.843329188462" data-turbo-eval="false" defer></script>
43
44    
44<script data-cfasync="false" src="../resources/js/retype.js?v=4.6.0" data-turbo-eval="false" defer></script>
44
45    
45<script id="lunr-js" data-cfasync="false" src="../resources/js/lunr.js?v=4.6.0.843329188462" data-turbo-eval="false" defer></script>
45
46    
46<script id="prism-js" data-cfasync="false" src="../resources/js/prism.js?v=4.6.0.843329188462" defer></script>
46
47</head>
48<body>
49    <div id="retype-app" class="relative text-base antialiased text-base-text bg-base-bg font-body">
50    <div class="absolute bottom-0 left-0" style="top: 5rem; right: 50%"></div>
51
52    <header id="retype-header" class="sticky top-0 z-30 flex w-full h-16 bg-header-bg border-b border-header-border md:h-20">
53        <div class="container relative flex items-center justify-between pr-6 grow md:justify-start">
54            <!-- Mobile menu button skeleton -->
55            <button v-cloak class="skeleton retype-mobile-menu-button flex items-center justify-center shrink-0 overflow-hidden dark:text-white focus:outline-hidden rounded-full w-10 h-10 ml-3.5 md:hidden"><svg xmlns="http://www.w3.org/2000/svg" class="mb-px shrink-0" width="24" height="24" viewBox="0 0 24 24" role="presentation" style="margin-bottom: 0px;"><g fill="currentColor"><path d="M2 4h20v2H2zM2 11h20v2H2zM2 18h20v2H2z"></path></g></svg></button>
56            <div v-cloak id="retype-sidebar-left-toggle-button"></div>
57    
58            <!-- Logo -->
59            <div class="flex items-center justify-between h-full py-2 md:w-75">
60                <div class="flex items-center px-2 md:px-6">
61                    <a id="retype-branding-logo" href="https://pocketpy.dev/" class="flex items-center leading-snug text-2xl">
62                        <span class="w-10 mr-2 grow-0 shrink-0 overflow-hidden">
63                            <img class="max-h-10 md:inline-block" src="../static/logo.png" alt="" width="40" height="40">
64                        </span>
65                        <span class="dark:text-white font-bold line-clamp-1 md:line-clamp-2">pocketpy</span>
66                    </a><span id="retype-branding-label" class="inline-flex mt-1 px-2 py-1 ml-4 text-xs font-medium leading-none items-center rounded-md bg-branding-label-bg text-branding-label-text ring-1 ring-branding-label-border ring-inset md:inline-block">v2.2.0</span>
67                </div>
68    
69                <span class="hidden h-8 border-r md:inline-block border-base-border"></span>
70            </div>
71    
72            <div class="flex justify-between md:grow">
73                <!-- Top Nav -->
74                <nav id="retype-header-nav" class="hidden md:flex">
75                    <ul class="flex flex-col mb-4 md:pl-16 md:mb-0 md:flex-row md:items-center">
76                        <li class="mr-6">
77                            <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover">
78                                <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
79                                    <path d="M11.03 2.59a1.501 1.501 0 0 1 1.94 0l7.5 6.363a1.5 1.5 0 0 1 .53 1.144V19.5a1.5 1.5 0 0 1-1.5 1.5h-5.75a.75.75 0 0 1-.75-.75V14h-2v6.25a.75.75 0 0 1-.75.75H4.5A1.5 1.5 0 0 1 3 19.5v-9.403c0-.44.194-.859.53-1.144ZM12 3.734l-7.5 6.363V19.5h5v-6.25a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 .75.75v6.25h5v-9.403Z"/>
80                                </svg>
81                                <span>Home</span>
82                            </a>
83                        </li>
84                        <li class="mr-6">
85                            <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://pocketpy.dev/static/web/" target="_blank">
86                                <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
87                                    <path d="M9.5 15.584V8.416a.5.5 0 0 1 .77-.42l5.576 3.583a.5.5 0 0 1 0 .842l-5.576 3.584a.5.5 0 0 1-.77-.42Z"/><path d="M1 12C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11S1 18.075 1 12Zm11-9.5A9.5 9.5 0 0 0 2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5Z"/>
88                                </svg>
89                                <span>Live Demo</span>
90                            </a>
91                        </li>
92                        <li class="mr-6">
93                            <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://pocketpy.github.io/examples/" target="_blank">
94                                <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
95                                    <path d="M15.22 4.97a.75.75 0 0 1 1.06 0l6.5 6.5a.75.75 0 0 1 0 1.06l-6.5 6.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L21.19 12l-5.97-5.97a.75.75 0 0 1 0-1.06Zm-6.44 0a.75.75 0 0 1 0 1.06L2.81 12l5.97 5.97a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-6.5-6.5a.75.75 0 0 1 0-1.06l6.5-6.5a.75.75 0 0 1 1.06 0Z"/>
96                                </svg>
97                                <span>Live Examples</span>
98                            </a>
99                        </li>
100                        <li class="mr-6">
101                            <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://github.com/blueloveth/pocketpy" target="_blank">
102                                <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
103                                    <path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943"/>
104                                </svg>
105                                <span>Github</span>
106                            </a>
107                        </li>
108                        <li class="mr-6">
109                            <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://discord.gg/WWaq72GzXv" target="_blank">
110                                <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
111                                    <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"/><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"/>
112                                </svg>
113                                <span>Discord</span>
114                            </a>
115                        </li>
116    
117                    </ul>
118                </nav>
119    
120                <div v-cloak class="flex justify-end grow">
121                    <div id="retype-mobile-search-button"></div>
122                    <doc-search-desktop></doc-search-desktop>
123    
124                    <doc-theme-switch class="lg:ml-2"></doc-theme-switch>
125                    <doc-history></doc-history>
126                </div>
127            </div>
128        </div>
129    </header>
130
131
132    <div id="retype-container" class="container relative flex bg-white">
133        <!-- Sidebar Skeleton -->
134        <div v-cloak class="fixed flex flex-col shrink-0 duration-300 ease-in-out bg-sidebar-left-bg border-sidebar-left-border sidebar top-20 w-75 border-r h-screen md:sticky transition-transform skeleton">
135        
136            <div class="flex items-center h-16 px-6">
137                <input id="retype-filter-input-mock" class="w-full h-10 pl-8 px-3 py-2 transition-colors duration-200 ease-linear bg-filter-bg border border-filter-border rounded-lg shadow-none md:text-sm hover:border-filter-border-hover focus:outline-hidden focu
137s:border-filter-border-focus placeholder-filter-placeholder" type="text">
138            </div>
139        
140            <div class="pl-6 mt-1 mb-4">
141                <div class="w-32 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
142                <div class="w-48 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
143                <div class="w-40 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
144                <div class="w-32 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
145                <div class="w-48 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
146                <div class="w-40 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
147            </div>
148        
149            <div class="shrink-0 mt-auto bg-transparent dark:border-base-border">
150                <a class="flex items-center justify-center flex-nowrap h-16 text-gray-350 dark:text-dark-400 hover:text-gray-600 dark:hover:text-dark-300 transition-colors duration-150 ease-in docs-powered-by" target="_blank" href="https://retype.com/" rel="noopener">
151                    <span class="text-xs whitespace-nowrap">Powered by</span>
152                    <svg xmlns="http://www.w3.org/2000/svg" class="ml-2" fill="currentColor" width="96" height="20" overflow="visible"><path d="M0 0v20h13.59V0H0zm11.15 17.54H2.44V2.46h8.71v15.08zM15.8 20h2.44V4.67L15.8 2.22zM20.45 6.89V20h2.44V9.34z"/><g><path d="M40.16 8.44c0 1.49-.59 2.45-1.75 2.88l2.34 3.32h-2.53l-2.04-2.96h-1.43v2.96h-2.06V5.36h3.5c1.43 0 2.46.24 3.07.73s.9 1.27.9 2.35zm-2.48 1.1c.26-.23.38-.59.38-1.09 0-.5-.13-.84-.4-1.03s-.73-.28-1.39-.28h-1.54v2.75h1.5c.72 0 1.2-.12 1.45-.35zM51.56 5.36V7.2h-4.59v1.91h4.13v1.76h-4.13v1.92h4.74v1.83h-6.79V5.36h6.64zM60.09 7.15v7.48h-2.06V7.15h-2.61V5.36h7.28v1.79h-2.61zM70.81 14.64h-2.06v-3.66l-3.19-5.61h2.23l1.99 3.45 1.99-3.45H74l-3.19 5.61v3.66zM83.99 6.19c.65.55.97 1.4.97 2.55s-.33 1.98-1 2.51-1.68.8-3.04.8h-1.23v2.59h-2.06V5.36h3.26c1.42 0 2.45.28 3.1.83zm-1.51 3.65c.25-.28.37-.69.37-1.22s-.16-.92-.48-1.14c-.32-.23-.82-.34-1.5-.34H79.7v3.12h1.38c.68 0 1.15-.14 1.4-.42zM95.85 5.36V7.2h-4.59v1.91h4.13v1.76h-4.13v1.92H96v1.83h-6.79V5.36h6.64z"/></g></svg>
153                </a>
154            </div>
155        </div>
156        
157        <!-- Sidebar component -->
158        <doc-sidebar v-cloak>
159            <template #sidebar-footer>
160                <div class="shrink-0 mt-auto border-t md:bg-transparent md:border-none dark:border-base-border">
161        
162                    <div class="py-3 px-6 md:hidden border-b dark:border-base-border">
163                        <nav>
164                            <ul class="flex flex-wrap justify-center items-center">
165                                <li class="mr-6">
166                                    <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover">
167                                        <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
168                                            <path d="M11.03 2.59a1.501 1.501 0 0 1 1.94 0l7.5 6.363a1.5 1.5 0 0 1 .53 1.144V19.5a1.5 1.5 0 0 1-1.5 1.5h-5.75a.75.75 0 0 1-.75-.75V14h-2v6.25a.75.75 0 0 1-.75.75H4.5A1.5 1.5 0 0 1 3 19.5v-9.403c0-.44.194-.859.53-1.144ZM12 3.734l-7.5 6.363V19.5h5v-6.25a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 .75.75v6.25h5v-9.403Z"/>
169                                        </svg>
170                                        <span>Home</span>
171                                    </a>
172                                </li>
173                                <li class="mr-6">
174                                    <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://pocketpy.dev/static/web/" target="_blank">
175                                        <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
176                                            <path d="M9.5 15.584V8.416a.5.5 0 0 1 .77-.42l5.576 3.583a.5.5 0 0 1 0 .842l-5.576 3.584a.5.5 0 0 1-.77-.42Z"/><path d="M1 12C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11S1 18.075 1 12Zm11-9.5A9.5 9.5 0 0 0 2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5Z"/>
177                                        </svg>
178                                        <span>Live Demo</span>
179                                    </a>
180                                </li>
181                                <li class="mr-6">
182                                    <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://pocketpy.github.io/examples/" target="_blank">
183                                        <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
184                                            <path d="M15.22 4.97a.75.75 0 0 1 1.06 0l6.5 6.5a.75.75 0 0 1 0 1.06l-6.5 6.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L21.19 12l-5.97-5.97a.75.75 0 0 1 0-1.06Zm-6.44 0a.75.75 0 0 1 0 1.06L2.81 12l5.97 5.97a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-6.5-6.5a.75.75 0 0 1 0-1.06l6.5-6.5a.75.75 0 0 1 1.06 0Z"/>
185                                        </svg>
186                                        <span>Live Examples</span>
187                                    </a>
188                                </li>
189                                <li class="mr-6">
190                                    <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://github.com/blueloveth/pocketpy" target="_blank">
191                                        <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
192                                            <path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943"/>
193                                        </svg>
194                                        <span>Github</span>
195                                    </a>
196                                </li>
197                                <li class="mr-6">
198                                    <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://discord.gg/WWaq72GzXv" target="_blank">
199                                        <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
200                                            <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"/><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"/>
201                                        </svg>
202                                        <span>Discord</span>
203                                    </a>
204                                </li>
205        
206                            </ul>
207                        </nav>
208                    </div>
209        
210                    <a class="flex items-center justify-center flex-nowrap h-16 text-gray-350 dark:text-dark-400 hover:text-gray-600 dark:hover:text-dark-300 transition-colors duration-150 ease-in docs-powered-by" target="_blank" href="https://retype.com/" rel="noopener">
211                        <span class="text-xs whitespace-nowrap">Powered by</span>
212                        <svg xmlns="http://www.w3.org/2000/svg" class="ml-2" fill="currentColor" width="96" height="20" overflow="visible"><path d="M0 0v20h13.59V0H0zm11.15 17.54H2.44V2.46h8.71v15.08zM15.8 20h2.44V4.67L15.8 2.22zM20.45 6.89V20h2.44V9.34z"/><g><path d="M40.16 8.44c0 1.49-.59 2.45-1.75 2.88l2.34 3.32h-2.53l-2.04-2.96h-1.43v2.96h-2.06V5.36h3.5c1.43 0 2.46.24 3.07.73s.9 1.27.9 2.35zm-2.48 1.1c.26-.23.38-.59.38-1.09 0-.5-.13-.84-.4-1.03s-.73-.28-1.39-.28h-1.54v2.75h1.5c.72 0 1.2-.12 1.45-.35zM51.56 5.36V7.2h-4.59v1.91h4.13v1.76h-4.13v1.92h4.74v1.83h-6.79V5.36h6.64zM60.09 7.15v7.48h-2.06V7.15h-2.61V5.36h7.28v1.79h-2.61zM70.81 14.64h-2.06v-3.66l-3.19-5.61h2.23l1.99 3.45 1.99-3.45H74l-3.19 5.61v3.66zM83.99 6.19c.65.55.97 1.4.97 2.55s-.33 1.98-1 2.51-1.68.8-3.04.8h-1.23v2.59h-2.06V5.36h3.26c1.42 0 2.45.28 3.1.83zm-1.51 3.65c.25-.28.37-.69.37-1.22s-.16-.92-.48-1.14c-.32-.23-.82-.34-1.5-.34H79.7v3.12h1.38c.68 0 1.15-.14 1.4-.42zM95.85 5.36V7.2h-4.59v1.91h4.13v1.76h-4.13v1.92H96v1.83h-6.79V5.36h6.64z"/></g></svg>
213                    </a>
214                </div>
215            </template>
216        </doc-sidebar>
217
218        <div class="grow min-w-0 bg-body-bg">
219            <!-- Render "toolbar" template here on api pages --><!-- Render page content -->
220<div class="flex">
221    <div id="retype-main" class="min-w-0 p-4 grow md:px-16">
222        <main class="relative pb-12 lg:pt-2">
223            <div class="relative retype-markdown" id="retype-content">
224                <!-- Rendered if sidebar right is enabled -->
225                <div id="retype-sidebar-right-toggle"></div>
226                <doc-page-actions></doc-page-actions>
227
228                <!-- Page content  -->
229<h1 id="quick-start">Quick Start</h1>
230<p>You have two options to integrate pkpy into your project.</p>
231<h4 id="use-cmake-recommended">Use CMake (Recommended)</h4>
232<p>Clone the whole repository as a submodule into your project,
233In your CMakelists.txt, add the following lines:</p>
234<div id="use-cmake-recommended-code-1" class="codeblock-wrapper"><doc-codeblock>
235<pre translate="no" class="language-cmake"><code v-pre class="language-cmake">add_subdirectory(pocketpy)
236target_link_libraries(&lt;your_target&gt; pocketpy)</code></pre>
237</doc-codeblock></div>
238<p>See <a href="https://github.com/pocketpy/pocketpy/blob/main/CMakeLists.txt">CMakeLists.txt</a> for details.</p>
239<p>It is safe to use <code translate="no" v-pre>main</code> branch in production if CI badge is green.</p>
240<h4 id="use-the-single-header-file">Use the single header file</h4>
241<p>Download the <code translate="no" v-pre>pocketpy.h</code> and <code translate="no" v-pre>pocketpy.c</code> on our <a href="https://github.com/pocketpy/pocketpy/releases">GitHub Release</a> page.
242And <code translate="no" v-pre>#include</code> it in your project.</p>
243<h3 id="compile-flags">Compile flags</h3>
244<p>To compile it with your project, these flags must be set:</p>
245<ul>
246<li><code translate="no" v-pre>--std=c11</code> flag must be set</li>
247<li>For MSVC, <code translate="no" v-pre>/utf-8</code> and <code translate="no" v-pre>/experimental:c11atomics</code> flag must be set</li>
248<li><code translate="no" v-pre>NDEBUG</code> macro should be defined for release build, or you will get poor performance</li>
249</ul>
250<h3 id="get-prebuilt-binaries">Get prebuilt binaries</h3>
251<p>We have prebuilt binaries,
252check them out on our <a href="https://github.com/pocketpy/pocketpy/actions/workflows/main.yml">GitHub Actions</a>.</p>
253<p>You can download an artifact there which contains the following files.</p>
254<div id="get-prebuilt-binaries-code-1" class="codeblock-wrapper"><doc-codeblock>
255<pre translate="no" class="language-none"><code v-pre class="language-none">├── android
256│   ├── arm64-v8a
257│   │   └── libpocketpy.so
258│   ├── armeabi-v7a
259│   │   └── libpocketpy.so
260│   └── x86_64
261│       └── libpocketpy.so
262├── ios
263│   └── libpocketpy.a
264├── linux
265│   └── x86_64
266│       ├── libpocketpy.so
267│       └── main
268└── windows
269    └── x86_64
270        ├── main.exe
271        └── pocketpy.dll</code></pre>
272</doc-codeblock></div>
273<h3 id="example">Example</h3>
274<div id="example-code-1" class="codeblock-wrapper"><doc-codeblock>
275<pre translate="no" class="language-c"><code v-pre class="language-c">#include &quot;pocketpy.h&quot;
276#include &lt;stdio.h&gt;
277
278static bool int_add(int argc, py_Ref argv) {
279    PY_CHECK_ARGC(2);
280    PY_CHECK_ARG_TYPE(0, tp_int);
281    PY_CHECK_ARG_TYPE(1, tp_int);
282    py_i64 a = py_toint(py_arg(0));
283    py_i64 b = py_toint(py_arg(1));
284    py_newint(py_retval(), a + b);
285    return true;
286}
287
288int main() {
289    // Initialize pocketpy
290    py_initialize();
291
292    // Hello world!
293    bool ok = py_exec(&quot;print('Hello world!')&quot;, &quot;&lt;string&gt;&quot;, EXEC_MODE, NULL);
294    if(!ok) goto __ERROR;
295
296    // Create a list: [1, 2, 3]
297    py_Ref r0 = py_tmpr0();
298    py_newlistn(r0, 3);
299    py_newint(py_list_getitem(r0, 0), 1);
300    py_newint(py_list_getitem(r0, 1), 2);
301    py_newint(py_list_getitem(r0, 2), 3);
302
303    // Eval the sum of the list
304    py_Ref f_sum = py_getbuiltin(py_name(&quot;sum&quot;));
305    py_push(f_sum);
306    py_pushnil();
307    py_push(r0);
308    ok = py_vectorcall(1, 0);
309    if(!ok) goto __ERROR;
310
311    printf(&quot;Sum of the list: %d\n&quot;, (int)py_toint(py_retval()));  // 6
312
313    // Bind native `int_add` as a global variable
314    py_newnativefunc(r0, int_add);
315    py_setglobal(py_name(&quot;add&quot;), r0);
316
317    // Call `add` in python
318    ok = py_exec(&quot;add(3, 7)&quot;, &quot;&lt;string&gt;&quot;, EVAL_MODE, NULL);
319    if(!ok) goto __ERROR;
320
321    py_i64 res = py_toint(py_retval());
322    printf(&quot;Sum of 2 variables: %d\n&quot;, (int)res);  // 10
323
324    py_finalize();
325    return 0;
326
327__ERROR:
328    py_printexc();
329    py_finalize();
330    return 1;
331}</code></pre>
332</doc-codeblock></div>
333
334                
335                <!-- Required only on API pages -->
336                <doc-toolbar-member-filter-no-results></doc-toolbar-member-filter-no-results>
337            </div>
338            <footer id="retype-content-footer" class="clear-both">
339            
340                <nav id="retype-nextprev" class="print:hidden flex mt-14">
341                    <div class="w-1/2">
342                        <a class="px-5 py-4 h-full flex items-center break-normal font-medium text-body-link border border-base-border hover:border-base-border-hover rounded-l-lg transition-colors duration-150 relative hover:z-5" href="../">
343                            <svg xmlns="http://www.w3.org/2000/svg" class="mr-3" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" overflow="visible"><path d="M19 11H7.41l5.29-5.29a.996.996 0 10-1.41-1.41l-7 7a1 1 0 000 1.42l7 7a1.024 1.024 0 001.42-.01.996.996 0 000-1.41L7.41 13H19c.55 0 1-.45 1-1s-.45-1-1-1z" /><path fill="none" d="M0 0h24v24H0z" /></svg>
344                            <span>
345                                <span class="block text-xs font-normal text-base-text-muted">Previous</span>
346                                <span class="block mt-1">Welcome</span>
347                            </span>
348                        </a>
349                    </div>
350            
351                    <div class="w-1/2">
352                        <a class="px-5 py-4 -mx-px h-full flex items-center justify-end break-normal font-medium text-body-link border border-base-border hover:border-base-border-hover rounded-r-lg transition-colors duration-150 relative hover:z-5" href="../bindings/">
353                            <span>
354                                <span class="block text-xs font-normal text-right text-base-text-muted">Next</span>
355                                <span class="block mt-1">Write C Bindings</span>
356                            </span>
357                            <svg xmlns="http://www.w3.org/2000/svg" class="ml-3" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" overflow="visible"><path d="M19.92 12.38a1 1 0 00-.22-1.09l-7-7a.996.996 0 10-1.41 1.41l5.3 5.3H5c-.55 0-1 .45-1 1s.45 1 1 1h11.59l-5.29 5.29a.996.996 0 000 1.41c.19.2.44.3.7.3s.51-.1.71-.29l7-7c.09-.09.16-.21.21-.33z" /><path fill="none" d="M0 0h24v24H0z" /></svg>
358                        </a>
359                    </div>
360                </nav>
361            </footer>
362        </main>
363
364        <div id="retype-page-footer" class="print:border-none border-t border-base-border pt-6 mb-8">
365            <footer class="flex flex-wrap items-center justify-between print:justify-center">
366                <div id="retype-footer-links" class="print:hidden">
367                    <ul class="flex flex-wrap items-center text-sm">
368                    </ul>
369                </div>
370                <div id="retype-copyright" class="print:justify-center py-2 text-footer-text font-footer-link text-sm leading-relaxed"><p>© Copyright 2026 - <a href="https://github.com/blueloveTH">blueloveTH</a> - All rights reserved.</p></div>
371            </footer>
372        </div>
373    </div>
374
375    <!-- Rendered if sidebar right is enabled -->
376    <!-- Sidebar right skeleton-->
377    <div v-cloak class="fixed top-0 bottom-0 right-0 translate-x-full bg-sidebar-right-bg border-sidebar-right-border lg:sticky lg:border-l lg:shrink-0 lg:pt-6 lg:translate-x-0 sm:w-1/2 lg:w-64 lg:z-0 md:w-104 sidebar-right skeleton">
378        <div class="pl-5">
379            <div class="w-32 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
380            <div class="w-48 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
381            <div class="w-40 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
382        </div>
383    </div>
384
385    <!-- User should be able to hide sidebar right -->
386    <doc-sidebar-right v-cloak></doc-sidebar-right>
387</div>
388
389        </div>
390    </div>
391
392    <doc-search-mobile></doc-search-mobile>
393    <doc-back-to-top></doc-back-to-top>
394</div>
395
396
397    <div id="retype-overlay-target"></div>
398
399        
399<script data-cfasync="false">window.__DOCS__ = { "title": "Quick Start", level: 1, icon: "file", hasPrism: true, hasInstagram: false, hasMermaid: false, hasMath: false, tocDepth: 23, "md": "/quick-start.md" }</script>
399
400</body>
401</html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.