Skip to main content

Sericite

CI PyPI Python License

Sericite is a scripting language and its execution engine, built around a single idea: creating a fully isolated, arbitrarily nestable runtime environment should be a cheap, first-class operation in the language itself.

Syntax borrows a subset of Python, but Sericite source is compiled into Sericite's own instruction stream and executed by the Sericite engine — never through exec/eval. Every VM starts with zero capabilities: its own virtual IO, its own in-memory filesystem, and the ability to create child VMs. Everything else (network, host data, whatever you choose) is granted explicitly, layer by layer, through FFI.

中文文档

Status

Pre-1.0 prototype. The engine is a Python reference implementation (codename Sericite-PY): zero runtime dependencies, Python ≥ 3.12. APIs and semantics may change before 1.0.

Security note. Sericite is designed for isolation, but the current prototype runs in the host process and has not been formally audited. Do not rely on it as the only boundary when executing adversarial code. See the security model for exactly what is and is not guaranteed.

Install

pip install sericite

The distribution is named sericite; the import package is sericite.

Quick start

As a CLI:

sericite -c 'print("hello from sericite")'
printf 'print("hello from sericite")\n' > hello.sericite
sericite hello.sericite        # hello from sericite
sericite                       # start the REPL; EOF exits
sericite -c 'print(argv)' first second

For source reuse and root-application capabilities:

sericite --include base.sericite app.sericite
sericite --capabilities capabilities.py app.sericite

Includes compose source in order in one root scope; capabilities are operator-trusted Python configuration limited to FFI, limits, and initial VFS files. See the CLI reference for the contract and the root-agent demo for a complete application. Embed Python when an existing host needs to own VM lifecycles:

from sericite import SericiteEngine

engine = SericiteEngine()
vm = engine.create_root("""
sub = VM("print('hello from a child VM')")
print(sub.run())
""")
print(vm.run(), end="")

Grant a capability to a VM (FFI):

def double(x):
    return x * 2

vm = engine.create_root("print(double(21))", functions={"double": double})
print(vm.run(), end="")    # 42

What a Sericite VM is

A VM is a cheap, self-contained workspace:

  • it cannot see its parent's variables, files, or handles, and cannot tell how deep it is nested;
  • it has its own empty in-memory filesystem (text only — structurally unable to touch the real disk);
  • resource quotas (instructions, memory, output, child VMs, nesting depth, …) can only be tightened, never loosened, and a child's consumption is charged to all its ancestors;
  • its parent can preset files, feed input, single-step it statement by statement or instruction by instruction, snapshot its state, or terminate it;
  • it can create its own child VMs — isolation is recursive, because untrusted code is.

Cheap is measured, not just claimed: in the current Python prototype, creating a child VM from inside a script costs ~0.088 ms — the same order as spawning a thread, one to two orders of magnitude below a process. More measurements and reproduction scripts are in the architecture notes §6 and benchmarks/.

Records: type names are compile-time error labels

Since 0.4, Sericite has user-defined objects with members. Its view of types follows the same discipline as VM isolation: structure travels across layers; names stay local to a layer.

  • A schema (the structural contract defined by class) is anonymous: two isomorphic schemas defined separately are equal — there are no nominal types;
  • A record carries only data and contracts. A type name is a compile-time, scope-local transparent alias (like an Elm type alias) used solely in error text — it plays no role in equality or contract checks and is erased beyond its scope;
  • Naming is a local act of the receiver: the same value may carry different names in different scopes, or none at all.

Rationale: design notes §3.4; full semantics and examples: language reference §7.

Documentation

English 中文
Design notes 设计说明
Prior art 先例与相关工作
CLI reference CLI 参考
Language reference 语言参考
VM reference 虚拟机参考
Sericite-PY reference Sericite-PY 参考
Architecture 架构说明
Security model 安全模型
Build journal 构建手记
Behind the scenes 幕后

What each document covers and whom it serves is maintained in the documentation index. The build-journal and behind-the-scenes articles are Chinese-only (their index pages have English versions); full translations are not planned — they are frozen history.

How this project was built

Sericite was developed with AI assistance throughout — design discussion, implementation, testing, adversarial review, and documentation drafting. What the AI did, what the author did, and how outputs were verified are documented in AI-assisted development (English summary; full record 中文), with selected conversation records alongside.

Roadmap

  • More list/dict methods, string methods, and additional ergonomic syntax
  • Performance benchmarks: VM creation, per-instruction execution, and debugging costs measured (see benchmarks/); broader workload coverage still pending
  • A normative language spec and a conformance test suite, so a future non-Python engine can be validated against them
  • Evaluation of a native engine (the package name is language-level on purpose: sericite survives an engine rewrite)

The name

Sericite (绢云母) is the finest-grained member of the mica family: thin silky scales that stack into sheets, and an insulator like every mica — the name keeps the three promises the project is named after: layering, insulation, lightness. (The project was briefly named Mica/MicaLang and renamed after finding the name taken.) The full story is in the design notes §6.

License

Apache-2.0 — see NOTICE.

Metadata

Release files for sericite 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sericite 0.9.0
File Size Uploaded Provenance Actions
sericite-0.9.0.tar.gz 281.2 kB With provenance Details for sericite-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sericite 0.9.0
File Interpreter ABI Platform Actions
sericite-0.9.0-py3-none-any.whl Python 3 none any Details for sericite-0.9.0-py3-none-any.whl

Total release size: 340.0 kB

Release files / sericite-0.9.0.tar.gz

Download URL sericite-0.9.0.tar.gz
Size 281.2 kB
Tags Source
SHA-256 checksum
How to use checksums
75d893c3124f196a8a1470768ac3b840bfc28c7cdad5a22c51bc4fca3a47246d
BLAKE2b-256 checksum
How to use checksums
b384ff93661f5b227e6e4f690cf2f87fcdf964d2aa14f0f1f64385b77c596a86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sericite-0.9.0-py3-none-any.whl

Download URL sericite-0.9.0-py3-none-any.whl
Size 58.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb938021344d03b9b2a51e5202d0c446d5412a093bb2d94328159541070b3a98
BLAKE2b-256 checksum
How to use checksums
e83781d27227425b77c80ed2a70bb3b723e18f7e4c114a3eb10c2578f78d1ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for sericite 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sericite-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page