sericite 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. sericite-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +48 -0
  2. sericite-0.2.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  3. sericite-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +31 -0
  4. sericite-0.2.0/.github/workflows/ci.yml +23 -0
  5. sericite-0.2.0/.github/workflows/release.yml +33 -0
  6. sericite-0.2.0/.gitignore +14 -0
  7. sericite-0.2.0/CHANGELOG.md +29 -0
  8. sericite-0.2.0/CONTRIBUTING.md +33 -0
  9. sericite-0.2.0/LICENSE +202 -0
  10. sericite-0.2.0/NOTICE +4 -0
  11. sericite-0.2.0/PKG-INFO +129 -0
  12. sericite-0.2.0/README.md +103 -0
  13. sericite-0.2.0/README.zh-CN.md +99 -0
  14. sericite-0.2.0/SECURITY.md +23 -0
  15. sericite-0.2.0/demo/.env.example +4 -0
  16. sericite-0.2.0/demo/README.md +32 -0
  17. sericite-0.2.0/demo/main.py +344 -0
  18. sericite-0.2.0/demo/mock_server.py +149 -0
  19. sericite-0.2.0/docs/README.md +23 -0
  20. sericite-0.2.0/docs/architecture.zh-CN.md +96 -0
  21. sericite-0.2.0/docs/behind-the-scenes/README.md +20 -0
  22. sericite-0.2.0/docs/behind-the-scenes/ai-assisted-development.zh-CN.md +60 -0
  23. sericite-0.2.0/docs/behind-the-scenes/conversation.zh-CN.md +1156 -0
  24. sericite-0.2.0/docs/behind-the-scenes/origin.zh-CN.md +60 -0
  25. sericite-0.2.0/docs/design.md +97 -0
  26. sericite-0.2.0/docs/design.zh-CN.md +97 -0
  27. sericite-0.2.0/docs/language-reference.md +174 -0
  28. sericite-0.2.0/docs/language-reference.zh-CN.md +174 -0
  29. sericite-0.2.0/docs/prior-art.md +52 -0
  30. sericite-0.2.0/docs/prior-art.zh-CN.md +52 -0
  31. sericite-0.2.0/docs/security.md +60 -0
  32. sericite-0.2.0/docs/security.zh-CN.md +60 -0
  33. sericite-0.2.0/docs/stages/01-minimal-vm.zh-CN.md +302 -0
  34. sericite-0.2.0/docs/stages/02-real-engine.zh-CN.md +343 -0
  35. sericite-0.2.0/docs/stages/03-workspace.zh-CN.md +368 -0
  36. sericite-0.2.0/docs/stages/04-dict-and-ffi.zh-CN.md +326 -0
  37. sericite-0.2.0/docs/stages/05-security-and-usability.zh-CN.md +332 -0
  38. sericite-0.2.0/docs/stages/06-demo.zh-CN.md +202 -0
  39. sericite-0.2.0/docs/stages/README.md +66 -0
  40. sericite-0.2.0/examples/debug_sub_vm.sericite +15 -0
  41. sericite-0.2.0/examples/dict.sericite +20 -0
  42. sericite-0.2.0/examples/ffi.sericite +21 -0
  43. sericite-0.2.0/examples/fib.sericite +9 -0
  44. sericite-0.2.0/examples/for_finally.sericite +27 -0
  45. sericite-0.2.0/examples/nested_vm.sericite +11 -0
  46. sericite-0.2.0/examples/root.sericite +4 -0
  47. sericite-0.2.0/examples/sub_vm.sericite +9 -0
  48. sericite-0.2.0/examples/try_except.sericite +27 -0
  49. sericite-0.2.0/examples/vfs.sericite +11 -0
  50. sericite-0.2.0/pyproject.toml +42 -0
  51. sericite-0.2.0/src/sericite/__init__.py +4 -0
  52. sericite-0.2.0/src/sericite/__main__.py +5 -0
  53. sericite-0.2.0/src/sericite/cli.py +54 -0
  54. sericite-0.2.0/src/sericite/compiler.py +689 -0
  55. sericite-0.2.0/src/sericite/engine.py +1497 -0
  56. sericite-0.2.0/src/sericite/errors.py +34 -0
  57. sericite-0.2.0/src/sericite/io.py +72 -0
  58. sericite-0.2.0/src/sericite/isa.py +57 -0
  59. sericite-0.2.0/src/sericite/vfs.py +78 -0
  60. sericite-0.2.0/tests/test_cli.py +42 -0
  61. sericite-0.2.0/tests/test_engine.py +182 -0
  62. sericite-0.2.0/tests/test_phase2.py +340 -0
  63. sericite-0.2.0/tests/test_phase3.py +335 -0
  64. sericite-0.2.0/tests/test_phase4.py +370 -0
  65. sericite-0.2.0/tests/test_phase5.py +620 -0
  66. sericite-0.2.0//344/270/264/346/227/266/345/217/202/350/200/203/.gitignore +1 -0
  67. sericite-0.2.0//344/270/264/346/227/266/345/217/202/350/200/203//345/205/263/344/272/216/351/241/271/347/233/256/350/275/254/345/236/213.txt +309 -0
