Redesign plan argument handling
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- リファクタリング
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- api, backend, backend-api-design
調査の方向性
ファイルやテストは指定されていません。まず現在の pydantic モデル変換と inject メソッドをたどり、次にリンクされている issue と既存の議論を確認して、提案されている設計を比較してください。既存の計画を維持し、injection、デバイスではないもの、複合的なオーバーライド、型チェック、位置引数または vararg 引数を、記載されている依存関係の問題なしにサポートするアプローチが決定されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
We currently build a pydantic model from the plan args and use that model to convert from the JSON params sent as part of a TaskRequest. This leads to several issues
- All arguments must be addressable via keywords. Positional only args and varargs are not supported
- Devices need special handling to convert from strings to devices #154
- Composite devices (built at runtime from existing devices) have their handling intertwined with the device name to device handling
- The
injectmethod we currently use to provide default arguments to plans means plans can't be run outside blueapi but this is not restricted by python. Eg, calling a plan defined asdef foo(mov: Movable = inject("bar")): ...fails with a run time error when trying to move the string instead of giving a type error. Type-checkers can't pick this up. - Non-devices are not supported (eg plans or clients for external services.)
Not directly related to using a model for validation but plan args are validated twice, once on submission and again when the plan is actually started.
Redesigning the way args are handled has been discussed several times and the general consensus was for the following requirements
- We shouldn't have to change every existing plan. This would need a huge amount of churn and introduce new version dependencies
- No new dependencies between blueapi and dodal/plan repo in either direction. A third API only package is not out of the question. (This may also be useful for utilities like the
DeviceManager) - Devices built by a device manager should be injectable in a similar way to the current system
- Non-devices should be available. Eg a config service client should be usable by plans without relying on global state
- Composite devices should be built at runtime with overrides of individual components if possible
- Type-checking should work
- Vararg and positional only args should be supported (#1185)
- Plan definitions should remain as simple as possible. A bit subjective but the current
injectmethod is fairly concise.- If possible, less duplication than the current system would be good, eg
foo: Movable = inject("foo")could be reduced to something likefoo: Injected(Movable)and the name would not need to be duplicated.
- If possible, less duplication than the current system would be good, eg
- 主要言語
- Python
- スター
- 13
- フォーク
- 14
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 18
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DiamondLightSource/blueapi のほかの issue
-
kwargs: {} gets added to plan **kwargs対応中かも @oliwenmandiamond が 2 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DiamondLightSource/blueapi#1719 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
deployment
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
DiamondLightSource/blueapi#1626 ·
メンテナーはふだん 1 日以内に返信
-
deployment dev-environment
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
DiamondLightSource/blueapi#1623 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DiamondLightSource/blueapi#1605 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
DiamondLightSource/blueapi#1494 ·
メンテナーはふだん 1 日以内に返信
DiamondLightSource/blueapi の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
521xueweihan/HelloGitHub#4150 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
aws-samples/sample-per-model-bedrock#595 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug connectors
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
pyinfra-dev/pyinfra#2036 ·
メンテナーはふだん 9 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信