- chore(pytest): add
project.entry-points.pytest11
section topyproject.toml
so that it can be used as a pytest plugin
- chore: migrate from poetry to uv for the sake of improving performance and dealing with conflicting sub-dependencies
- refactor(core): avoid passing events to
dispatch
, to enforce using them as side-effects only
- feat(autorun): add
auto_await
toAutorunOptions
so that one can define an autorun/view as a decorator of a function without automatically awaiting its result, whenauto_await
is set toFalse
, which activates the new behavior, the decorated function passesasyncio.iscoroutinefunction
test, useful for certain libraries like quart
- refactor(core): allow
None
type for state, action and event types inReducerResult
andCompleteReducerResult
- refactor(autorun): remove
auto_call
option as it was addressing such a rare use case that it was not worth the complexity
- feat(core): add
_type
field to the serialized immutable instances
- feat(core): add blocking
wait_for_event_handlers
method toStore
to wait for all event handlers to finish
- feat(test): add arguments for
wait_for
'scheck
- refactor(core): use
str_to_bool
ofpython-strtobool
instead ofstrtobool
ofdistutils
- feat(test-snapshot): add prefix to snapshot fixture
- feat(test-snapshot): the
selector
function can signal themonitor
it should ignore a particular snapshot of the state by returningNone
- refactor(test-snapshot): make it aligned with
pyfakefs
by usingtry
/except
instead of checkingPath().exists()
aspyfakefs
doesn't seem to respectskip_names
forPath().exists()
- feat(test-snapshot): while still taking snapshots of the whole state of the store, one can narrow this down by providing a selector to the
snapshot
method (used to be a property) - feat(test-snapshot): new
monitor
method to let a test automatically take snapshots of the store whenever it is changed. Takes an optional selector to narrow down the snapshot.
- build(pypi): add metadata
- docs: add an introduction of
view
toREADME.md
- refactor(autorun): improve type-hints so that its final return value has the correct type, regardless
default_value
is provided or not - refactor(view): improve type-hints so that its final return value has the correct type, regardless
default_value
is provided or not - refactor(combine_reducers): use
make_immutable
instead ofmake_dataclass
- test(view): write tests for
store.view
- feat(core): add
view
method toStore
to allow computing a derived value from the state only when it is accessed and caching the result until the relevant parts of the state change - feat(test): add performance tests to check it doesn't timeout in edge cases
- refactor(autorun)!: setting
initial_run
option of autorun toFalse
used to make the autorun simply not call the function on initialization, now it makes sure the function is not called until the selector's value actually changes - feat(autorun): add
auto_call
andreactive
options to autorun to control whether the autorun should call the function automatically when the comparator's value changes and whether it shouldn't automatically call it but yet register a change so that when it is manually called the next time, it will call the function.
- test(middleware): add middleware tests
- refactor(test): add the counter id of the failed snapshot to the error message
- fix: add
unsubscribe
method toAutorunReturnType
protocol
- refactor: middleware functions can now return
None
to cancel an action or event
- feat: introduce
grace_time_in_seconds
parameter toStore
to allow a grace period for the store to finish its work before callingcleanup
andon_finish
- refactor:
Store
no longer aggregates changes, it now calls listeners with every change - refactor:
SideEffectRunnerThread
now runs async side effects in the event loop of the thread in which it was instantiated in (it used to create its own event loop) - refactor(test):
event_loop
fixture now sets the global event loop on setup and restores it on teardown
- fix: initial snapshot cleanup which used to mistakenly remove files with store:... filenames now removes files with store-... filenames
- chore: changed the format of snapshot filenames from store:... to store-...
- chore(test): move fixtures and testing utilities to
redux-pytest
package - feat(test): add
wait_for
,store_monitor
,event_loop
andneeds_finish
fixtures - test: add tests for scheduler and fixtures
- refactor:
SideEffectRunnerThread
now runs async side effects in its own event-loop - refactor: removed
immediate_run
from event subscriptions - refactor: removed
EventSubscriptionOptions
as the only option left waskeep_ref
, it's now a parameter ofsubscribe_event
- feat: new
on_finish
callback for the store, it runs when all worker threads are joined and resources are freed
- fix: automatically unsubscribe autoruns when the weakref is dead
- fix: use weakref of event handlers in
event_handlers_queue
- refactor: drop logging fixture and use standard pytest logger in tests
- refactor: add cleanup to
FinishEvent
handler to clean workers, listeners, subscriptions, autoruns, etc - refactor:
TaskCreator
addTaskCreatorCallback
protocols - refactor:
Store._create_task
now has a callback parameter to report the created task - refactor: move serialization methods and side_effect_runner class to separate files
- fix: serialization class methods of
Store
usecls
instead ofStore
for the sake of extensibility via inheritance - refactor:
pytest_addoption
moved totest.py
to make reusable
- test: write tests for different features of the api
- refactor: rename certain names in the api to better reflect their job
- refactor: store_snapshot now puts snapshot files in a hierarchical directory structure based on the test module and test name
- fix: sort JSON keys in
snapshot_store
'sjson_snapshot
- test: cover most features with tests
- docs: update path of demos migrated to tests in
README.md
- refactor: remove
set_customer_serializer
in favor of overridableserialize_value
- refactor: move store serializer from test framework to code
Store
class - feat: add ability to set custom serializer for store snapshots
- refactor: improve creating new state classes in
combine_reducers
upon registering/unregistering sub-reducers - feat: add test fixture for snapshot testing the store
- chore(test): add test infrastructure for snapshot testing the store
- test: move demo files to test files and update the to use snapshot fixture
- feat: add
keep_ref
parameter to subscriptions and autoruns, defaulting toTrue
, if set toFalse
, the subscription/autorun will not keep a reference to the callback - refacotr: general housekeeping
- fix: autorun now correctly updates its value when the store is updated
- feat: add
__repr__
toAutorun
class
- chore: improve github workflow caching
- fix:
self_workers
inStore.__init__
-> local variableworkers
- chore: GitHub workflow to publish pushes on
main
branch to PyPI - chore: create GitHub release for main branch in GitHub workflows
- refactor: fix lint issues and typing issues
- refactor: remove
create_store
closure in favor ofStore
class with identical api
- feat: all subscriptions/listeners with
keep_ref
, now useWeakMethod
for methods
- refactor: no error if an unsubscription function is called multiple times
- feat(combine_reducers): initialization of sub-reducers is done with
CombineReducerInitAction
containing_id
instead of normalInitAction
- fix:
CombineReducerRegisterAction
should take care ofCompleteReducerResult
returned by the sub-reducer on its initialization.
- feat: new option for all subscriptions to hint them keep a weakref of the callback
- refactor: encapsulate autorun options previously provided as multiple keyword arguments, in a single
AutorunOptions
immutable class - refactor: rename
immediate
toimmediate_run
in autorun subscribers - feat: default value of
immediate_run
can be set for all subscribers of an autorun instance by settingssubscribers_immediate_run
option for the autorun
- feat: add
immediate
parameter tosubscribe
method ofautorun
's returned value
- feat:
autorun
decorator accepts a default value for when store is not initialized - feat:
autorun
decorator takes its options in its keyword arguments
- refactor: make
dispatch
accept awith_state(store)
function as parameter, if provided it will dispatch return value of this function
- refactor: improve typing of
SideEffectRunnerThread
- feat: allow
subscribe_event
callback parameter take zero arguments
- feat: make
subscribe
method ofautorun
's return value, call its callback with the latest value immediately
- feat: add the latest value of
autorun
to thevalue
field of its returned value
- feat: the provided
scheduler
, if any, should have ainterval
parameter, if set toFalse
, it should schedule only once, otherwise it should periodically call thecallback
- feat:
InitializationActionError
shows the incorrect passed action - refactor: improve typing of autorun's
Comparator
- refactor: improve typehints and allow dispatch to get multiple actions/events via
*args
- feat: autorun now recovers from selector attribute errors = uninitialized store
- docs: explain events in more details in
README.md
- docs: add
README.md
- refactor: remove
payload
and...Payload
classes fromcombine_reducers
- refactor: actions and events are queued solely via
dispatch
function, even internally - feat: add
action_middleware
andevent_middleware
fields toCreateStoreOptions
- refactor: add
subscribe
property to the type of the return value of an autorun decorator
- refactor: use
Immutable
from python-immutable package (extracted and created based onImmutable
class of this package)
- refactor: propagate new
FinishEvent
whenFinishAction
is dispatched
- feat: add
scheduler
option to schedule running actions in the main loop of frameworks - feat: add
threads
option to run event handlers asynchronous inthreads
number of threads - refacotr: allow
Any
return type for event handler and subscriber functions - feat: add
subscribe
property to the returned function ofautorun
- feat: allow dispatching events with
dispatch
function
- refactor: postpone nested dispatches
- feat: drop
type
field in actions and events altogether, recognition is done byisinstance
- fix: loosen
subscribe_event
typing constraints as python doesn't have enough type narrowing mechanism at the moment
- fix: add
event_type
tocombine_reducers
- feat: replace side effects with events, events being immutable passive data structures
- fix: let input reducers of
combine_reducers
have arbitrary state types
- fix: let input reducers of
combine_reducers
have arbitrary action types irrelevant to each other
- fix: let input reducers of
combine_reducers
have arbitrary action types
- chore: split the project into multiple files
- feat: let reducers return actions and side effects along new state
- fix: import
dataclass_transform
fromtyping_extensions
instead oftyping
- feat: introduce
immutable
decorator as a shortcut ofdataclass(kw_only=True, frozen=True)
- feat: introduce
Immutable
class, its subclasses automatically becomeimmutable
- refactor:
BaseAction
now inherits fromImmutable
- refactor: Removed
BaseState
, state classes, payload classes, etc should now inheritImmutable
- refactor: make all dataclasses
kw_only=True
- refactor: support previous_result argument, improve typings
- refactor: improve typings
- fix: autorun should re-compute the value if it is expired
- fix: last_comparator_result wasn't being updated
- feat: add cached return value to autorun
- feat: improve typing
- feat: make states and action immutable dataclasses
- feat: implement demo covering autorun, subscription and combining reducers
- feat: implement combine_reducers
- feat: implement autorun
- feat: initial implementation