This release is a pre-release and may not be stable for production use.
pyxis-harness-launcher
启动器:pyh 命令、profile 的 uv 项目与环境、supervisor。harness 自身是 profile 项目的一个依赖,装在 profile 的环境里。
| 项 | 值 |
|---|---|
| 分发包 | pyxis-harness-launcher |
| 模块 | pyxis_harness_launcher |
| 命令 | pyh(pyxis_harness_launcher.cli:main) |
| 依赖 | uv(版本锁定) |
| 插件 entry point | 无 |
使用
| 步骤 | 命令 |
|---|---|
| 安装 | 在一个 uv 项目里 uv add pyxis-harness-launcher;Python 3.12 及以上 |
| 创建 profile | uv run pyh init;首次联网,把 harness 装进 profile 的环境 |
| 启动 | uv run pyh run;浏览器打开 http://127.0.0.1:8765 |
| 文档 | https://github.com/Onenightcarnival/pyharness |
文件
| 文件 | 内容 |
|---|---|
__init__.py |
公开名称 |
protocol.py |
启动器与环境内 harness 的约定 |
layout.py |
profile 的文件:路径、快照、last-known-good、锁对应的环境 |
project.py |
profile 的 pyproject.toml;harness 作为依赖的声明 |
environment.py |
uv 的调用:锁定、构建、wheel、迁移、清理 |
supervisor.py |
一次运行一代 worker;重启与回滚 |
cli.py |
pyh 命令行 |
两处安装
| 安装 | 内容 | 版本 |
|---|---|---|
| 启动器所在的环境:用户的 uv 项目 | 本包与 uv |
该项目的 uv.lock |
profile 的环境(envs/<键>/) |
harness(pyxis-harness)、它的全部依赖、装进 profile 的包 |
uv.lock 记录的版本 |
环境内的 harness 也依赖本包:manage 用同一组函数改声明、锁定、构建。两处的本包版本可以不同,靠 protocol.py 互通。
约定(protocol.py)
| 名称 | 值 | 含义 |
|---|---|---|
KERNEL |
pyxis-harness |
profile 项目依赖的分发包:harness |
KERNEL_SOURCE_ENV |
PYH_KERNEL_SOURCE |
harness 取自该检出目录,不取自索引 |
CLI_MODULE |
pyxis_harness.cli |
python -m:harness 的全部命令 |
WORKER_MODULE |
pyxis_harness.worker |
python -m:一代 |
PREFLIGHT_MODULE |
pyxis_harness.preflight |
python -m:试启动;能启动时退出 0 |
BUNDLE_GROUP |
pyxis_harness.bundles |
bundle 的 entry point 组 |
RESTART_EXIT_CODE |
75 | worker:启动下一代 |
BOOT_FAILURE_EXIT_CODE |
3 | worker:本代启动失败 |
ENV_READY |
.pyxis-harness-ready |
环境内的文件:已完整建成 |
文件上的约定:pyproject.toml、uv.lock、envs/<键>/、wheels/<哈希>/、runtime/ 下的 ready 标记、boot-error.json、rollback.json、supervisor.pid、last-known-good/。
Profile 的文件(layout.py)
ProfileDir:不读 YAML;harness 的 Profile 继承它。
| 路径 | 内容 |
|---|---|
pyproject.toml |
profile 的包:一个 uv 项目的声明 |
uv.lock |
该声明解析出的版本与哈希 |
wheels/<哈希>/ |
从本地目录安装的包:构建出的 wheel |
envs/<键>/ |
按 uv.lock 构建的环境;键由锁文件内容与解释器版本算出 |
| 方法 | 返回 |
|---|---|
env() |
uv.lock 对应的已建成环境;没有时 None |
python() |
该环境的解释器;没有环境时为当前解释器 |
site_packages() |
该环境的 site-packages;旧版本的 site/;都没有时 None |
快照与 last-known-good 是同一组文件:profile.yaml、profile patch、pyproject.toml、uv.lock。
项目声明(project.py)
[project]
name = "pyxis-harness-profile"
version = "0"
requires-python = "==3.12.*"
dependencies = [
"pyxis-harness==0.1.1",
"pyh-todo",
]
[tool.uv]
package = false
[tool.uv.sources]
"pyh-todo" = { path = "wheels/c37b630f4ae3355d/pyh_todo-0.1.0-py3-none-any.whl" }
| 包的来源 | 声明 |
|---|---|
| 本地目录、源码包、wheel | 构建为 wheel,存入 wheels/<哈希>/;tool.uv.sources 指向它,锁文件记录其哈希 |
| 索引中的包 | 需求原文;给出索引地址时把该包钉在这个索引上:tool.uv.sources 的 index,索引为 explicit(只用于钉在它上面的包);索引可命名,多个包共用一个 |
harness 的声明(declare_kernel):
kernel_source() |
声明 |
|---|---|
PYH_KERNEL_SOURCE 指向的检出目录 |
pyxis-harness,以可编辑方式取自 <检出目录>/packages/meta |
| 本包以可编辑方式装自一个检出目录 | 同上,取自该检出目录 |
| 无 | pyxis-harness==<本包的版本> |
write_project 写入的项目总是声明 harness。
环境(environment.py)
| 文件 | 含义 | 写入 |
|---|---|---|
pyproject.toml |
期望:装哪些包、各自的来源 | write_project |
uv.lock |
事实:每个包的版本与哈希 | uv lock |
envs/<键>/ |
由 uv.lock 推导;可删除,可重建 |
uv sync --frozen |
环境是不可变的:同一份锁对应同一个目录,变更产生新目录。
| 函数 | 效果 |
|---|---|
lock |
uv lock;已锁定的版本保持,先用缓存,缺文件时联网;upgrade=<名称> 把该包升到需求允许的最新版(联网);cached=True:需求只指一个版本时,升级也先用缓存 |
build |
uv sync --frozen 到 envs/<键>/;已建成的环境保持 |
prune |
删除当前文件与 last-known-good 都不指向的环境和 wheel |
prepare |
一代启动之前:见下表 |
migrate |
旧版本的 site/ → 项目、锁、环境 |
prepare 遇到 |
动作 |
|---|---|
旧版本的 site/ |
migrate |
没有 pyproject.toml |
bootstrap=True:声明 harness,锁定、构建;否则无 |
| 项目没有声明 harness | 声明,锁定、构建 |
| harness 取自检出目录 | 锁定、构建 |
没有 uv.lock |
锁定、构建 |
没有 uv.lock 对应的环境 |
构建 |
migrate:
| 步骤 | 效果 |
|---|---|
| 1 | site/ 中带 bundle 的每个分发包:按已安装的文件重新打包进 wheels/,写入声明 |
| 2 | 锁定、构建 |
| 3 | site/ 改名为 site.migrated/;声明与锁并入 last-known-good |
| 失败 | 恢复原文件;site/ 继续使用 |
联网的 uv 调用把输出写到 stderr(echo):首次构建下载 harness 的全部依赖。
Supervisor(supervisor.py)
一次运行一代 worker;每一代用 ProfileDir.python():当时的 uv.lock 所对应环境的解释器。
每一代启动之前:prepare;未解决的问题记入日志与 environment 事件,该代照常启动。
| worker 结果 | supervisor 动作 |
|---|---|
| 写出 ready 标记 | 记录 ready |
| 退出 75 | 启动下一代 |
| 退出 0,或收到 SIGINT / SIGTERM | 停止 |
| 启动失败 | 恢复 last-known-good,写 rollback.json,再启动;仅一次 |
| 启动失败,无可恢复的文件 | 退出 3 |
| 启动中被转发的信号终止 | 再启动;不回滚 |
| 启动后其他退出 | 退避重启;crash_window 内超过 max_crashes 次则停止 |
恢复的文件包含 uv.lock:harness 的版本与装进 profile 的包随配置一起回到上一次能启动的状态。
| supervisor 收到的信号 | 效果 |
|---|---|
| SIGINT、SIGTERM | 停止 worker,退出 0 |
| SIGHUP | 转发;worker 在 hold 全部释放后重启 |
事件追加写入 runtime/supervisor.log.jsonl。
命令行(cli.py)
pyh [--home HOME] <command> [-p PROFILE] ...
| 命令 | 运行处 | 效果 |
|---|---|---|
run |
启动器 | prepare;profile 不存在时在环境内 init;supervisor |
run --no-supervisor |
环境 | 一代,不受管理 |
upgrade [--to VERSION] |
启动器 | 把 profile 的 harness 换到本启动器的版本或指定版本 |
其余(init、plugin、exec、preflight、dump-config、restart) |
环境 | prepare,然后 <环境的解释器> -m pyxis_harness.cli <原参数> |
upgrade:
| 步骤 | 效果 |
|---|---|
| 1 | 声明 harness 的新版本 |
| 2 | 锁定(harness 升级,其余已锁定的版本保持)、构建新环境 |
| 3 | 在新环境内预检 |
| 4 | 能启动:保留,向运行中的 supervisor 发重启信号;不能:恢复原文件 |
启动器不自行改动 profile 的 harness 版本:两者不同时 run 打印一行提示。
Metadata
Release files for pyxis-harness-launcher 0.1.1.dev10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyxis_harness_launcher-0.1.1.dev10.tar.gz | 18.0 kB | Without provenance | Details for pyxis_harness_launcher-0.1.1.dev10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyxis_harness_launcher-0.1.1.dev10-py3-none-any.whl | Python 3 | none | any | Details for pyxis_harness_launcher-0.1.1.dev10-py3-none-any.whl |
Total release size: 44.0 kB
Release files / pyxis_harness_launcher-0.1.1.dev10.tar.gz
| Download URL | pyxis_harness_launcher-0.1.1.dev10.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
016cfe02a5db75e9d39215dffa4e3d15e626568e0c0014b89eb914fb1e751e6d
|
|
BLAKE2b-256 checksum How to use checksums |
f18dfd3c67ef913d1311276a1b521c38af7a62c233611d48ad227cf22e0ae748
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pyxis_harness_launcher-0.1.1.dev10-py3-none-any.whl
| Download URL | pyxis_harness_launcher-0.1.1.dev10-py3-none-any.whl |
|---|---|
| Size | 26.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6f03e9c01a3fe06752d84e47bdb93dc06e7c20dd4bbc6c59b944cfe6531ce70
|
|
BLAKE2b-256 checksum How to use checksums |
fe61f910d2bfc1adffb582221ed5327dbdc7512d6e6e120d45ed78eb99b90b51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pyxis-harness-launcher 0.1.1.dev10
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.