Skip to main content

mainspring-sandbox

工具执行隔离外挂(M7/M8):@sandboxed 把同步工具放进受限 worker 子进程执行,超时真取消; core 的注册表、Hook 与审批管道只看到一个普通函数。

安装

pip install mainspring-sandbox

用法

from mainspring import tool
from mainspring_sandbox import SandboxPolicy, sandboxed

@tool
@sandboxed(SandboxPolicy())
def run_python(code: str) -> str:
    ...

装饰器顺序固定:@tool 在外层、@sandboxed 在内层;函数必须定义在模块顶层——worker 按 模块名 + __qualname__ 定位原函数。

三档引擎:SubprocessEngine(全平台,用户态 audit hook)、BwrapEngine(Linux namespace)、 SeatbeltEngine(macOS sandbox);引擎不可用时注册期显式报错,不静默降级。 Windows 另有 WindowsJobEngine,进程树随主进程退出一起回收。

mainspring 工作区成员,与 core 同源。MIT。

Metadata

Release files for mainspring-sandbox 0.1.1

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

Source distribution (sdist)

Source distribution for mainspring-sandbox 0.1.1
File Size Uploaded Provenance Actions
mainspring_sandbox-0.1.1.tar.gz 19.6 kB With provenance Details for mainspring_sandbox-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mainspring-sandbox 0.1.1
File Interpreter ABI Platform Actions
mainspring_sandbox-0.1.1-py3-none-any.whl Python 3 none any Details for mainspring_sandbox-0.1.1-py3-none-any.whl

Total release size: 46.5 kB

Release files / mainspring_sandbox-0.1.1.tar.gz

Download URL mainspring_sandbox-0.1.1.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2da26dcbf85a3794d11da07038023d7b90ffa4662a354b5160964d2987363697
BLAKE2b-256 checksum
How to use checksums
3e20f86cf2ff764c4660e02bfe58184c91342a6c98882ba55d327c32fbaba1cb
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 Dec 6, 2026.

Transparency log

Release files / mainspring_sandbox-0.1.1-py3-none-any.whl

Download URL mainspring_sandbox-0.1.1-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79832357013a4565f0631ada8190344d7bcace3f707f93840775d764c2505083
BLAKE2b-256 checksum
How to use checksums
0e79fea438a5922ee6b08eb871b369d6999f85843f94fbbcac22ec77f791a90d
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 Dec 6, 2026.

Transparency log

Security for mainspring-sandbox 0.1.1

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 mainspring_sandbox-0.1.1.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 Dec 6, 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.

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