Repository navigation
v0.10.0
Breaking
- A map in the metadata of a box or a stream reads back as a
frozendict,
which can be pickled, deep-copied and converted to JSON, in place of a
types.MappingProxyType. It is the builtin type from Python 3.15 on and
the type of thefrozendictpackage before, which is a new dependency on
those versions. See "How to migrate from 0.9". (#112) - The size of a field is given in its annotation only, with
Capacityand
ShapeinAnnotated.field()no longer takescapacityorshape, a
record member no longer takes its shape from the"shape"entry of its
field metadata, and a default array no longer gives an array field its
shape. See "How to migrate from 0.9". (#113) timeoutis keyword-only inSharedSendStream.send,asend,reserveand
areserve, inSharedReceiveStream.receiveandfetch, and in
sharedbox.bluebox.DocumentReceiver.receive. See "How to migrate from 0.9". (#113)SharedBox.metadata_version_ofandSharedStream.metadata_version_ofare
renamedmetadata_at, and a box field can no longer be named
metadata_at. See "How to migrate from 0.9". (#113)SharedSendStream.writingandawritingare renamedreserveand
areserve. See "How to migrate from 0.9". (#113)attr()no longer takestimedorsettable, andFieldno longer has
timedorsettableattributes. EveryAttrwith a value stores the
time of each publish, sotimestamp_nsis always a key ofAttrValue,
and only aSettinghassetpoint,set()andpublish(setpoint=...).
See "How to migrate from 0.9". (#116)
Added
-
SharedBox.locked()holds the box's write lock for awithblock, so a
write computed from the box's values loses no update to another process:with box.locked() as b: b.count += 1
Leaving the block counts one write for each field it assigned; a block that
raises puts every field back and counts nothing. C++ gets the same through
handle::begin_record_write,held_bytes,write_held,end_record_write
andabort_record_write. (#109) -
sharedbox.blueboxcarries the documents ofblueskyruns to other
processes.DocumentSenderis aRunEnginecallback that sends on a named
channel, andDocumentReceiverreceives the documents in the order they
were sent, in modelossless,lossyorlatest, with each event's
arrays copied through shared memory:sender = DocumentSender.create("beamline") engine.subscribe(sender) for name, doc in DocumentReceiver.attach("beamline", mode="lossy"): ...
A receiver that attaches during a run first gets its start and descriptors.
ReceiverReleasedErrorandLateJoinErrorreport a receiver that lost
documents or cannot join the run under way. Theblueboxextra installs
what it needs. (#110) -
SharedReceiveStream.areceive,areceive_intoandafetchreceive and
fetch an item without blocking the event loop, asSharedSendStream.asend
sends one, and take atimeout. (#113) -
SharedBoxandSharedStreamwork withasync with, which closes them
when the block ends, aswithdoes. (#113) -
SharedStream.unlinkcan be called on a stream with no argument, as
stream.unlink(), to remove that stream's name. (#113) -
sharedboxexportsMode,StartandOnFull, the literal types of a
reader'smodeandstartand of a sender'son_full, andIterInto, the
typeSharedReceiveStream.iter_intoreturns. (#113) -
Setting[T], anAttrthat also holds a setpoint, which other processes
change throughset()(#116):class Camera(SharedBox): exposure: Setting[float] = attr(default=0.01)
Changed
- Opening a box or stream that holds a kind this version does not read, inside
a field or as a stream item, raisesSchemaMismatchErrornaming the kind,
such as "holds a value of kind 80, which this sharedbox does not read",
instead of reporting a corrupt header. C++ getsstatus::unsupportedwith the
kind inerror::found, and C getsSBX_E_UNSUPPORTED(-18), in place of
status::corruptandSBX_E_CORRUPT. (#108) - A changed field is decoded for
SharedBox.eventsonly when a callback is
connected to it, and on Windows a wait for the lock of a box yields for 1 ms
before it sleeps, so it no longer sleeps a whole timer tick behind a large
write or a shortlocked()block. (#112) - The
identityclass keyword ofSharedBoxraisesValueErrorfor a
string that contains|. (#112) - A
lossyreader that falls a whole ring behind goes on from the middle of
the ring and counts the older half inmissed, where it used to go on from
the oldest item. C++stream_reader::receivefollows the same rule. (#112) - A request that a later one replaced before any server took it raises
RequestSupersededErrorat once, also while no process serves the field.
It used to stay pending until a server took the later request. C++
handle::request_answer_ofreportsrequest_outcome::supersededfor it. (#112) - A blocking
SharedReceiveStream.receiveorSharedSendStream.sendthat
has to wait no longer makes a first native call that fails, a waiting item
is received without giving up the GIL, and writing alist,setor
dictfield no longer clears the field's whole capacity. (#112) FieldFuture.resultandRequestFuture.resultraiseRuntimeErrorwhen
the result is not ready and the call comes from a callback of the same
box'sevents, where they used to wait until their timeout. (#112)
Fixed
- A box class defined in a function, in a module with
from __future__ import annotations, can name a type defined in that
function. (#112) - Assigning an enum value that is not one of its class's members raises
ValueErrornaming the field, in place ofIndexError. (#112) - A reference field may be annotated
Annotated[Box, ...]or
Final[Box]. (#112) CapacityraisesTypeErrorfor a size that is not anint. (#112)send_nowait,receive_nowaitand the first step ofasendand
async forreturn at once while another thread waits in a call on the
same end, so they no longer block the event loop for up to a second. (#112)- A record type of 4 GiB or more, and a box class whose fields exceed the
size of a box, raiseTypeErrorsaying the size when the class is
defined. (#112) reprof a box inside its ownlocked()block, and of the block's object
after the block, returns<Name locked>in place of raising. (#112)SharedBox.closecancels the pending futures when a served field cannot
be released, and a secondRequestServer.stopfrees a field that the
first call, made inside alocked()block, could not. (#112)- The error of a request handler is logged with every character that UTF-8
cannot encode escaped, such as a lone surrogate, so the record can be
written to a log file. The traceback is part of the message text, and the
record no longer carriesexc_info. (#112) - A process no longer aborts at exit when a daemon thread is inside a box or
a stream call: a thread that the exit cleanup ends withBoxClosedError,
StreamClosedErrororLockTimeoutErrorprints no traceback. (#112) - Connecting a callback to the
eventsof a stream reader that nothing
refers to any more logs a warning. (#112) - Reading metadata whose stored bytes are not a metadata document is
refused. C++read_metadatareturnsstatus::corrupt. (#112) SharedBox.lockedworks for a class whose__init_subclass__accepts no
keyword. (#112)receiveon alossyorlatestreader raisesTimeoutErrorat its
timeout when the sender overwrites every item during its copy. (#112)- On Windows a process is counted as exited only when no process has its
pid, not when the process cannot be opened for another reason. (#112) - Reading a
boolfield whose stored byte is neither 0 nor 1 raises
ValueErrornaming the field, as aboolinside a record does. (#112) - The thread behind
SharedBox.events,watchand requests keeps running
after a callback raisesSystemExitor reading a changed value raises. A
FieldFuturewhose value cannot be read fails with that error. (#112) - A first
SharedBox.eventsthat raises, such as on a lock timeout, no
longer leaves a group that never emits. (#112) - On Linux, a sender that was killed while it claimed the stream, after it
stored its pid and before its namespace and start time, is replaced after
100 ms. It used to keep every laterSharedStream.senderbusy, and readers
never saw the stream end. (#112) - A
latestreader returns the newest item when it had kept an older one
from a cancelled receive, and counts the older one inmissed. (#112) - A
ReceiveEvents.receivedcallback that raisesSystemExitno longer
stops delivery. (#112) BoxEvents.followraisesBoxClosedErrorwhen the box is closed while
the call starts, where it used to start forwarding on the closed box. (#112)- A field that a box class takes from a base that is not a box class keeps
the default that base gives it, or itsfield()options. It used to become
a required field. (#112)