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 on_receive(). The internal field is renamed
to pykka_reply_to a to avoid collisions with other message fields. It is
also removed from the message before the message is passed to
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 is now rejected by replying with an
ActorDeadError exception. This causes other actors blocking on
the returned 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 alive actor that is stopped before it processes the message
will cause the reply future to raise ActorDeadError.

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

When ask() is used to asynchronously message a dead
actor (e.g. block set to False), it will no longer immediately
raise ActorDeadError. Instead, it will return a future and
fail the future with the 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
ask() is called synchronously (e.g. block set to
True), the behavior is unchanged.

A change to stop() reduces the likelyhood 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 tell() to do the alive-or-dead check a single
time, and as late as possible.

Change is_alive() to check the actor’s runnable flag
instead of checking if the actor is registrered in the actor registry.

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 backwards 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 __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:

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

super(MyActorSubclass,self).__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. frompykka.actorimportThreadingActor can now
be written as frompykkaimportThreadingActor. The exception is
pykka.gevent, which still needs to be imported from its own package
due to its additional dependency on gevent.

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.

Change the argument of pykka.Future.set_exception() from an exception
instance to a 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)

ThreadingFuture.set() no longer makes
a copy of the object set on the future. The setter is urged to either only
pass immutable objects through futures or copy the object himself before
setting it on the future. This is a less safe default, but it removes
unecessary overhead in speed and memory usage for users of immutable data
structures. For example, the Mopidy test suite of about 1000 tests, many
which are using Pykka, is still passing after this change, but the test suite
runs approximately 20% faster.

Change and document order in which pykka.ActorRegistry.stop_all() stops
actors. The new order is the reverse of the order the actors were started in.
This should make stop_all work for programs with simple dependency graphs
in between the actors. For applications with more complex dependency graphs,
the developer still needs to pay attention to the shutdown sequence. (Fixes:
#8)

If an actor that was stopped from pykka.Actor.on_start(), it would
unregister properly, but start the receive loop and forever block on
receiving incoming messages that would never arrive. This left the thread
alive and isolated, ultimately blocking clean shutdown of the program. The
fix ensures that the receive loop is never executed if the actor is stopped
before the receive loop is started.

Make the pykka.ActorProxy‘s reference to its pykka.ActorRef
public as pykka.ActorProxy.actor_ref. The ActorRef instance was
already exposed as a public field by the actor itself using the same name,
but making it public directly on the proxy makes it possible to do e.g.
proxy.actor_ref.is_alive() without waiting for a potentially dead actor
to return an ActorRef instance you can use. (Fixes: #3)

Actors are now registered in pykka.registry.ActorRegistry before
they are started. This fixes a race condition where an actor tried to stop
and unregister itself before it was registered, causing an exception in
ActorRegistry.unregister().