Changelog
### 2.0.0
```
===================
Major feature release.
Dependencies
------------
- Drop support for Python 2.6, 3.2, 3.3, and 3.4. All have reached their end of
life and do no longer receive security updates.
- Include CPython 3.5, 3.6, 3.7, and 3.8 pre-releases, and PyPy 3.5 in the test
matrix.
- Include gevent and Eventlet tests in all environments. Since Pykka was
originally developed, both has grown support for Python 3 and PyPy.
- On Python 3, import :class:`Callable` and :class:`Iterable` from
:mod:`collections.abc` instead of :mod:`collections`. This fixes a
deprecation warning on Python 3.7 and prepares for Python 3.8.
Actors
------
- Actor messages are no longer required to be ``dict`` objects. Any object type
can be used as an actor message. (Fixes: :issue:`39`, :issue:`45`, PR:
:issue:`79`)
For existing code, this means that :meth:`~pykka.Actor.on_receive`
implementations should no longer assume the received message to be a
``dict``, and guard with the appropriate amount of :func:`isinstance`
checks. As an existing application will not observe any new message types
before it starts using them itself, this is not marked as backwards
incompatible.
Proxies
-------
- **Backwards incompatible:** Avoid accessing actor properties when creating
a proxy for the actor. For properties with side effects, this is a major bug
fix. For properties which does heavy work, this is a major startup
performance improvement.
This is backwards incompatible if you in a property getter returned an
object instance with the ``pykka_traversable`` marker. Previously, this
would work just like a traversable attribute. Now, the property always
returns a future with the property getter's return value.
- Fix infinite recursion when creating a proxy for an actor with an attribute
or method replaced with a :class:`~unittest.mock.Mock` without a ``spec``
defined. (Fixes: :issue:`26`, :issue:`27`)
- Fix infinite recursion when creating a proxy for an actor with an attribute
that was itself a proxy to the same actor. The attribute will now be ignored
and a warning log message will ask you to consider making the self-proxy
private. (Fixes: :issue:`48`)
- Add :meth:`~pykka.CallableProxy.defer` to support method calls through a
proxy with :meth:`~pykka.ActorRef.tell` semantics. (Contributed by Andrey
Gubarev. Fixes: :issue:`63`. PR: :issue:`72`)
- Add :func:`~pykka.traversable` for marking an actor's attributes as
traversable when used through actor proxies. The old way of manually adding
a ``pykka_traversable`` attribute to the object to be traversed still works,
but the new function is recommended as it provides protection against typos
in the marker name, and keeps the traversable marking in the actor class
itself. (PR: :issue:`81`)
Futures
-------
- **Backwards incompatible:** :meth:`pykka.Future.set_exception` no longer
accepts an exception instance, which was deprecated in 0.15. The method can
be called with either an ``exc_info`` tuple or :class:`None`, in which case
it will use :func:`sys.exc_info` to get information on the current exception.
- **Backwards incompatible:** :meth:`pykka.Future.map` on a future with an
iterable result no longer applies the map function to each item in iterable.
Instead, the entire future result is passed to the map function. (Fixes:
:issue:`64`)
To upgrade existing code, make sure to explicitly apply the core of your map
function to each item in the iterable::
>>> f = pykka.ThreadingFuture()
>>> f.set([1, 2, 3])
>>> f.map(lambda x: x + 1).get() Pykka < 2.0
[2, 3, 4]
>>> f.map(lambda x: [i + 1 for i in x]).get() Pykka >= 2.0
[2, 3, 4]
This change makes it easy to use :meth:`~pykka.Future.map` to extract a field
from a future that returns a dict::
>>> f = pykka.ThreadingFuture()
>>> f.set({'foo': 'bar'})
>>> f.map(lambda x: x['foo']).get()
'bar'
Because dict is an iterable, the now removed special handling of iterables
made this pattern difficult to use.
- Reuse result from :meth:`pykka.Future.filter`, :meth:`pykka.Future.map`, and
:meth:`pykka.Future.reduce`. Recalculating the result on each call to
:meth:`pykka.Future.get` is both inconsistent with regular futures and can
cause problems if the function is expensive or has side effects. (Fixes:
:issue:`32`)
- If using Python 3.5+, one can now use the ``await`` keyword to get the
result from a future. (Contributed by Joshua Doncaster-Marsiglio. PR:
:issue:`78`)
Logging
-------
- Pykka's use of different log levels has been :ref:`documented <logging>`.
- Exceptions raised by an actor that are captured into a reply future are now
logged on the :attr:`~logging.INFO` level instead of the
:attr:`~logging.DEBUG` level. This makes it possible to detect potentially
unhandled exceptions during development without having to turn on debug
logging, which can have a low signal to noise ratio. (Contributed by Stefan
Möhl. Fixes: :issue:`73`)
Gevent support
--------------
- Ensure that the original traceback is preserved when an exception is returned
through a future from a Gevent actor. (Contributed by Arne Brutschy. Fixes:
:issue:`74`, PR: :issue:`75`)
Internals
---------
- **Backwards incompatible:** Prefix all internal modules with ``_``. This is
backwards incompatible if you have imported objects from other import paths
than what is used in the documentation.
- Port tests to pytest.
- Format code with Black.
- Change internal messaging format from ``dict`` to ``namedtuple``. (PR:
:issue:`80`)
```
Links
- PyPI: https://pypi.org/project/pykka
- Changelog: https://pyup.io/changelogs/pykka/
- Homepage: https://www.pykka.org/
Coverage remained the same at 100.0% when pulling 3f4cc31e0e47e073c52e703bf8a9b9a5c116eff5 on pyup-update-pykka-1.2.1-to-2.0.0 into 7d1675e3a5a092d999f7312ef1234e47ec1c0c9a on master.
This PR updates pykka from 1.2.1 to 2.0.0.
Changelog
### 2.0.0 ``` =================== Major feature release. Dependencies ------------ - Drop support for Python 2.6, 3.2, 3.3, and 3.4. All have reached their end of life and do no longer receive security updates. - Include CPython 3.5, 3.6, 3.7, and 3.8 pre-releases, and PyPy 3.5 in the test matrix. - Include gevent and Eventlet tests in all environments. Since Pykka was originally developed, both has grown support for Python 3 and PyPy. - On Python 3, import :class:`Callable` and :class:`Iterable` from :mod:`collections.abc` instead of :mod:`collections`. This fixes a deprecation warning on Python 3.7 and prepares for Python 3.8. Actors ------ - Actor messages are no longer required to be ``dict`` objects. Any object type can be used as an actor message. (Fixes: :issue:`39`, :issue:`45`, PR: :issue:`79`) For existing code, this means that :meth:`~pykka.Actor.on_receive` implementations should no longer assume the received message to be a ``dict``, and guard with the appropriate amount of :func:`isinstance` checks. As an existing application will not observe any new message types before it starts using them itself, this is not marked as backwards incompatible. Proxies ------- - **Backwards incompatible:** Avoid accessing actor properties when creating a proxy for the actor. For properties with side effects, this is a major bug fix. For properties which does heavy work, this is a major startup performance improvement. This is backwards incompatible if you in a property getter returned an object instance with the ``pykka_traversable`` marker. Previously, this would work just like a traversable attribute. Now, the property always returns a future with the property getter's return value. - Fix infinite recursion when creating a proxy for an actor with an attribute or method replaced with a :class:`~unittest.mock.Mock` without a ``spec`` defined. (Fixes: :issue:`26`, :issue:`27`) - Fix infinite recursion when creating a proxy for an actor with an attribute that was itself a proxy to the same actor. The attribute will now be ignored and a warning log message will ask you to consider making the self-proxy private. (Fixes: :issue:`48`) - Add :meth:`~pykka.CallableProxy.defer` to support method calls through a proxy with :meth:`~pykka.ActorRef.tell` semantics. (Contributed by Andrey Gubarev. Fixes: :issue:`63`. PR: :issue:`72`) - Add :func:`~pykka.traversable` for marking an actor's attributes as traversable when used through actor proxies. The old way of manually adding a ``pykka_traversable`` attribute to the object to be traversed still works, but the new function is recommended as it provides protection against typos in the marker name, and keeps the traversable marking in the actor class itself. (PR: :issue:`81`) Futures ------- - **Backwards incompatible:** :meth:`pykka.Future.set_exception` no longer accepts an exception instance, which was deprecated in 0.15. The method can be called with either an ``exc_info`` tuple or :class:`None`, in which case it will use :func:`sys.exc_info` to get information on the current exception. - **Backwards incompatible:** :meth:`pykka.Future.map` on a future with an iterable result no longer applies the map function to each item in iterable. Instead, the entire future result is passed to the map function. (Fixes: :issue:`64`) To upgrade existing code, make sure to explicitly apply the core of your map function to each item in the iterable:: >>> f = pykka.ThreadingFuture() >>> f.set([1, 2, 3]) >>> f.map(lambda x: x + 1).get() Pykka < 2.0 [2, 3, 4] >>> f.map(lambda x: [i + 1 for i in x]).get() Pykka >= 2.0 [2, 3, 4] This change makes it easy to use :meth:`~pykka.Future.map` to extract a field from a future that returns a dict:: >>> f = pykka.ThreadingFuture() >>> f.set({'foo': 'bar'}) >>> f.map(lambda x: x['foo']).get() 'bar' Because dict is an iterable, the now removed special handling of iterables made this pattern difficult to use. - Reuse result from :meth:`pykka.Future.filter`, :meth:`pykka.Future.map`, and :meth:`pykka.Future.reduce`. Recalculating the result on each call to :meth:`pykka.Future.get` is both inconsistent with regular futures and can cause problems if the function is expensive or has side effects. (Fixes: :issue:`32`) - If using Python 3.5+, one can now use the ``await`` keyword to get the result from a future. (Contributed by Joshua Doncaster-Marsiglio. PR: :issue:`78`) Logging ------- - Pykka's use of different log levels has been :ref:`documented <logging>`. - Exceptions raised by an actor that are captured into a reply future are now logged on the :attr:`~logging.INFO` level instead of the :attr:`~logging.DEBUG` level. This makes it possible to detect potentially unhandled exceptions during development without having to turn on debug logging, which can have a low signal to noise ratio. (Contributed by Stefan Möhl. Fixes: :issue:`73`) Gevent support -------------- - Ensure that the original traceback is preserved when an exception is returned through a future from a Gevent actor. (Contributed by Arne Brutschy. Fixes: :issue:`74`, PR: :issue:`75`) Internals --------- - **Backwards incompatible:** Prefix all internal modules with ``_``. This is backwards incompatible if you have imported objects from other import paths than what is used in the documentation. - Port tests to pytest. - Format code with Black. - Change internal messaging format from ``dict`` to ``namedtuple``. (PR: :issue:`80`) ```Links
- PyPI: https://pypi.org/project/pykka - Changelog: https://pyup.io/changelogs/pykka/ - Homepage: https://www.pykka.org/