Replace IO and IORefs with getters/setters
メンテナーはふだん 6 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Start by reading the existing AttributeIO and AttributeIORef implementations and controller attribute APIs; this issue does not name their file paths or tests. Review the linked prerequisite issue #442 and trace how attributes are read, written, polled, and mirrored to transports. Done means replacing IO and IORef usage with per attribute getters and setters and meeting the acceptance criteria.
索引モデルが issue の本文から書いたものです。
説明
IOs and IORefs make writing simple controllers verbose:
@dataclass
class HelloIORef(AttributeIORef):
key: str
_: KW_ONLY
update_period: float | None = 0.5
class HelloIO(AttributeIO[Any, HelloIORef]):
def __init__(self, device): super().__init__(); self._device = device
async def update(self, attr):
await attr.update(await self._device.get(attr.io_ref.key))
async def send(self, attr, value):
await self._device.set(attr.io_ref.key, value)
class HelloController(Controller):
message = AttrR(String(), io_ref=HelloIORef("message"))
def __init__(self):
self._device = HelloDevice()
super().__init__(ios=[HelloIO(self._device)])
We should replace AttributeIO/AttributeIORef with per-attribute getter/setter callables:
class HelloController(Controller):
def __init__(self, device):
self._device = device
super().__init__()
self.message = AttrRW(
String(), # optional: would be inferred from `-> str`
getter=Polled(self._get_message, period=1.0),
setter=self._set_message,
)
async def _get_message(self) -> str:
return await self._device.get("message")
async def _set_message(self, message: str) -> None:
await self._device.set("message", message)
- Scheduling: bare getter → read once on connect;
Polled(fn, period=...)→ polled;
NotPolled(fn)→ only onawait attr.poll() - Datatype inferred from getter return / setter parameter (int, float, bool, str, Enum)
- Getters/setters may return
Update(readback, setpoint=...); a setter's bare return
value is the device-accepted value - Attribute owns the setpoint; all transports mirror it via
add_setpoint_callback
(removes per-transport seeding)
Breaking changes
ios=removed from controllers;AttributeIO,AttributeIORefremovedAttribute[T, Ref]→Attribute[T], as no reference requiredget()→.readback,put()→set(), callback renames, removed methods (list)update_period=Nonerefs should migrate toNotPolled
Depends on https://github.com/DiamondLightSource/fastcs/issues/442.
Acceptance Criteria
- IOs and IORefs are replaced with getter/setter
- 主要言語
- Python
- スター
- 6
- フォーク
- 8
- 平均マージ
- 3日 22時間
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DiamondLightSource/fastcs のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
DiamondLightSource/fastcs#443 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DiamondLightSource/fastcs#437 ·
メンテナーはふだん 6 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DiamondLightSource/fastcs#416 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
DiamondLightSource/fastcs#345 ·
メンテナーはふだん 6 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 62/100
DiamondLightSource/fastcs#341 ·
メンテナーはふだん 6 日以内に返信
DiamondLightSource/fastcs の issue をすべて見る
似ている issue
-
eegprep-lean: set channel types from the Zarr group's channel_type対応中かも @claude が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
blacklanternsecurity/bbot#3679 ·
メンテナーはふだん 2 日以内に返信
-
Link Checker ReportオープンBot Type: Bug Type: Documentation
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
speakeasy-api/speakeasy#2159 ·
メンテナーはふだん 1 日以内に返信