Pykka

Latest version: v4.2.0

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

Scan your dependencies

Page 4 of 6

1.2.0

- Enforce that multiple calls to `pykka.Future.set()` raises an exception. This was already the case for some implementations. The exception raised is not specified.

- Add `pykka.Future.set_get_hook()`.

- Add `pykka.Future.filter()`, `pykka.Future.join()`, `pykka.Future.map()`, and `pykka.Future.reduce()` as convenience methods using the new `pykka.Future.set_get_hook()` method.

- Add support for running actors based on eventlet greenlets. See `pykka.eventlet` for details. Thanks to Jakub Stasiak for the implementation.

- Update documentation to reflect that the `reply_to` field on the message is private to Pykka. Actors should reply to messages simply by returning the response from `pykka.Actor.on_receive()`. The internal field is renamed to `pykka_reply_to` to avoid collisions with other message fields. It is also removed from the message before the message is passed to `pykka.Actor.on_receive()`. Thanks to Jakub Stasiak.

- When messages are left in the actor inbox after the actor is stopped, those messages that are expecting a reply are now rejected by replying with a `pykka.ActorDeadError` exception. This causes other actors that are blocking on the returned `pykka.Future` without a timeout to raise the exception instead of waiting forever. Thanks to Jakub Stasiak.

This makes the behavior of messaging an actor around the time it is stopped more consistent:

- Messaging an already dead actor immediately raises `pykka.ActorDeadError`.

- Messaging an alive actor that is stopped before it processes the message will cause the reply future to raise `pykka.ActorDeadError`.

Similarly, if you ask an actor to stop multiple times, and block on the responses, all the messages will now get a reply. Previously only the first message got a reply, potentially making the application wait forever on replies to the subsequent stop messages.

- When `pykka.ActorRef.ask()` is used to asynchronously message a dead actor (e.g. `block=False`), it will no longer immediately raise `pykka.ActorDeadError`. Instead, it will return a future and fail the future with the `pykka.ActorDeadError` exception. This makes the interface more consistent, as you'll have one instead of two ways the call can raise exceptions under normal conditions. If `pykka.ActorRef.ask` is called synchronously (e.g. `block=True`), the behavior is unchanged.

- A change to `pykka.ActorRef.stop()` reduces the likelihood of a race condition when asking an actor to stop multiple times by not checking if the actor is dead before asking it to stop, but instead, just go ahead and leave it to `pykka.ActorRef.tell()` to do the alive-or-dead check a single time, and as late as possible.

- Change `pykka.ActorRef.is_alive()` to check the actor's runnable flag instead of checking if the actor is registered in the actor registry.

1.1.0

- An exception raised in `pykka.Actor.on_start()` didn't stop the actor properly. Thanks to Jay Camp for finding and fixing the bug.

- Make sure exceptions in `pykka.Actor.on_stop()` and `pykka.Actor.on_failure()` is logged.

- Add `pykka.ThreadingActor.use_daemon_thread` flag for optionally running an actor on a daemon thread, so that it doesn't block the Python program from exiting. (Fixes: 14)

- Add `pykka.debug.log_thread_tracebacks()` debugging helper. (Fixes: 17)

1.0.1

- Name the threads of `pykka.ThreadingActor` after the actor class name instead of `PykkaThreadingActor-N` to ease debugging. (Fixes: 12)

1.0.0

- **Backwards incompatible:** Removed `pykka.VERSION` and `pykka.get_version()`, which have been deprecated since v0.14. Use `pykka.__version__` instead.

- **Backwards incompatible:** Removed `pykka.ActorRef.send_one_way()` and `pykka.ActorRef.send_request_reply()`, which have been deprecated since v0.14. Use `pykka.ActorRef.tell()` and `pykka.ActorRef.ask()` instead.

- **Backwards incompatible:** Actors no longer subclass `threading.Thread` or `gevent.Greenlet`. Instead, they *have* a thread or greenlet that executes the actor's main loop.

This is backward incompatible because you no longer have access to fields/methods of the thread/greenlet that runs the actor through fields/methods on the actor itself. This was never advertised in Pykka's docs or examples, but the fields/methods have always been available.

As a positive side effect, this fixes an issue on Python 3.x, that was introduced in Pykka 0.16, where `pykka.ThreadingActor` would
accidentally override the method `threading.Thread._stop()`.

- **Backwards incompatible:** Actors that override `pykka.Actor.__init__()` *must* call the method they override. If not, the actor will no longer be properly initialized. Valid ways to call the overridden `__init__()` method include::

python
super().__init__()
or
pykka.ThreadingActor.__init__()
or
pykka.gevent.GeventActor.__init__()


- Make `pykka.Actor.__init__()` accept any arguments and keyword arguments by default. This allows you to use `super()` in `__init__()` like this:

python
super().__init__(1, 2, 3, foo='bar')


Without this fix, the above use of `super()` would cause an exception because the default implementation of `__init__()` in `pykka.Actor` would not accept the arguments.

- Allow all public classes and functions to be imported directly from the `pykka` module. E.g. `from pykka.actor import ThreadingActor` can now be written as `from pykka import ThreadingActor`. The exception is `pykka.gevent`, which still needs to be imported from its own package due to its additional dependency on gevent.

0.16

- Let actors access themselves through a proxy. See the `pykka.ActorProxy` documentation for use cases and usage examples. (Fixes: 9)

- Give proxies direct access to the actor instances for inspecting available attributes. This access is only used for reading and works since both threading and gevent based actors share memory with other actors. This reduces the creation cost for proxies, which is mostly visible in test suites that are starting and stopping lots of actors. For the Mopidy test suite, the run time was reduced by about 33%. This change also makes self-proxying possible.

- Fix bug where `pykka.Actor.stop()` called by an actor on itself did not process the remaining messages in the inbox before the actor stopped. The behavior now matches the documentation.

0.15

- Change the argument of `pykka.Future.set_exception()` from an exception instance to an `exc_info` three-tuple. Passing just an exception instance to the method still works, but it is deprecated and may be unsupported in a future release.

- Due to the above change `pykka.Future.get()` will now reraise exceptions with complete traceback from the point when the exception was first raised and not just a traceback from when it was reraised by `get()`. (Fixes: 10)

Page 4 of 6

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.