Repository navigation
v0.8.0
Breaking
-
sharedbox.Shapetakes its dimensions as one tuple,Shape((480, 640)), in
place of one argument per dimension. See
How to migrate from 0.7. (#88) -
SharedBoxreserves the namesmetadata,metadata_versionand
metadata_version_of: a field orInitVarwith one of them raises
TypeErrorwhen the class is defined. Rename the field:# 0.7 class Parcel(SharedBox): metadata: Annotated[str, Capacity(64)] = "" # 0.8 class Parcel(SharedBox): label: Annotated[str, Capacity(64)] = ""
SharedBox.updatetakes the keywordmetadata, so a type checker refuses
update(**values)when the values of the dictionary have a type that the
box's metadata type does not accept, such asstr:# 0.7 def restock(parcel: Parcel, values: dict[str, str]) -> None: parcel.update(**values) # 0.8 def restock(parcel: Parcel, values: dict[str, Any]) -> None: parcel.update(**values)
See
How to migrate from 0.7. (#91)
Added
MaxShape: an array of a stream item declared with a maximum shape, as in
Annotated[npt.NDArray[np.uint16], MaxShape((2048, 2048))], stores its own
shape with each item, as kind 75 of stream layout 1.2.writing()views the
slot in the shape of the template's array,slot.sendpublishes the first
rows of that view without a copy, andreceive_intoreturns a view of the
stored shape overout. (#88)SharedStream.sender(on_full="release"): a send that has waited its whole
timeoutreleases the lossless readers a full ring behind and sends, as in
stream.sender(on_full="release").send(item, timeout=0.1). Each released
reader raisesReaderReleased, whosemissedcounts the items it lost, and
goes on at the newest item;ReceiveEvents.releasedreports the count to
callbacks.SharedSendStream.asendandawritingtake atimeout. In
stream.hpp,send,send_withandbegintake anon_fullpolicy, and a
released reader'sreceivegivesstatus::released, in stream layout 1.3. (#89)MetadataFullErrorandMetadataGoneError: raised when an add finds no
room for a version, and when the version a read asks for is no longer held. (#91)SharedStream.metadata: a stream keeps metadata the same way.
SharedStream.create(Reading, capacity=8, metadata={"unit": "kg"})stores
version 1.SharedSendStream.send,asend,send_nowaitand
SendSlot.sendtakemetadata=and add a version that applies from that
item.SharedReceiveStream.metadataandmetadata_versiongive the version
of the item the reader received last.SharedStream.createtakes
metadata_capacityandmetadata_versions, andcreateandattachtake
metadata_type.sharedbox0.7.0 and earlier cannot open a stream created
with metadata or ametadata_capacity. (#91)box.hpp,stream.hppandsharedbox_c.h: box layout 3.2 and stream
layout 1.4 hold metadata after the record or the description table.
handleandstreamgainmetadata_headandread_metadata, and
stream_readergainsmetadata_version_at.handleandstream_sender
gainadd_metadata.handle::write(values, doc, lock_timeout)and
write_largewith the same arguments write fields and add a version in one
write, and
stream_sender::can_add_metadatachecks an add without making it.
sharedbox_c.haddssbx_metadata_head,sbx_read_metadata,
sbx_add_metadataandSBX_E_METADATA_FULL. (#91)SharedBox.metadata: a box keeps metadata, JSON-like values stored as CBOR
in its segment, in numbered versions.Scale.create(name, metadata={"unit": "kg"})stores version 1, andSharedBox.update(metadata=...)adds the next
one from any process, with or without field values, in one write.
metadata,metadata_versionandmetadata_version_ofread the versions,
a map as a read-only mapping and a list as a tuple.BoxEvents.metadatais
emitted with each new version. The class keywordsmetadata_capacityand
metadata_versionssize the room for versions, and
class Scale(SharedBox[Calibration])gives the metadata's type to type
checkers. (#91)
Changed
sharedbox.DTypeis aStrEnumwith one member per element type:
DType(numpy.uint8)returnsDType.uint8, which equals"uint8". (#88)
Fixed
SharedBoxandSharedStreamat exit: theatexithook ofsharedbox
closes every box and stream the process still has open and releases the
native objects ofSharedBoxsubclasses, their watches and events groups,
so nanobind reports no leaked instances when a box class defined at module
level outlives shutdown. A box or stream used after the hook raises
BoxClosedErrororStreamClosedError, and creating or attaching a box
raisesBoxClosedError. (#90)