Standard Library
Pyle’s standard library is split across two layers. Which functions you can call depends on how the interpreter was built.
Core modules (libpyle)
Section titled “Core modules (libpyle)”These are compiled into the embeddable library and are available to every host that registers the core natives:
| Module | Purpose |
|---|---|
os |
Time, environment, paths, process info, sleeping, workers |
path |
Pure string path manipulation, no syscalls |
fs |
Filesystem queries and file operations |
math |
Constants, numeric functions, and random numbers |
encoding |
Base64, hex, and URL coding |
io |
Console input, output, and flushing |
color |
ANSI terminal color codes |
proc |
Spawning processes, pipes, capture (when process support is compiled in) |
CLI interpreter modules (pyle)
Section titled “CLI interpreter modules (pyle)”These ship with the pyle binary and are not part of libpyle:
| Module | Purpose |
|---|---|
json |
Parse and serialize JSON |
http |
HTTP client and server |
crypto |
Hashing, HMAC, PBKDF2, random bytes |
worker |
Multi-process worker pool written in Pyle |
Built-in types
Section titled “Built-in types”Methods on strings, arrays, maps, bytes, files, futures, and coroutines are always available because they are part of the VM:
Importing
Section titled “Importing”Native modules are loaded with import:
let os = import("os")let math = import("math")let json = import("json")
printf("sqrt(144) = {}", math.sqrt(144))An unregistered module fails with NameError. On the CLI, import("worker") resolves std/worker.pyl because the interpreter adds its bundled std/ directory to the import path.
Scripts are imported the same way:
let helpers = import("lib/helpers")See Modules & Imports for search paths, caching, and module globals.
Global built-ins
Section titled “Global built-ins”print, printf, write, format, typeof, pcall, import, and the rest are documented in Built-in Functions.
What is not included
Section titled “What is not included”The following are not part of the core library and are unavailable in a library-only build:
json,http,crypto- The
workerPyle module (it depends onjson) - The language server
- The raylib module
The playground is a libpyle build, so it includes the core modules and excludes the CLI-only modules.