icon: home
pkpy is a lightweight(~15K LOC) Python 3.x interpreter for game scripting, written in C11.
It aims to be an alternative to lua for game scripting, with elegant syntax, powerful features and competitive performance.
pkpy is extremely easy to embed via a single header file pocketpy.h, without external dependencies.
def is_prime(x):
if x < 2:
return False
for i in range(2, x):
if x % i == 0:
return False
return True
primes = [i for i in range(2, 20) if is_prime(i)]
print(primes)
# [2, 3, 5, 7, 11, 13, 17, 19]
pkpy should work on any platform with a C11 compiler. These platforms are officially tested.
C99 compilers also work currently according to users' feedback.
If you find pkpy useful, consider star this repository (●'◡'●)
You can sponsor this project via these ways.
Your sponsorship will help us develop pkpy continuously.
pkpy v2.0 is a C11 project instead of C++17. All your existing code for v1.x won't work anymore.
We provide two API sets for v2.0, C-API and pybind11 API (C++17). If you are a C user, use the C-API. If you are a C++ user, use the pybind11 API.