Sismic

Latest version: v1.6.8

Safety actively analyzes 683530 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 11

1.4.0

------------------

This new release contains many internal changes. While the public API is stable and/or backwards
compatible, expect some breaking changes if you relied on Sismic internal API.

A new binding/monitoring system has been deployed on ``Interpreter``, allowing listeners to be notified about
meta-events. Listeners are simply callables that accept meta-events instances.

- (Added) An ``Interpreter.attach`` method that accepts any callable. Meta-events raised by the interpreter
are propagated to attached listeners.
- (Added) An ``Interpreter.detach`` method to detach a previously attached listener.
- (Added) Module ``sismic.interpreter.listener`` with two convenient listeners for the newly introduced ``Interpreter.attach`` method.
The ``InternalEventListener`` identifies sent events and propagates them as external events. The ``PropertyStatechartListener``
propagates meta-events, executes and checks property statecharts.
- (Changed) ``Interpreter.bind`` is built on top of ``attach`` and ``InternalEventListener``.
- (Changed) ``Interpreter.bind_property_statechart`` is built on top of ``attach`` and ``PropertyStatechartListener``.
- (Changed) Meta-Event *step started* has a ``time`` attribute.
- (Changed) Property statecharts are checked for each meta-events, not only at the end of the step.
- (Changed) Meta-events *step started* and *step ended* are sent even if no step can be processed.
- (Deprecated) Passing an interpreter to ``bind_property_statechart`` is deprecated, use ``interpreter_klass`` instead.

Time and event related predicates were extracted from ``PythonEvaluator`` to ease their reuse.
They can be found in ``TimeContextProvider`` and ``EventContextProvider`` of ``sismic.code.context`` and
rely on the new monitoring system:

- (Added) ``TimeContextProvider`` and ``EventContextProvider`` in ``sismic.code.context`` that
exposes most of the predicates that are used in ``PythonEvaluator``.
- (Added) A ``setdefault`` function that can be used in the preamble and actions of a
statechart to assign a default value to a variable.
- (Changed) Most predicates exposed by ``PythonEvaluator`` are implemented by context providers.
- (Deprecated) ``on_step_starts`` method of an ``Evaluator``.

We also refactored how events are passed and processed by the interpreter.
The main visible consequences are:

- (Added) Event parameters can be directly passed to ``Interpreter.queue``.
- (Fixed) Internal events are processed before external ones (regression introduced in 1.3.0).
- (Fixed) Optional transition for ``testing.transition_is_processed``, as promised by its documentation but not implemented.
- (Removed) Internal module ``sismic.interpreter.queue``.
- (Deprecated) ``DelayedEvent``, use ``Event`` with a ``delay`` parameter instead.
- (Deprecated) BDD step *delayed event sent*, use *event sent* instead.

And some other small changes:

- (Added) Documentation about concurrently running multiple statecharts.
- (Changed) State invariants are checked even if no step can be processed.
- (Fixed) Hook-errors reported by ``sismic-bdd`` CLI are a little bit more verbose (`81 <https://github.com/AlexandreDecan/sismic/issues/81>`__).

1.3.0

------------------

Priority can be defined on transitions, allowing to simulate default transitions and to break non-deterministic
situations when many transitions are triggered for a single source state:

- (Added) Priority can be set for transitions (using *low*, *high* or any integer in yaml). Transitions
are selected according to their priorities (still following eventless and inner-first/source state semantics).
- (Added) Interpreter's ``_select_transitions`` gets two new parameters, ``eventless_first`` and ``inner_first``.
Both default to ``True`` and can be used in subclasses to change the default semantics of the interpreter.

The current time of an interpreter is now clock-based driven, thanks to the ``Clock`` base class and its implementations.

- (Added) A ``sismic.clock`` module with a ``Clock`` base class and three direct implementations,
namely ``SimulatedClock``, ``UtcClock`` and ``SynchronizedClock``. A ``SimulatedClock`` allows to manually or automatically
change the time, while a ``UtcClock`` as the expected behaviour of a wall-clock and a ``SynchronizedClock`` is a clock that
synchronizes with another interpreter. ``Clock`` instances are used by the interpreter to get the current time during execution.
See documentation for more information.
- (Added) An ``Interpreter.clock`` attribute that stores an instance of the newly added ``Clock`` class.
- (Changed) ``interpreter.time`` represents the time of the last executed step, not the current
time. Use ``interpreter.clock.time`` instead.
- (Deprecated) Setting ``Interpreter.time`` is deprecated, set time with ``Interpreter.clock.time`` instead.

Queued events can be delayed when they are added to the interpreter event queue.

- (Added) Delayed events are supported through ``DelayedEvent`` and ``DelayedInternalEvent``. If
a delayed event with delay *d* is queued or sent by an interpreter at time *t*, it will not be processed
unless `execute` or `execute_once` is called after the current clock exceeds *t + d*.
- (Added) Property statecharts receive a *delayed event sent* meta-event when a delayed event is sent by a statechart.
- (Added) Delayed events can be sent from within a statechart by specifying a ``delay`` parameter to the ``sent`` function.
- (Added) An ``EventQueue`` class (in ``sismic.interpreter.queue``) that controls how (delayed) events are handled by an interpreter.

A new interpreter runner that benefit from the clock-based handling of time and delayed events:

- (Added) An ``AsyncRunner`` in the newly added ``runner`` module to asynchronously run an interpreter at regular interval.
- (Changed) ``helpers.run_in_background`` no longer synchronizes the interpreter clock.
Use the ``start()`` method of ``interpreter.clock`` or an ``UtcClock`` instance instead.
- (Deprecated) ``helpers.run_in_background`` is deprecated, use ``runner.AsyncRunner`` instead.

And other small changes:

- (Added) A ``sismic.testing`` module containing some testing primitives to ease the writing of unit tests.
- (Changed) ``Interpreter.queue`` does not longer accept ``InternalEvent``.
- (Fixed) State *on entry* time (used for ``idle`` and ``after``) is set after the *on entry*
action is executed, making the two predicates more accurate when long-running actions are
executed when a state is entered. Similarly, ``idle`` is reset after the action of a transition
is performed, not before.
- (Changed) Drop official support for Python 3.4.

1.2.2

------------------

- (Fixed) Event shouldn't be exposed when guards of eventless transitions are evaluated (regression
introduced in version 1.2.1).
- (Changed) Improve performances when selecting transitions that could/will be triggered.

1.2.1

------------------

- (Fixed) Transitions are evaluated according to their event (eventless ones first) and
inner-first/source state semantics, allowing to bypass many useless guard evaluations.

1.2.0

------------------

- (Added) A ``notify`` function that can be used in the action code fragments of a statechart to send user-defined
meta-events to the bound property statecharts (`67 <https://github.com/AlexandreDecan/sismic/issues/67>`__).

1.1.2

------------------

- (Fixed) Interpreter instances can be serialized using ``pickle`` (`66 <https://github.com/AlexandreDecan/sismic/issues/66>`__).

Page 3 of 11

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.