Redesign plan argument handling
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 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 小时
- 30 天内合并 PR
- 18
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DiamondLightSource/blueapi 的其他 Issue
-
kwargs: {} gets added to plan **kwargs可能已有人在做 @oliwenmandiamond 于 1 天前认领。 未关闭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
-
filesystem: `file://C:/...` bucket_url is read as a UNC share named `C:` and silently lists no files未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
comp/desktop desktop/shell os/windows P3 tool/file type/bug
难度 2/5 1-3 小时 新手友好度 76/100
NousResearch/hermes-agent#145928 ·
维护者通常 1 天内回复
-
integration:coding-agents
难度 1/5 1 小时以内 新手友好度 83/100
vectorize-io/hindsight#6151 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
FormalLanguageConstrainedPathQuerying/FLPQ_Data#174 ·
维护者通常 1 天内回复
-
[VLM] granite_vision preset produces empty output and runs ~3× slower with Granite Vision 3.3-2B than with Granite Vision 4.1-4B可能已有人在做 @prassu017 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 74/100
docling-project/docling#5068 · 4 条评论 ·
维护者通常 1 天内回复