Skip to content

Generate cache type stubs to help edit user scripts#1338

Draft
tpoliaw wants to merge 10 commits intouser-clientfrom
cache-stubs
Draft

Generate cache type stubs to help edit user scripts#1338
tpoliaw wants to merge 10 commits intouser-clientfrom
cache-stubs

Conversation

@tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented Jan 15, 2026

When editing scripts that make use of the dynamic plan/device access in
the new client, there is no type checking available by default (as the
available plans are unknown). This adds a subcommand to generate a
type-stubs package for the currently running server to help write scripts.

blueapi generate-stubs /tmp/blueapi-stubs
pip install --editable /tmp/blueapi-stubs

type checkers and LSPs will then be able to check scripts for correct plan
names/arguments/etc as well as providing completions while editing.

@tpoliaw tpoliaw changed the base branch from main to user-client January 15, 2026 22:53
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.32%. Comparing base (f752763) to head (6faf01c).

Additional details and impacted files
@@               Coverage Diff               @@
##           user-client    #1338      +/-   ##
===============================================
+ Coverage        95.16%   95.32%   +0.15%     
===============================================
  Files               43       45       +2     
  Lines             3002     3099      +97     
===============================================
+ Hits              2857     2954      +97     
  Misses             145      145              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Mainly to make supporting type stubs easier
When editing scripts that make use of the dynamic plan/device access in
the new client, there is no type checking available by default (as the
available plans are unknown. This adds a subcommand to generate a
type-stubs package for the currently running server to help write scripts.

    blueapi generate-stubs /tmp/blueapi-stubs
    pip install --editable /tmp/blueapi-stubs

type checkers and LSPs will then be able to check scripts for correct plan
names/arguments/etc as well as providing completions while editing.
Enable testing with StringIO
It was already included via fastapi but if we're using it directly we should
probably include it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant