Replace IO and IORefs with getters/setters
I maintainer di solito rispondono entro 6 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend-api-design
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 6
- Fork
- 8
- Merge medio
- 3g 22h
- PR unite (30g)
- 3
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DiamondLightSource/fastcs
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
DiamondLightSource/fastcs#443 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
DiamondLightSource/fastcs#437 ·
I maintainer di solito rispondono entro 6 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DiamondLightSource/fastcs#416 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
DiamondLightSource/fastcs#345 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
DiamondLightSource/fastcs#341 ·
I maintainer di solito rispondono entro 6 giorni
Tutte le issue di DiamondLightSource/fastcs
Issue simili
-
eegprep-lean: set channel types from the Zarr group's channel_typeForse già presa @claude l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
sccn/eegprep#668 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Upgrade Django to 5.2.18Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
blacklanternsecurity/bbot#3679 ·
I maintainer di solito rispondono entro 2 giorni
-
Link Checker ReportApertaBot Type: Bug Type: Documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
speakeasy-api/speakeasy#2159 ·
I maintainer di solito rispondono entro 1 giorno