@@ -0,0 +1,48 @@
1
+ name: Bug 报告 / Bug report
2
+ description: 引擎、编译器、CLI 或打包安装的行为与文档不符 / Engine, compiler, CLI or packaging behaves differently from the docs
3
+ title: "bug: "
4
+ labels: [bug]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ 感谢报告。如果是**安全问题**(隔离逃逸、配额绕过、信息泄漏),请不要开公开 issue,改用仓库 Security 页的私密漏洞报告。
10
+ For **security issues** (isolation escape, quota bypass, information leak), please use private vulnerability reporting under the Security tab instead of a public issue.
11
+ - type: textarea
12
+ id: what
13
+ attributes:
14
+ label: 问题描述 / What happened
15
+ description: 发生了什么?大致在哪一层——语言语法 / 引擎行为 / CLI / 打包安装?
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ id: repro
20
+ attributes:
21
+ label: 复现 / Reproduction
22
+ description: 最小复现:一段 sericite 代码或一段 Python 调用代码,以及运行命令。Minimal reproduction, please.
23
+ placeholder: |
24
+ sub = VM("print('hi')")
25
+ print(sub.run())
26
+ validations:
27
+ required: true
28
+ - type: textarea
29
+ id: expected
30
+ attributes:
31
+ label: 期望行为 / Expected behavior
32
+ validations:
33
+ required: true
34
+ - type: textarea
35
+ id: actual
36
+ attributes:
37
+ label: 实际行为 / Actual behavior
38
+ description: 实际输出或错误信息(错误 kind、消息、逻辑行号)。Actual output or error (kind, message, logical line).
39
+ validations:
40
+ required: true
41
+ - type: input
42
+ id: version
43
+ attributes:
44
+ label: 版本 / Version
45
+ description: sericite 版本(`sericite --version`)与 Python 版本。
46
+ placeholder: "sericite 0.2.0, Python 3.12"
47
+ validations:
48
+ required: true
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: 安全漏洞报告
4
+ url: https://github.com/LeoLoudWarden/sericite/security/advisories/new
5
+ about: 隔离逃逸、配额绕过、信息泄漏等安全问题请勿公开 issue,请通过私密漏洞报告渠道提交。
6
+ - name: 设计理念讨论
7
+ url: https://github.com/LeoLoudWarden/sericite/blob/main/docs/design.zh-CN.md
8
+ about: 涉及"为什么这样设计"的讨论,请先读《Sericite 设计说明》。
@@ -0,0 +1,31 @@
1
+ name: 功能建议 / Feature request
2
+ description: 语言特性、内建能力、工具链的建议 / Language features, builtins, tooling
3
+ title: "feat: "
4
+ labels: [enhancement]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ 提建议前请先读[设计说明](https://github.com/LeoLoudWarden/sericite/blob/main/docs/design.zh-CN.md):Sericite 的内建能力上限是虚拟文件系统,其余能力走 FFI 授予——"给引擎内建网络/设备能力"类建议与设计边界冲突,直接提大概率不会被采纳。
10
+ Please read the design notes first: built-in capabilities stop at the virtual filesystem; everything else is granted via FFI.
11
+ - type: textarea
12
+ id: problem
13
+ attributes:
14
+ label: 想解决什么问题 / Problem to solve
15
+ description: 先描述场景和痛点,而不是直接描述方案。Describe the scenario and pain point, not the solution.
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ id: proposal
20
+ attributes:
21
+ label: 提议的形式 / Proposal
22
+ description: 如果有具体想法(语法、API、行为)写在这里;没有可以留空。Optional.
23
+ validations:
24
+ required: false
25
+ - type: textarea
26
+ id: alternatives
27
+ attributes:
28
+ label: 考虑过的替代方案 / Alternatives considered
29
+ description: 比如用 FFI 授予、或在应用层实现,是否已经够用?E.g. would an FFI grant or an application-layer solution suffice?
30
+ validations:
31
+ required: false
@@ -0,0 +1,23 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ python-version: ["3.12", "3.13", "3.14"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: astral-sh/setup-uv@v6
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ - run: uv sync
21
+ - run: uv run python -m unittest discover -s tests
22
+ - run: uv build
23
+ - run: uvx twine check dist/*
@@ -0,0 +1,33 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: astral-sh/setup-uv@v6
16
+ - run: uv build
17
+ - uses: actions/upload-artifact@v4
18
+ with:
19
+ name: dist
20
+ path: dist/
21
+
22
+ publish:
23
+ needs: build
24
+ runs-on: ubuntu-latest
25
+ environment: pypi
26
+ permissions:
27
+ id-token: write
28
+ steps:
29
+ - uses: actions/download-artifact@v4
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ .venv/
2
+ .idea/
3
+ uv.lock
4
+ __pycache__/
5
+ *.py[cod]
6
+ .env
7
+ .env.*
8
+ !.env.example
9
+ dist/
10
+ build/
11
+ *.egg-info/
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ .DS_Store
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ 本项目的所有重要变更都会记录在此文件中。
4
+
5
+ 格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
6
+ 版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2026-10-22
11
+
12
+ ### Changed
13
+ - 项目更名:Mica/MicaLang → Sericite。发行包名 `micalang` → `sericite`,import 包名 `mica` → `sericite`,CLI 命令 `micalang` → `sericite`,源码扩展名 `.mica` → `.sericite`,Python API 类名 MicaEngine/MicaError/MicaLimits → SericiteEngine/SericiteError/SericiteLimits。更名缘由见 README "The name"。
14
+ - design 文档修正先例论述:补充 Safe-Tcl 作为直接祖先的考据,新增 docs/prior-art.md《先例与相关工作》(中英双语)。
15
+
16
+ ## [0.1.0] - 未发布
17
+
18
+ 首次公开发布。构建过程见构建手记 `docs/stages/`(tag `stage-0`…`stage-6`)。
19
+
20
+ ### Added
21
+
22
+ - Sericite-PY 参考实现:源码经白名单校验编译为内部指令流,由统一调度循环执行,不经 `exec`/`eval`。
23
+ - 语言:int/float/str/bool/None/list/dict;`if/while/for`、`break/continue`、`try/except/else/finally`、`raise`、三元表达式;函数、递归、默认参数与关键字实参。
24
+ - 嵌套 VM:任意层可创建子 VM,子 VM 不感知层深;父 VM 可预置文件、喂输入、单步调试、快照、终止。
25
+ - 能力授予(FFI):宿主向 root VM 注入函数,任意层 VM 向下一层授予函数;跨宿主边界双向深拷贝 + 纯数据类型白名单。
26
+ - 资源治理:指令数、输出字节、调用深度、子 VM 数量、嵌套深度、容器大小、字符串字节、整数位宽、近似内存总量、VM 总数、文件数与单文件字节配额;子 VM 消耗计入所有祖先。
27
+ - 每个 VM 自带私有虚拟文件系统(纯内存、纯文本)。
28
+ - 回归测试:198 个用例。
29
+ - demo:HTTP 能力授予 + 多层虚拟化的 LLM 代码执行示例(`demo` extra,含离线桩服务器)。
@@ -0,0 +1,33 @@
1
+ # 贡献指南
2
+
3
+ English readers: this project's development workflow is currently documented in Chinese. An English version is planned.
4
+
5
+ ## 开发环境
6
+
7
+ - Python ≥ 3.12,包管理用 [uv](https://docs.astral.sh/uv/)。
8
+ - 引擎本体零第三方依赖;`demo` 的依赖在 `pyproject.toml` 的 `demo` extra 里。
9
+
10
+ ## 验证
11
+
12
+ 修改引擎、编译器或脚本接口后,必须先运行回归套件:
13
+
14
+ ```bash
15
+ uv sync
16
+ uv run python -m unittest discover -s tests
17
+ ```
18
+
19
+ 仓库采用 `src/` 布局,直接运行 `python -m unittest` 前需要先安装本项目(`uv sync` 会自动处理)。
20
+
21
+ ## 设计纪律
22
+
23
+ - 理念问题以 [`docs/design.zh-CN.md`](docs/design.zh-CN.md) 为准。改理念先改它,不要在别处另造表述。
24
+ - 架构不变量见 [`docs/architecture.zh-CN.md`](docs/architecture.zh-CN.md)。新语法必须先过编译器白名单,禁止引入 `exec`/`eval`。
25
+ - 不给引擎加网络/设备等内建能力;能力的正确形态是 FFI 授予。安全边界见 [`docs/security.zh-CN.md`](docs/security.zh-CN.md)。
26
+
27
+ ## 文档流程
28
+
29
+ 本项目的说明性文档遵循一条规则:**AI 可以起草,入库前必须经作者人工打磨**。如果你提交的 PR 改动文档,请确保文本由人通读并修改过,而不是直接提交模型输出。
30
+
31
+ ## 提交信息
32
+
33
+ 使用中文,一句话说明这次提交做了什么,格式参考已有历史(如 `docs: 文档初始化——设计理念、语言参考与构建手记框架`)。
sericite-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
sericite-0.2.0/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Sericite
2
+ Copyright 2026 LeoLoudWarden
3
+
4
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.5
2
+ Name: sericite
3
+ Version: 0.2.0
4
+ Summary: Sericite: a scripting language with cheap, arbitrarily nested VM isolation
5
+ Project-URL: Homepage, https://github.com/LeoLoudWarden/sericite
6
+ Project-URL: Repository, https://github.com/LeoLoudWarden/sericite
7
+ Project-URL: Issues, https://github.com/LeoLoudWarden/sericite/issues
8
+ Project-URL: Changelog, https://github.com/LeoLoudWarden/sericite/blob/main/CHANGELOG.md
9
+ Author: LeoLoudWarden
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: interpreter,isolation,language,sandbox,scripting-language,virtual-machine
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Interpreters
21
+ Requires-Python: >=3.12
22
+ Provides-Extra: demo
23
+ Requires-Dist: python-dotenv; extra == 'demo'
24
+ Requires-Dist: requests; extra == 'demo'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Sericite
28
+
29
+ [![CI](https://github.com/LeoLoudWarden/sericite/actions/workflows/ci.yml/badge.svg)](https://github.com/LeoLoudWarden/sericite/actions/workflows/ci.yml)
30
+ [![PyPI](https://img.shields.io/pypi/v/sericite)](https://pypi.org/project/sericite/)
31
+ [![Python](https://img.shields.io/pypi/pyversions/sericite)](https://pypi.org/project/sericite/)
32
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/LeoLoudWarden/sericite/blob/main/LICENSE)
33
+
34
+ **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.
35
+
36
+ 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.
37
+
38
+ [中文文档与项目说明](https://github.com/LeoLoudWarden/sericite/blob/main/README.zh-CN.md)
39
+
40
+ ## Status
41
+
42
+ 0.2.0 prototype. The engine is a Python reference implementation (codename **Sericite-PY**): zero runtime dependencies, Python ≥ 3.12, 198 regression tests. APIs and semantics may change before 1.0.
43
+
44
+ > **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](https://github.com/LeoLoudWarden/sericite/blob/main/docs/security.md) for exactly what is and is not guaranteed.
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ pip install sericite
50
+ ```
51
+
52
+ The distribution is named `sericite`; the import package is `sericite`.
53
+
54
+ ## Quick start
55
+
56
+ As a CLI:
57
+
58
+ ```bash
59
+ printf 'print("hello from sericite")\n' > hello.sericite
60
+ sericite hello.sericite # hello from sericite
61
+ ```
62
+
63
+ Embedded in Python:
64
+
65
+ ```python
66
+ from sericite import SericiteEngine
67
+
68
+ engine = SericiteEngine()
69
+ vm = engine.create_root("""
70
+ sub = VM("print('hello from a child VM')")
71
+ print(sub.run())
72
+ """)
73
+ print(vm.run(), end="")
74
+ ```
75
+
76
+ Grant a capability to a VM (FFI):
77
+
78
+ ```python
79
+ def double(x):
80
+ return x * 2
81
+
82
+ vm = engine.create_root("print(double(21))", functions={"double": double})
83
+ print(vm.run(), end="") # 42
84
+ ```
85
+
86
+ ## What a Sericite VM is
87
+
88
+ A VM is a cheap, self-contained workspace:
89
+
90
+ - it cannot see its parent's variables, files, or handles, and cannot tell how deep it is nested;
91
+ - it has its own empty in-memory filesystem (text only — structurally unable to touch the real disk);
92
+ - 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;
93
+ - its parent can preset files, feed input, single-step it statement by statement or instruction by instruction, snapshot its state, or terminate it;
94
+ - it can create its own child VMs — isolation is recursive, because untrusted code is.
95
+
96
+ ## Documentation
97
+
98
+ | Document | Language | Contents |
99
+ |---|---|---|
100
+ | [Design notes](https://github.com/LeoLoudWarden/sericite/blob/main/docs/design.md) | EN | What Sericite is, why it exists, where the boundaries are ([中文](https://github.com/LeoLoudWarden/sericite/blob/main/docs/design.zh-CN.md)) |
101
+ | [Prior art](https://github.com/LeoLoudWarden/sericite/blob/main/docs/prior-art.md) | EN | Safe-Tcl and related work: what Sericite inherits, what it adds ([中文](https://github.com/LeoLoudWarden/sericite/blob/main/docs/prior-art.zh-CN.md)) |
102
+ | [Language reference](https://github.com/LeoLoudWarden/sericite/blob/main/docs/language-reference.md) | EN | The language subset and semantics, self-contained ([中文](https://github.com/LeoLoudWarden/sericite/blob/main/docs/language-reference.zh-CN.md)) |
103
+ | [Architecture](https://github.com/LeoLoudWarden/sericite/blob/main/docs/architecture.zh-CN.md) | 中文 | Engine structure, invariants, resource quotas |
104
+ | [Security model](https://github.com/LeoLoudWarden/sericite/blob/main/docs/security.md) | EN | Threat model; what the engine does and does not guarantee ([中文](https://github.com/LeoLoudWarden/sericite/blob/main/docs/security.zh-CN.md)) |
105
+ | [Build journal](https://github.com/LeoLoudWarden/sericite/blob/main/docs/stages/README.md) | 中文 | How Sericite 0.1.0 was built, stage by stage, with runnable checkpoints (`git checkout stage-1` … `stage-6`) |
106
+ | [Behind the scenes](https://github.com/LeoLoudWarden/sericite/blob/main/docs/behind-the-scenes/README.md) | 中文 | Origin story and how AI-assisted development was used |
107
+
108
+ Architecture notes, build journal, and behind-the-scenes are currently 中文-only; English versions are planned.
109
+
110
+ ## How this project was built
111
+
112
+ 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](https://github.com/LeoLoudWarden/sericite/blob/main/docs/behind-the-scenes/ai-assisted-development.zh-CN.md) (中文), with selected conversation records alongside.
113
+
114
+ ## Roadmap
115
+
116
+ - List/dict/string methods and more ergonomic syntax
117
+ - Performance benchmarks (child-VM creation cost, per-instruction overhead)
118
+ - A normative language spec and a conformance test suite, so a future non-Python engine can be validated against them
119
+ - Evaluation of a native engine (the package name is language-level on purpose: `sericite` survives an engine rewrite)
120
+
121
+ ## The name
122
+
123
+ 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.
124
+
125
+ (The project was briefly named Mica/MicaLang; it was renamed after discovering the name was occupied multiple times over, including an actively developed commercial language publishing Docker images under the `micalang` namespace.)
126
+
127
+ ## License
128
+
129
+ [Apache-2.0](https://github.com/LeoLoudWarden/sericite/blob/main/LICENSE) — see [NOTICE](https://github.com/LeoLoudWarden/sericite/blob/main/NOTICE).