Skip to main content

Effect/Twisted integration

Project description

txEffect

https://travis-ci.org/python-effect/txeffect.svg?branch=master https://img.shields.io/pypi/v/txeffect.svg

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/.

Examples

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')

Perform standard Delay and parallel effects using asynchronous implementations with txeffect.make_twisted_dispatcher.

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

Thanks to Rackspace for allowing me to work on this project, and having an excellent open source employee contribution policy

IRC

There is a #python-effect IRC channel on irc.freenode.net.

License

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

txeffect-1.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

txeffect-1.0.0-py2.py3-none-any.whl (6.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file txeffect-1.0.0.tar.gz.

File metadata

  • Download URL: txeffect-1.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.3

File hashes

Hashes for txeffect-1.0.0.tar.gz
Algorithm Hash digest
SHA256 827896e03956c8307cd7ffe6d8c45d6f99ce4d869385ae55cf40186d40a73f03
MD5 30adb46f960b0b532bf93cfdef261219
BLAKE2b-256 21859b089f7870ab6e7293b62ac16bacefbe2dcb1a608fbcac634c71d2f62bc5

See more details on using hashes here.

File details

Details for the file txeffect-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: txeffect-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.3

File hashes

Hashes for txeffect-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bd6457a946b2e44af91ae36e76d29e502c9e3f06327e218c85c9d259affbcc18
MD5 accff83c414dbf8f8105f647ef2d7b52
BLAKE2b-256 070c29ffce99d8103eaed87e4ca01e767bcb1fd5956571792f4c8b1e4e3a1b2a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page