Repository navigation
feat(typecheck): migrate from pyright to ty - #147
Merged
Merged
Conversation
jwulf
changed the base branch from
main
to
fix/hook-1200-required-polymorphic-list-todict
May 28, 2026 21:16
jwulf
changed the base branch from
fix/hook-1200-required-polymorphic-list-todict
to
main
May 28, 2026 21:39
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the repository’s type-checking tooling from pyright to Astral’s ty, updating configuration, build commands, docs, and applying a small set of typing-driven runtime/test fixes. This also removes the unmaintained demo/ tree and regenerates generated/stub outputs to match the new type-check baseline.
Changes:
- Replace
pyrightwithtyin dependencies, configuration (pyproject.toml), and build targets (Makefile). - Apply typing-driven fixes in
runtime/(and regenerated counterparts) and update ignore pragmas in tests/hooks. - Remove
demo/directory and update documentation/tooling references accordingly.
Reviewed changes
Copilot reviewed 79 out of 85 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Drops pyright (and nodeenv) from dev lock; adds ty locked to 0.0.40. |
pyproject.toml |
Replaces [tool.pyright] with [tool.ty.*] configuration; adds ty to dev deps; removes demo from excludes. |
Makefile |
Switches typecheck / generation pipeline type-check steps to uv run ty check (incl. examples/). |
scripts/setup-hooks.sh |
Updates hook install comment to reference ty instead of pyright. |
README.md |
Updates “Strict typing” claim to include ty compatibility. |
AGENTS.md |
Updates developer docs to reference ty as the type-check gate/tool. |
MAINTAINER.md |
Updates maintainer docs to reference ty for type-checking and related pipeline steps. |
CONTRIBUTING.md |
Updates contributor docs to reference ty for type-checking. |
.github/prompts/add-missing-examples.prompt.md |
Updates prompt instructions from pyright to ty. |
runtime/backpressure.py |
Adds _DEFAULT_CLOCK cast to satisfy stricter type-checking; uses it as the default clock. |
runtime/job_worker.py |
Removes redundant cast in strategy selection; adds Mapping cast for dict-based variables parsing. |
hooks/post_gen/0700_generate_semantic_types.py |
Removes an unused type-ignore on an isinstance check. |
tests/acceptance/test_job_worker.py |
Removes an unused # type: ignore on JobWorker construction. |
tests/acceptance/test_backpressure.py |
Updates ignore pragma to ty-style suppression for an intentional invalid-Literal test. |
generated/camunda_orchestration_sdk/runtime/backpressure.py |
Regenerated output reflecting the runtime/backpressure.py typing adjustment. |
generated/camunda_orchestration_sdk/runtime/job_worker.py |
Regenerated output reflecting the runtime/job_worker.py typing adjustment. |
stubs/camunda_orchestration_sdk/runtime/backpressure.pyi |
Stub regenerated to reflect _DEFAULT_CLOCK typing changes. |
demo/week_2/test_api.py |
Removed demo artifact (directory cleanup). |
demo/week_2/README.md |
Removed demo artifact (directory cleanup). |
demo/week_2/pyproject.toml |
Removed demo artifact (directory cleanup). |
demo/week_2/main.py |
Removed demo artifact (directory cleanup). |
demo/week_2/loan-application-process.bpmn |
Removed demo artifact (directory cleanup). |
demo/week_2/loan_workers.py |
Removed demo artifact (directory cleanup). |
demo/week_2/frontend/styles.css |
Removed demo artifact (directory cleanup). |
demo/week_2/frontend/SETUP.md |
Removed demo artifact (directory cleanup). |
demo/week_2/frontend/README.md |
Removed demo artifact (directory cleanup). |
demo/week_2/frontend/QUICKSTART.md |
Removed demo artifact (directory cleanup). |
demo/week_2/frontend/index.html |
Removed demo artifact (directory cleanup). |
demo/week_2/frontend/app.js |
Removed demo artifact (directory cleanup). |
demo/week_2/deploy_loan_process.py |
Removed demo artifact (directory cleanup). |
demo/week_2/camunda_demo_week2.egg-info/top_level.txt |
Removed demo artifact (directory cleanup). |
demo/week_2/camunda_demo_week2.egg-info/SOURCES.txt |
Removed demo artifact (directory cleanup). |
demo/week_2/camunda_demo_week2.egg-info/requires.txt |
Removed demo artifact (directory cleanup). |
demo/week_2/camunda_demo_week2.egg-info/PKG-INFO |
Removed demo artifact (directory cleanup). |
demo/week_2/camunda_demo_week2.egg-info/dependency_links.txt |
Removed demo artifact (directory cleanup). |
demo/week_2/.env |
Removed demo artifact (directory cleanup). |
demo/week_2/__init__.py |
Removed demo artifact (directory cleanup). |
demo/week_1/subprocess_workload.py |
Removed demo artifact (directory cleanup). |
demo/week_1/multicore_workload.py |
Removed demo artifact (directory cleanup). |
demo/week_1/io_bound_workload.py |
Removed demo artifact (directory cleanup). |
demo/week_1/demo.py |
Removed demo artifact (directory cleanup). |
demo/week_1/cpu_bound_workload.py |
Removed demo artifact (directory cleanup). |
demo/week_1/cancel_processes.py |
Removed demo artifact (directory cleanup). |
demo/week_1/__init.py__ |
Removed demo artifact (directory cleanup). |
demo/v2/scenarios/safety.json |
Removed demo artifact (directory cleanup). |
demo/v2/scenarios/README.md |
Removed demo artifact (directory cleanup). |
demo/v2/scenarios/quick.json |
Removed demo artifact (directory cleanup). |
demo/v2/scenarios/minimal.json |
Removed demo artifact (directory cleanup). |
demo/v2/scenarios/fast.json |
Removed demo artifact (directory cleanup). |
demo/v2/scenarios/baseline.json |
Removed demo artifact (directory cleanup). |
demo/v2/scenarios/.gitignore |
Removed demo artifact (directory cleanup). |
demo/v2/run_fast_validation.sh |
Removed demo artifact (directory cleanup). |
demo/v2/run_benchmark_scenarios.py |
Removed demo artifact (directory cleanup). |
demo/v2/results/README.md |
Removed demo artifact (directory cleanup). |
demo/v2/results/baseline_20251212_183413.json |
Removed demo artifact (directory cleanup). |
demo/v2/resources/job_worker_load_test_process_1.bpmn |
Removed demo artifact (directory cleanup). |
demo/v2/README.md |
Removed demo artifact (directory cleanup). |
demo/v2/QUICK_START.md |
Removed demo artifact (directory cleanup). |
demo/v2/job_worker_original.py |
Removed demo artifact (directory cleanup). |
demo/v2/generate_benchmark_scenarios.py |
Removed demo artifact (directory cleanup). |
demo/v2/BENCHMARK_GUIDE.md |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/server_probe.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/resources/bp-test-process.bpmn |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/recompute_jain.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/README.md |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/evaluate.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/compare_throughput.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/compare_results.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/compare_errors.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/compare_50c.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/analyze_results.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/analyze_full_matrix.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/analyze_floor.py |
Removed demo artifact (directory cleanup). |
demo/v2/backpressure/analyze_completions.py |
Removed demo artifact (directory cleanup). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
Replace pyright with astral's ty (https://docs.astral.sh/ty/) as the project's type checker. ty is ~10-20× faster (3.3s vs 30-60s on this repo) and aligns with our existing astral toolchain (uv, ruff). Changes: - pyproject.toml: swap pyright dev-dep for ty; replace [tool.pyright] with [tool.ty.{environment,src,rules}]. extra-paths still includes generated/; src.exclude mirrors prior pyright excludes. - Makefile: generate, generate-local, typecheck, typecheck-examples targets now invoke 'uv run ty check' instead of 'uv run pyright'. - scripts/setup-hooks.sh: comment refresh. - docs (AGENTS.md, MAINTAINER.md, CONTRIBUTING.md, README.md, prompts): command references updated. Real type fixes surfaced by ty (resolving baseline 11 → 0 diagnostics): - runtime/backpressure.py: hoist 'clock or _time_module' into a module-level cast(_Clock, _time_module) constant. ty doesn't infer module-as-Protocol compatibility automatically. - runtime/job_worker.py: drop redundant cast in _determine_strategy (ty narrows EXECUTION_STRATEGY correctly after '!= "auto"'); cast the dict-narrowed action_data to Mapping[str, Any] before passing to JobCompletionRequestVariables.from_dict (ty's intersection with the attrs Top-type otherwise rejects it). - hooks/post_gen/0700_generate_semantic_types.py: drop unused '# type: ignore'. - tests/acceptance/test_job_worker.py: drop unused '# type: ignore'. - tests/acceptance/test_backpressure.py: convert pyright-style '# type: ignore[arg-type]' to ty's '# ty: ignore[invalid-argument-type]' on the intentional invalid-Literal test. Inert legacy '# pyright: ignore[...]' comments are left in place; they're benign under ty (treated as plain comments) and useful for anyone still running pyright on the generated output. Refs: #143 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The demo/ directory contained scratch material (week_1/week_2 benchmark scripts, v2 backpressure analysis) that's not part of the published SDK or maintained alongside the generator. Removing it simplifies the repository surface — and removes a large body of code that was excluded from both ruff and the type checker anyway. Also drops the now-redundant 'demo' entries from [tool.ty.src.exclude] and [tool.ruff.extend-exclude]. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- runtime/backpressure.py (both sync + async managers): use 'clock if clock is not None else _DEFAULT_CLOCK' instead of 'clock or _DEFAULT_CLOCK', so a valid-but-falsy _Clock implementation isn't silently replaced by the default. - hooks/post_gen/0700_generate_semantic_types.py: drop the dead 'if not isinstance(schema, dict)' guard in _is_primitive_alias — the parameter is typed Dict[str, Any] and the call site already casts before calling. - MAINTAINER.md: reference 'uv run ty check' instead of 'uvx ty check' so local results use the repo-pinned ty version from uv.lock. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerated artifacts after the runtime/ + hook source fixes from this branch (rebased on latest main). Also syncs uv.lock with the post-release version bump on main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
|
/backport |
Contributor
|
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-147-to-stable/9
git worktree add --checkout .worktree/backport-147-to-stable/9 backport-147-to-stable/9
cd .worktree/backport-147-to-stable/9
git reset --hard HEAD^
git cherry-pick -x bdcd7c63ceb74d82aca8397fead50cf36b65712b 0606bc126fa03c69e49c08b21646e3a0a291684e 3a2d417789f6b3854022842a5cdc061978b47b2f d6ae7e4189d986b9b35e232260a13f5eb5609234 |
camunda-sdk-automation Bot
pushed a commit
that referenced
this pull request
Dec 1, 2026
Cherry-picked from #147 onto stable/9 with conflicts. The conflict markers are committed as-is and must be resolved before this backport is merged.
emilyoram
added a commit
that referenced
this pull request
Dec 1, 2026
The demo/ directory holds scratch material (week_1/week_2 benchmark scripts, v2 backpressure analysis) that is not part of the published SDK. main removed it in #147; stable/9 still carried it, and once code scanning started covering stable/9, its demo workers raised high-severity py/clear-text-logging-sensitive-data alerts (#26-#29) for printing simulated credit scores. Also drops the now-redundant 'demo' entries from the ty and ruff excludes. (cherry picked from commit 0606bc1) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
emilyoram
added a commit
that referenced
this pull request
Dec 1, 2026
The demo/ directory holds scratch material (week_1/week_2 benchmark scripts, v2 backpressure analysis) that is not part of the published SDK. main removed it as part of #147; stable/9 still carried it, and once code scanning started covering stable/9, its demo workers raised high-severity py/clear-text-logging-sensitive-data alerts (#26-#29) for printing simulated credit scores. Also drops the now-redundant 'demo' entries from the pyright and ruff excludes. This backports only the demo removal from #147, not its pyright-to-ty migration. (cherry picked from commit 0606bc1) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
emilyoram
added a commit
that referenced
this pull request
Dec 1, 2026
* chore: remove demo/ directory (backport from #147 to stable/9) The demo/ directory holds scratch material (week_1/week_2 benchmark scripts, v2 backpressure analysis) that is not part of the published SDK. main removed it as part of #147; stable/9 still carried it, and once code scanning started covering stable/9, its demo workers raised high-severity py/clear-text-logging-sensitive-data alerts (#26-#29) for printing simulated credit scores. Also drops the now-redundant 'demo' entries from the pyright and ruff excludes. This backports only the demo removal from #147, not its pyright-to-ty migration. (cherry picked from commit 0606bc1) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: add commitlint.config.cjs as on main and stable/10 demo/week_2/frontend/app.js was the only JavaScript file on stable/9. CodeQL default setup analyses javascript-typescript repo-wide (main and stable/10 have this config file), so without any JS on this branch its JS analysis fails on every push, and the release security gate would keep waiting for an analysis that never arrives. Carry the same one-line config main and stable/10 have so the analysis has code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Emily Oram <emily.oram@camunda.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #143. Stacked on top of #146 — merge #146 first.
Why
Migrate the project's type checker from
pyrighttoty(astral's new Python type checker, currently 0.0.40).uv run ty checkruns in ~3 s versus 30–60 s for pyright on this repo. Big win for the inner-loop pre-commit / pre-push experience and for CI.uvandruff; ty is the same family.What changed
1.
feat(typecheck): migrate from pyright to typyproject.toml: drop pyright dev-dep, addty>=0.0.40; replace[tool.pyright]with[tool.ty.{environment,src,rules}](extra-paths still includesgenerated/;src.excludemirrors the previous pyright excludes).Makefile:generate,generate-local,typecheck,typecheck-examplesall invokeuv run ty checkinstead ofuv run pyright.scripts/setup-hooks.sh: comment-only refresh (the hook itself just runsmake check, so the swap flows through automatically).AGENTS.md,MAINTAINER.md,CONTRIBUTING.md,README.md,.github/prompts/): command references updated.Real type fixes ty surfaced (baseline 11 → 0 diagnostics)
runtime/backpressure.py— module-as-Protocol: hoistclock or _time_moduleinto a module-levelcast(_Clock, _time_module)constant. ty doesn't infer module-as-Protocol structural compatibility automatically the way pyright did.runtime/job_worker.py:castin_determine_strategy: ty narrowsEXECUTION_STRATEGYcorrectly after the!= "auto"check.action_datatoMapping[str, Any]before passing toJobCompletionRequestVariables.from_dict: ty's intersection with the attrsTop-type otherwise rejects it.hooks/post_gen/0700_generate_semantic_types.py— drop unused# type: ignore.tests/acceptance/test_job_worker.py— drop unused# type: ignore.tests/acceptance/test_backpressure.py— convert# type: ignore[arg-type]to ty-aware# ty: ignore[invalid-argument-type]on the intentional invalid-Literal test.2.
chore: remove demo/ directoryThe
demo/directory contained scratch material (week_1/week_2 benchmark scripts, v2 backpressure analysis) that wasn't part of the published SDK and wasn't maintained alongside the generator. Already excluded from both ruff and the type checker, so removal is risk-free. Also drops the now-redundantdemoentries from[tool.ty.src.exclude]and[tool.ruff.extend-exclude].3.
chore(generation): regenerate SDK for ty migrationMechanical regen following the runtime/ source fixes (which are copied into
generated/.../runtime/by hook 0300).Out of scope / left for follow-up
# pyright: ignore[...]comments scattered acrossruntime/,tests/,hooks/,examples/. They're benign under ty (treated as plain comments) and remain useful for anyone running pyright on the publishedgenerated/package, so they're left in place.Verification
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com