pyre-icp
Build, run, and deploy PYRE apps — Flask-flavored Python backends on the Internet Computer (ICP). Use when writing PYRE canister code, debugging Kybra builds, deploying to a local replica or mainnet, or reaching for randomness/crypto/signing/external APIs inside a canister.
- License 许可
- MIT
- 最近更新
- 2026-07-20
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- pyre-icp
- description
- Build, run, and deploy PYRE apps — Flask-flavored Python backends on the Internet Computer (ICP). Use when writing PYRE canister code, debugging Kybra builds, deploying to a local replica or mainnet, or reaching for randomness/crypto/signing/external APIs inside a canister.
02 资源文件 267
- 参考文档.claude-plugin/marketplace.json1.0 KB
- 参考文档.claude-plugin/plugin.json758 B
- 参考文档.github/workflows/ci.yml5.3 KB
- 参考文档.github/workflows/publish.yml2.1 KB
- 其他.gitignore133 B
- 参考文档canister_ids.json254 B
- 参考文档CONTRIBUTING.md1.7 KB
- 参考文档DECISIONS.md54.8 KB
- 参考文档dfx.json1.1 KB
- 参考文档docs/adapters.md5.0 KB
- 参考文档docs/analytics.md1.2 KB
- 参考文档docs/api.md7.1 KB
- 参考文档docs/assets.md1.3 KB
- 参考文档docs/audit.md945 B
- 参考文档docs/candid-xnet.md1.4 KB
- 参考文档docs/concepts.md4.2 KB
- 参考文档docs/crypto.md7.4 KB
- 参考文档docs/extending-with-rust.md4.5 KB
- 参考文档docs/observability.md1.9 KB
- 参考文档docs/oidc.md8.6 KB
- 参考文档docs/quickstart.md6.1 KB
- 参考文档docs/random-uuid-time.md4.8 KB
- 参考文档docs/README.md5.2 KB
- 参考文档docs/secrets-and-outcalls.md4.1 KB
- 参考文档docs/static-serving.md6.1 KB
- 参考文档docs/stdlib-matrix.md10.4 KB
- 参考文档docs/tasks.md1.2 KB
- 参考文档docs/testing.md1.9 KB
- 参考文档docs/troubleshooting.md4.3 KB
- 脚本examples/crypto_demo/src/main.py3.7 KB
- 脚本examples/food_tracker/src/app.py3.1 KB
- 脚本examples/food_tracker/src/main.py2.9 KB
- 参考文档examples/full-stack-app/PyreBlog/API.md11.7 KB
- 其他examples/full-stack-app/PyreBlog/backend/.gitignore40 B
- 脚本examples/full-stack-app/PyreBlog/backend/build_native_mainnet.sh2.7 KB
- 参考文档examples/full-stack-app/PyreBlog/backend/canister_ids.json64 B
- 参考文档examples/full-stack-app/PyreBlog/backend/dfx.json125 B
- 参考文档examples/full-stack-app/PyreBlog/backend/README.md4.8 KB
- 脚本examples/full-stack-app/PyreBlog/backend/scripts/seed.sh255 B
- 脚本examples/full-stack-app/PyreBlog/backend/scripts/smoke_comments.sh3.8 KB
- 脚本examples/full-stack-app/PyreBlog/backend/scripts/smoke.sh3.0 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/app.py31.6 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/main.py3.5 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/pyrepress/__init__.py100 B
- 脚本examples/full-stack-app/PyreBlog/backend/src/pyrepress/comments.py6.0 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/pyrepress/config.py2.3 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/pyrepress/feed.py2.4 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/pyrepress/posts.py6.9 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/pyrepress/renderer.py5.7 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/pyrepress/seeds.py5.5 KB
- 脚本examples/full-stack-app/PyreBlog/backend/src/pyrepress/sessions.py4.1 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/conftest.py2.7 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_api_admin.py3.7 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_api_lists.py2.5 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_api_posts.py6.3 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_certification.py4.2 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_comments_auth.py10.7 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_dev_login.py1.7 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_feed_meta_seed.py4.0 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_model.py5.2 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_render.py1.9 KB
- 脚本examples/full-stack-app/PyreBlog/backend/tests/test_static_mount.py2.7 KB
- 参考文档examples/full-stack-app/PyreBlog/FRICTION.md7.9 KB
- 其他examples/full-stack-app/PyreBlog/frontend/.env426 B
- 其他examples/full-stack-app/PyreBlog/frontend/.env.development349 B
- 其他examples/full-stack-app/PyreBlog/frontend/.env.production898 B
- 其他examples/full-stack-app/PyreBlog/frontend/.gitignore45 B
- 脚本examples/full-stack-app/PyreBlog/frontend/env.d.ts496 B
- 参考文档examples/full-stack-app/PyreBlog/frontend/index.html2.2 KB
- 参考文档examples/full-stack-app/PyreBlog/frontend/package-lock.json56.1 KB
- 参考文档examples/full-stack-app/PyreBlog/frontend/package.json742 B
- 参考文档examples/full-stack-app/PyreBlog/frontend/README.md4.3 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/api/client.ts9.9 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/api/mock.ts17.0 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/api/types.ts2.6 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/App.vue12.1 KB
- 资产文件examples/full-stack-app/PyreBlog/frontend/src/assets/covers/cover-certified.webp9.5 KB
- 资产文件examples/full-stack-app/PyreBlog/frontend/src/assets/covers/cover-code.webp7.9 KB
- 资产文件examples/full-stack-app/PyreBlog/frontend/src/assets/covers/cover-flame.webp5.9 KB
- 资产文件examples/full-stack-app/PyreBlog/frontend/src/assets/covers/cover-network.webp7.6 KB
- 资产文件examples/full-stack-app/PyreBlog/frontend/src/assets/fonts/space-grotesk-latin.woff221.8 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/components/CommentsSection.vue8.5 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/components/EmptyState.vue1.0 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/components/FlameLogo.vue1.7 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/components/PostCard.vue4.2 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/components/PostCardSkeleton.vue728 B
- 其他examples/full-stack-app/PyreBlog/frontend/src/components/TagFilter.vue680 B
- 其他examples/full-stack-app/PyreBlog/frontend/src/components/VerifyPanel.vue10.1 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/composables/useGoogleAuth.ts1.7 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/composables/useTheme.ts583 B
- 脚本examples/full-stack-app/PyreBlog/frontend/src/config/site.ts1.8 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/main.ts790 B
- 脚本examples/full-stack-app/PyreBlog/frontend/src/router/index.ts1.9 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/stores/auth.ts1.5 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/stores/meta.ts1.3 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/stores/posts.ts1.7 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/styles/main.css9.3 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/theme.ts1.8 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/utils/format.ts1.9 KB
- 脚本examples/full-stack-app/PyreBlog/frontend/src/utils/icons.ts486 B
- 脚本examples/full-stack-app/PyreBlog/frontend/src/utils/markdown.ts419 B
- 脚本examples/full-stack-app/PyreBlog/frontend/src/utils/sanitize.ts461 B
- 其他examples/full-stack-app/PyreBlog/frontend/src/views/ComposeView.vue9.8 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/views/HomeView.vue15.8 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/views/LoginView.vue3.9 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/views/ModerateView.vue4.7 KB
- 其他examples/full-stack-app/PyreBlog/frontend/src/views/NotFoundView.vue762 B
- 其他examples/full-stack-app/PyreBlog/frontend/src/views/PostView.vue5.6 KB
- 参考文档examples/full-stack-app/PyreBlog/frontend/tsconfig.app.json688 B
- 参考文档examples/full-stack-app/PyreBlog/frontend/tsconfig.json119 B
- 参考文档examples/full-stack-app/PyreBlog/frontend/tsconfig.node.json396 B
- 脚本examples/full-stack-app/PyreBlog/frontend/vite.config.ts2.3 KB
- 参考文档examples/full-stack-app/PyreBlog/README.md8.3 KB
- 脚本examples/full-stack-app/PyreBlog/scripts/e2e_integrated.sh6.3 KB
- 参考文档examples/full-stack-app/PyreBlog/SPEC.PyreBlog.md11.7 KB
- 脚本examples/oidc_spike/src/main.py15.0 KB
- 脚本examples/outbound/src/app.py2.2 KB
- 脚本examples/outbound/src/main.py2.9 KB
- 脚本examples/outbound/src/supa_config.example.py797 B
- 脚本examples/phase1_spike/src/main.py4.7 KB
- 脚本examples/rest_api/src/app.py1.5 KB
- 脚本examples/rest_api/src/main.py2.9 KB
- 脚本examples/static_demo/src/app.py1.4 KB
- 脚本examples/static_demo/src/main.py2.4 KB
- 脚本examples/stdlib_audit/src/main.py5.2 KB
- 其他examples/vnext_exercise/interfaces/counter.did111 B
- 脚本examples/vnext_exercise/src/app.py3.8 KB
- 脚本examples/vnext_exercise/src/generated/__init__.py—
- 脚本examples/vnext_exercise/src/generated/counter_service.py473 B
- 脚本examples/vnext_exercise/src/main.py3.3 KB
- 资产文件img/pyre-bg.jpg133.5 KB
- 资产文件img/pyre-header.jpg79.2 KB
- 资产文件img/pyre-larger-banner.jpg66.1 KB
- 资产文件img/pyre.jpg100.0 KB
- 参考文档internal-docs/PYRE-vNext-Implementation-and-Security-Review.md6.5 KB
- 参考文档internal-docs/PYRE-vNext-Manual-Testing-Guide.md13.6 KB
- 参考文档internal-docs/PYRE-vNext-Requirements-and-Technical-Spec.md52.9 KB
- 许可证LICENSE1.0 KB
- 其他Makefile2.9 KB
- 其他pyproject.toml1.3 KB
- 其他pyre_native/Cargo.toml2.5 KB
- 脚本pyre_native/src/pyre_native.rs10.4 KB
- 参考文档PYRE-MVP-Requirements.md24.6 KB
- 脚本pyre/__init__.py2.0 KB
- 脚本pyre/_asset_store.py15.7 KB
- 脚本pyre/_audit.py9.1 KB
- 脚本pyre/_candid_codegen.py1.5 KB
- 脚本pyre/_candid_parser.py7.5 KB
- 脚本pyre/_lifecycle.py1.6 KB
- 脚本pyre/_namespace.py1.7 KB
- 脚本pyre/_platform.py3.1 KB
- 脚本pyre/_runtime.py874 B
- 脚本pyre/adapters/__init__.py681 B
- 脚本pyre/adapters/supabase.py10.5 KB
- 脚本pyre/adapters/upstash.py5.9 KB
- 脚本pyre/analytics.py10.2 KB
- 脚本pyre/application.py13.6 KB
- 脚本pyre/assets.py7.5 KB
- 脚本pyre/auth.py7.0 KB
- 脚本pyre/candid.py5.2 KB
- 脚本pyre/certification.py13.5 KB
- 脚本pyre/cli.py27.5 KB
- 脚本pyre/compat/__init__.py75 B
- 脚本pyre/compat/_stubs.py3.6 KB
- 脚本pyre/compat/urllib_request.py1.9 KB
- 脚本pyre/cors.py2.8 KB
- 脚本pyre/crypto.py14.0 KB
- 脚本pyre/data.py7.1 KB
- 脚本pyre/dev.py4.4 KB
- 脚本pyre/errors.py1.7 KB
- 脚本pyre/gateway.py3.9 KB
- 脚本pyre/http_types.py4.5 KB
- 脚本pyre/kv.py4.0 KB
- 脚本pyre/log.py2.8 KB
- 脚本pyre/oidc.py19.7 KB
- 脚本pyre/outcall.py11.3 KB
- 脚本pyre/prandom.py10.6 KB
- 脚本pyre/ptime.py2.7 KB
- 脚本pyre/puuid.py719 B
- 脚本pyre/routing.py5.6 KB
- 脚本pyre/sign.py9.1 KB
- 脚本pyre/static.py29.5 KB
- 脚本pyre/tasks.py13.5 KB
- 其他pyre/templates/bare-api/.gitignore33 B
- 参考文档pyre/templates/bare-api/dfx.json132 B
- 参考文档pyre/templates/bare-api/README.md1000 B
- 脚本pyre/templates/bare-api/src/app.py654 B
- 脚本pyre/templates/bare-api/src/main.py3.3 KB
- 其他pyre/templates/crud-kv/.gitignore33 B
- 参考文档pyre/templates/crud-kv/dfx.json132 B
- 参考文档pyre/templates/crud-kv/README.md1000 B
- 脚本pyre/templates/crud-kv/src/app.py1.6 KB
- 脚本pyre/templates/crud-kv/src/main.py3.3 KB
- 其他pyre/templates/outbound-proxy/.gitignore33 B
- 参考文档pyre/templates/outbound-proxy/dfx.json132 B
- 参考文档pyre/templates/outbound-proxy/README.md1000 B
- 脚本pyre/templates/outbound-proxy/src/app.py1.3 KB
- 脚本pyre/templates/outbound-proxy/src/main.py3.3 KB
- 脚本pyre/testing.py15.4 KB
- 脚本pyre/transform.py2.1 KB
- 脚本pyre/validation.py3.4 KB
- 脚本pyre/xnet.py15.5 KB
- 参考文档README.md12.0 KB
- 参考文档ROADMAP.MD27.9 KB
- 脚本scripts/bls-verify/DECISIONS.md1.7 KB
- 脚本scripts/bls-verify/package-lock.json12.7 KB
- 脚本scripts/bls-verify/package.json386 B
- 脚本scripts/bls-verify/verify.mjs2.5 KB
- 脚本scripts/budget_gate.sh1.5 KB
- 脚本scripts/build_native.sh4.2 KB
- 脚本scripts/build_wheel.sh328 B
- 脚本scripts/determinism_test.sh1.8 KB
- 脚本scripts/e2e_local.sh6.6 KB
- 脚本scripts/e2e_offline.py1.4 KB
- 脚本scripts/mainnet_cost.sh2.6 KB
- 脚本scripts/mainnet_gate.sh2.8 KB
- 脚本scripts/mainnet_sign_gate.sh1.9 KB
- 脚本scripts/measure_budgets.sh1.0 KB
- 脚本scripts/pocketic_setup.sh2.0 KB
- 脚本scripts/size_gate.sh3.6 KB
- 脚本scripts/size_thresholds.env1.4 KB
- 脚本scripts/teardown_mainnet.sh1.7 KB
- 脚本scripts/verify_certification.py6.7 KB
- 脚本scripts/verify_signature.py3.2 KB
- 脚本setup.py1.6 KB
- 参考文档test-findings.md16.6 KB
- 脚本tests/conftest.py986 B
- 脚本tests/pocketic/conftest.py15.0 KB
- 脚本tests/pocketic/test_pocketic.py4.3 KB
- 脚本tests/unit/test_adapters.py5.3 KB
- 脚本tests/unit/test_analytics.py3.7 KB
- 脚本tests/unit/test_asset_store.py5.0 KB
- 脚本tests/unit/test_assets_cli.py2.1 KB
- 脚本tests/unit/test_assets.py7.0 KB
- 脚本tests/unit/test_audit.py4.8 KB
- 脚本tests/unit/test_auth.py2.8 KB
- 脚本tests/unit/test_basic_auth.py7.5 KB
- 脚本tests/unit/test_candid_codegen.py1.1 KB
- 脚本tests/unit/test_candid_parser.py3.0 KB
- 脚本tests/unit/test_candid_runtime.py1.3 KB
- 脚本tests/unit/test_certification.py9.5 KB
- 脚本tests/unit/test_cli_footguns.py3.3 KB
- 脚本tests/unit/test_crypto.py8.7 KB
- 脚本tests/unit/test_data.py4.8 KB
- 脚本tests/unit/test_entropy_defusal.py2.6 KB
- 脚本tests/unit/test_error_codes.py907 B
- 脚本tests/unit/test_gateway.py2.2 KB
- 脚本tests/unit/test_kv.py1.2 KB
- 脚本tests/unit/test_lifecycle.py1.4 KB
- 脚本tests/unit/test_log.py1.4 KB
- 脚本tests/unit/test_namespace.py978 B
- 脚本tests/unit/test_oidc.py22.0 KB
- 脚本tests/unit/test_outcall.py5.3 KB
- 脚本tests/unit/test_platform.py1.9 KB
- 脚本tests/unit/test_prandom.py8.7 KB
- 脚本tests/unit/test_ptime.py2.2 KB
- 脚本tests/unit/test_pump_edges.py3.1 KB
- 脚本tests/unit/test_routing.py5.0 KB
- 脚本tests/unit/test_sign.py4.0 KB
- 脚本tests/unit/test_static.py25.1 KB
- 脚本tests/unit/test_stubs.py1.5 KB
- 脚本tests/unit/test_tasks.py7.2 KB
- 脚本tests/unit/test_template_vnext.py473 B
- 脚本tests/unit/test_testing_public_api.py3.7 KB
- 脚本tests/unit/test_transform.py1.9 KB
- 脚本tests/unit/test_wsa_surface.py8.5 KB
- 脚本tests/unit/test_xnet.py5.4 KB
03 SKILL.md 正文
Working with PYRE (Python Runtime for the Edge)
PYRE is a Flask-flavored Python framework that runs on ICP canisters via Kybra 0.7.1 (RustPython 3.10 → WASM). This file is the operational knowledge an agent needs. It links to the live docs rather than restating them — follow the links for current APIs; trust this file for the rules and traps.
Live docs root: https://github.com/Sweet-Papa-Technologies/PYRE/tree/main/docs
- API reference: docs/api.md
- Quickstart: docs/quickstart.md
- Concepts (query/update, outcalls, transforms, funding): docs/concepts.md
- Troubleshooting (symptom → cause → fix): docs/troubleshooting.md
- What stdlib works in-canister: docs/stdlib-matrix.md
- Platform facts + every measured number: DECISIONS.md
Environment setup (exact versions matter)
pip install pyre-icp # library + `pyre` CLI (import name: pyre)
# Deploying canisters additionally needs:
# Python 3.10.x (Kybra's RustPython is 3.10 — use pyenv)
# dfx: DFXVM_INIT_YES=true sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
# In the project's deploy venv: pip install kybra==0.7.1
# python -m kybra install-dfx-extension
Two-venv pattern (important): a lean deploy venv with only kybra + pyre-icp (Kybra bundles the whole site-packages into the wasm) and a separate dev venv for pytest/tooling. Kybra builds require the deploy venv to be active. First build compiles a Rust toolchain (~20 min); later builds are fast.
The golden rules (violating these breaks consensus or worse)
- Never use stdlib entropy in-canister.
uuid.uuid4(),os.urandom(),secrets.*have NO entropy source — pyre defuses them to raiseFakeEntropyError. Usepyre.random.uuid4()(ids) orawait pyre.random.raw_bytes(n)(cryptographic, update-only).random.random()/datetime.now()work but are dev-warned; timestamps viapyre.time== IC consensus time. - Writes and outcalls need update context. GET routes are queries;
mark routes
update=True(or use POST/async) to writepyre.kvor callurlopen. Query-context violations raise typed errors, locally too. - Outcalls fan out ~13× (one per replica). Every external write must
be idempotent — client-generated keys + upserts. The adapters
(
pyre.adapters.supabase/upstash) enforce this shape; don't bypass them with raw POSTs to DBs. GET/HEAD/POST only, ~2s latency. - Outcall responses must be byte-identical across replicas — always use a transform (default strips volatile headers); volatile JSON body fields need a custom transform (see examples/phase1_spike).
- IPv6 first. Replicas prefer AAAA; IPv4-only hosts ride an automatic platform fallback that works for some providers (verified: Supabase) but not all — test your provider from mainnet before depending on it.
- Never write plaintext secrets to canister state or logs — node
operators can read canister memory. Secret-bearing outcalls (Stripe
keys etc.) are a documented limitation:
docs/secrets-and-outcalls.md.
Canister-side
pyre.cryptoencryption does NOT hide data from node operators (key lives in canister memory): docs/crypto.md. - File basenames must not collide with stdlib/framework/CDK module
names (Kybra flattens all modules to top-level basenames — a user
app.pyis fine, but never createrandom.py,http.py,uuid.py…).pyre new/pyre devwarn on reserved names. - vNext modules are opt-in. Import
pyre.tasks,pyre.candid,pyre.xnet,pyre.assets, or experimentalpyre.analyticsexplicitly; do not add them to eager package imports. Framework state uses versioned__pyre:<subsystem>:<schema>:keys in the existing stable map. - Timers and xnet are update-only and not transactions. Timer handles are ephemeral, task callbacks must be idempotent, xnet updates are never retried automatically, and local work around an await is not atomic with the remote call.
- Streaming is public and uncertified in its first milestone. Never put
private/authenticated media behind the gateway callback; it does not
replay application middleware. Refresh generated
main.pyto expose the streaming callback before usingpyre.assets.
Canister project shape
pyre new myapp --template crud-kv scaffolds the canonical layout:
src/app.py (routes — pure Python, testable anywhere) + src/main.py
(Kybra glue: Candid records, StableBTreeMap declaration,
http_request/http_request_update, pyre_default_transform,
@init/@post_upgrade calling app.recertify()). Rules baked into the
template that you must preserve if editing main.py:
@init/@post_upgradeneed explicit-> voidannotations.StableBTreeMapmust be declared statically inmain.py(Kybra finds it by static analysis) and handed to pyre viapyre.kv.bind_backend().- Candid record names are global and structural — no import aliases, no duplicate names across modules.
Dev loop
pyre dev src/app.py # instant local server; real HTTP for outcalls;
# prints footgun warnings + transform previews
pytest # app logic is plain Python — test it directly
dfx start --background && dfx deploy # real local replica
dfx deploy --network ic # mainnet (funding: see concepts.md)
Debugging Kybra builds (the traps, in order of hours they cost)
💣 Kybra error: compilationwith no detail → the real error is hidden; run~/.config/kybra/0.7.1/bin/kybra_generate .kybra/<canister>/py_file_names.csv main /dev/stdout 0.7.1.- Renamed/deleted a module and things got weird →
rm -rf .kybra(stale bundle cache mixes old copies in). type X used but never defined/ duplicate-type errors → Candid alias limitation; rename records (structural matching makes this safe).- Old code appears to run after deploy → partial multi-canister deploy;
check
dfx canister status <c>module hash against your local build. - Live logs without redeploying:
dfx canister logs <c> [--network ic](pyre.log lines land there).
Capability quick reference (all opt-in; links are authoritative)
- Certified responses:
@app.get(path, certified=True)— verify withscripts/verify_certification.pyor the official@dfinity/response-verification. - Threshold signing / JWTs:
pyre.sign— default keykey_1works on the local replica AND mainnet; ~26B cycles/signature; tECDSA only (CDK-gated). - Randomness/UUIDs/time:
pyre.random,pyre.uuid,pyre.time— docs/random-uuid-time.md. - Encryption/hashing:
pyre.crypto(AES-GCM, ChaCha20-Poly1305, blake3 need the native extension:scripts/build_native.sh <canister> --install; hashing/HMAC work everywhere). - External DBs:
pyre.adapters— docs/adapters.md (read the amplification section before any write path). - Extending with Rust: docs/extending-with-rust.md.
- Persistent work:
@tasks.every(...)/@tasks.after(...); no exactly-once claim. Seedocs/tasks.md. - Cross-canister calls: generate metadata with
pyre candid generate, then usexnet.CanisterClient; 1.9 MB request/reply guard. Seedocs/candid-xnet.md. - Generalized assets:
AssetStore, resumable single-file uploads, bounded deletion, and public streaming. Seedocs/assets.md. - Host safety net:
PyreTestClient.from_app(app)andpyre audit --strict. Keeppyre.testing, pytest, and PocketIC imports outside canister source. - Experimental analytics: bounded immutable
Table; not pandas-compatible.
Costs & operations (mainnet-measured; details in DECISIONS.md)
Queries ~97k cycles (≈free), updates ~27M, outcalls ~100M + 13× upstream
amplification, tECDSA signature ~26.2B, idle ~2.1B/day at ~48MB. Light
backend ≈ $0.40/month. Creating a canister costs 0.5T cycles + ~0.45T for
install (interpreter boot); every upgrade re-pays interpreter init —
keep ~0.5T balance headroom. Reclaim cycles before deleting canisters
(withdraw → confirm → delete; make teardown-mainnet in the repo does it
safely — deleting an underfunded canister burns its balance).
Repo development (working on PYRE itself)
make setup test dev deploy e2e pocketic budget-gate — CI mirrors these.
Unit tests never need a replica (the kybra seam is mocked). Any new
module: keep CDK contact behind lazy imports (the Basilisk-swap seam),
add unit tests + PocketIC coverage, and pass the size gate (wasm bloat =
idle burn forever). Record platform findings in DECISIONS.md.