txEffect is a small library for integrating Twisted and Effect, mostly around Deferred<->Effect interoperation. Documentation is available at https://txeffect.readthedocs.org/
Effect is a library for helping you write purely functional code by isolating the effects (that is, IO or state manipulation) in your code. Documentation is available at https://effect.readthedocs.org/.
Perform an Effect to get a Deferred with txeffect.perform.
from txeffect import perform d = perform(my_dispatcher, some_effect) d.addCallback(log.msg)
Implement a performer for an intent that returns a Deferred with txeffect.deferred_performer.
from twisted.internet.defer import succeed from txeffect import deferred_performer @deferred_performer def perform_foo(dispatcher, intent): return succeed('hello, world')
from twisted.internet import reactor from txeffect import make_twisted_dispatcher dispatcher = make_twisted_dispatcher(reactor) p_effs = parallel([Effect(Delay(5), Effect(Delay(3), Effect(Delay(1))))]) perform(dispatcher, p_effs).addCallback( lambda: print("5 seconds have passed!"))
Working examples can be found at the effect-examples GitHub repo.
Thanks to Rackspace for allowing me to work on this project, and having an excellent open source employee contribution policy
There is a #python-effect IRC channel on irc.freenode.net.
txEffect is licensed under the MIT license:
Copyright (C) 2014 Christopher Armstrong
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|txeffect-0.9-py2.py3-none-any.whl (8.6 kB) Copy SHA256 Checksum SHA256||py2.py3||Wheel||Jun 8, 2015|
|txeffect-0.9.tar.gz (5.6 kB) Copy SHA256 Checksum SHA256||–||Source||Jun 8, 2015|