Skip to content

0.5.0

Latest

Choose a tag to compare

@aatle aatle released this 29 Jun 20:47
· 1 commit to main since this release
v0.5.0
cb34a88

Many API changes to simplify the framework.

Fixes

  • Changed Entity() constructor to use add behavior with initial components, instead of update behavior - error on duplicates

API Updates

  • New tag components feature. Use component classes marked with @tag decorator to dynamically filter queries more
    • Added tag and tags keyword parameters to EntityManager.query()
    • Added EntityManager tagged() and tagged_ids() methods
    • Component events will also give the component itself as an event key, if the component is a tag
    • QueryResult instances have a read-only tags attribute
    • New tag_component module with tag_types (WeakSet) and tag (decorator)
  • space.query() removed. Use space.entities.query() instead
  • Removed event skip functionality of handler callbacks
    • Callback return value is now ignored
    • process() methods return None instead of a bool
  • Systems now should be modules (type ModuleType)
  • Key handlers are now invoked with separate priority sorting from non-key handlers, to avoid the need for sorting
  • Renamed pyriak.eventkey module to pyriak.event_key
  • set_key() now has another available overload with 2 arguments, to set key functions directly without using as a decorator
  • space.post() now only takes one argument, instead of a variable number
  • key_functions is now a direct WeakKeyDictionary, typed as a Mapping
    • Removed EventKeyFunctions class

Internal

  • _EventHandler now supports rich comparison by priority, for native sorting capability only
  • EntityManager now stores and maintains a _tag_cache
  • Removed SystemManager handler sorting methods and features
  • Simplified EntityManager add() and remove()
  • Simplified space.pump()
  • Greatly simplified SystemManager._get_bindings()
  • Rearranged order of attributes of _EventHandler
  • Use repr() formatting instead of str() formatting in error message f-strings for types
  • Added ISC001 ruff rule

Typing

  • Removed some unused type: ignore comments
  • _Callback and Binding are no longer generic on the callback return type

Other

  • Improved README
  • Updated docstrings
  • Changed formatting of docstring code examples
  • License year range updated