Transitions

Latest version: v0.9.2

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

Scan your dependencies

Page 1 of 8

0.9.2

Release 0.9.2 is a minor release and contains a new mermaid diagram backend, a new model decoration mode for easier development with types and some more features and bugfixes.

- Bug 610: Decorate models appropriately when `HierarchicalMachine` is passed to `add_state` (thanks e0lithic)
- Bug 647: Let `may_<trigger>` check all parallel states in processing order (thanks spearsear)
- Bug: `HSM.is_state` works with parallel states now
- Experimental features:
+ Add `model_override` to Machine constructor to determine the mode of operation. With `model_override=Fale` (default), `transitions` will not override already defined methods on a model just as it did before. For workflows relying on typing, `model_override=True` will override methods already defined on the model and only those (!). This allows to control which convenience methods shall be assigned to the model and keeps the statically 'assumed' model in sync with its runtime counterpart. Since defining each and every method manually is rather tiresome, `transitions.experimental.utils.generate_base_model` features a way to convert a machine configuration into a `BaseClass` with all convenience functions and callbacks.
+ Add `transitions.experimental.utils.{add_transitions, event, with_model_definitions, transition}` to define trigger methods in a class model for more convenient type checking. `add_transitions` can be used as a function decorator and is stackable. `event` returns a placeholder object for attribute assigment. `add_transitions` and `event` have the same signature and support transition definition like machine constructors. The function `transition` can used for better typing and returns a dictionary that can be passed to the utility functions but also to a machine constructor. `add_transitions` and `event` require a machine decorated with `with_model_definitions`. Decorating a machine `with_model_definitions` implies `model_override=True`.
- Feature: Add `may_trigger` to models to check whether transitions can be conducted by trigger name.
- Feature: Add Mermaid diagram backend that returns a mermaid diagram as a string. `use_pygraphviz` is deprecated in favour for `graph_engine` which may be `pygraphviz` (default), `graphviz` or `mermaid`.

0.9.1

Release 0.9.1 is a minor release and contains several bugfixes and some (typing) improvements. This release also introduces `on_final` callbacks on machines (as well as `NestedState`) and `final` flags for states.

- Bug 594: Fix may_<trigger> always returning false for internal transitions (thanks a-schade)
- PR 592: Pass investigated transition to `EventData` context in 'may' check (thanks msclock)
- PR 634: Improve the handling of diagrams when working with parallel states, especially when using the show_roi option (thanks seanxlliu)
- Bug 619/639: `Exception` is not broad enough and does not catch `asyncio.CancelledError` or `KeyboardInterrupt`; use `BaseException` instead (thanks e0lithic and ofacklam)
- '_anchor' suffix has been removed for (py)graphviz cluster node anchors
- local testing switched from [tox](https://github.com/tox-dev/tox) to [nox](https://github.com/wntrblm/nox)
- PR 633: Remove surrounding whitespace from docstrings (thanks artofhuman)
- PR 665: Add `on_final` to `Machine` and `NestedState` constructor and `final` to `State`. Callbacks passed to `on_final` will be executed when a State with `final=True` is entered or all children of a parallel state are final.
- Bug 626: Process exceptions with `Machine.on_exception` in may_<trigger> as well (thanks match1)
- PR 666: Improved handling of removing transitions for `GraphMachine` and `HiearachicalMachine` (thanks drpjm)
- PR 667: Better handling of unset styling in `GraphMachine`
- Typing:
+ Added `--strict` mypy flag for `transitions` type checks (not `tests` though)
+ Made state, event and machine property mandatory in (Nested)EventData
+ Transition.dest may be None
+ Introduced (Async)CallbackFunc to declutter callback-related signatures
+ Add stub file for extension package for explicite reexport (thanks DrewDevereux)

0.9.0

- removed legacy implementation of `HierarchicalMachine` from the package
- Bug 551: Fix active state styling in `GraphMachine` (thanks betaboon)
- Bug 554: Fix issues related to scopes and queueing in `HierachicalMachine` (thanks jankrejci)
- Bug 568: Reflexive transitions (dest: '=') had not been resolved correctly when source was a wildcard (thanks jnu)
- Bug 568: HSM did not detect reflexive transitions if src was a parent state (thanks lostcontrol)
- Bug 569: Fix implicit fallback to `graphviz` when `pygraphviz` was not installed (thanks FridjofAmundsen)
- Bug 580: Fix `on_timeout` callback resolution when timeout had been initialized with `timeout=0` (thanks Rysbai)
- Bug 582: Last label in `GraphSupport` was not correctly aligned when `show_attributes=True` (thanks spagh-eddie)
- Feature: Add pyi stub files for better type hinting. Since many functions and constructors allow rather arbitrary arguments time will tell whether typing should be strict (and cause more mypy issues) or more relaxed (and thus less precise).
- Feature: Reviewed and improved method documentation
- Feature 549: Add `may` transition check to transitions (thanks artofhuman)
- Feature 552: Refactored error handling to be able to handle `MachineError` in `on_exception` callbacks (thanks kpihus)
- Feature: Add `mypy` to test workflow
- PR 461: Add `Retry` state to supported state stereotypes (thanks rgov)
- Internal: `Machine._identify_callback` has been converted to instance method from class method
- Internal: `LockedMachine._get_qualified_state_name` has been converted to instance method from static method
- Internal: Removed `_super` workaround related to dill (see https://github.com/pytransitions/transitions/issues/236)

0.8.11

Release 0.8.11 is the last 0.8 release and contains fixes for Python 3.10 compatibility issues

- Bug 559: Rewrote an async test and replaced `setDaemon` with `daemon` property assignment for thread handling (thanks debalance)

0.8.10

Release 0.8.10 is a minor release and contains two bug fixes for the HSM extension and changes how the 'self' literal string is handled.

- Feature 545: The literal 'self' (default model parameter of `Machine`) has been replaced by the class variable `Machine.self_literal = 'self'`. `Machine` now performs an identity check (instead of a value check) with `mod is self.self_literal` to determine whether it should act as a model. While 'self' should still work when passed to the `model` parameter, we encourage using `Machine.self_literal` from now on. This was done to enable easier override of `Machine.__eq__` in subclasses (thanks VKSolovev).
- Bug 547: Introduce `HierarchicalMachine.prefix_path` to resolve global state names since the HSM stack is not reliable when `queued=True` (thanks jankrejci).
- Bug 548: `HSM` source states were exited even though they are parents of the destination state (thanks wes-public-apps).

0.8.9

- Bugfix 544: `NestedEvent` now wraps the machine's scope into partials passed to `HierarchicalMachine._process`. This prevents queued transitions from losing their scope.
- Feature 533: `(A)Graph.draw` function (object returned by `GraphMachine.get_graph()`) can be passed a file/stream object as first parameter or `None`. The later will result in `draw` returning a binary string. (thanks Blindfreddy).
- Feature 532: Use id(model) instead of model for machine-bound caches in `LockedMachine`, `AsyncMachine` and `GraphMachine`. This might influence pickling (thanks thedrow).

Page 1 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.