You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

METADATA 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. Metadata-Version: 2.1
  2. Name: txaio
  3. Version: 18.8.1
  4. Summary: Compatibility API between asyncio/Twisted/Trollius
  5. Home-page: https://github.com/crossbario/txaio
  6. Author: Crossbar.io Technologies GmbH
  7. Author-email: autobahnws@googlegroups.com
  8. License: MIT License
  9. Keywords: asyncio twisted trollius coroutine
  10. Platform: Any
  11. Classifier: License :: OSI Approved :: MIT License
  12. Classifier: Development Status :: 5 - Production/Stable
  13. Classifier: Environment :: Console
  14. Classifier: Framework :: Twisted
  15. Classifier: Intended Audience :: Developers
  16. Classifier: Operating System :: OS Independent
  17. Classifier: Programming Language :: Python
  18. Classifier: Programming Language :: Python :: 2
  19. Classifier: Programming Language :: Python :: 2.7
  20. Classifier: Programming Language :: Python :: 3
  21. Classifier: Programming Language :: Python :: 3.3
  22. Classifier: Programming Language :: Python :: 3.4
  23. Classifier: Programming Language :: Python :: 3.5
  24. Classifier: Programming Language :: Python :: 3.6
  25. Classifier: Programming Language :: Python :: 3.7
  26. Classifier: Programming Language :: Python :: Implementation :: CPython
  27. Classifier: Programming Language :: Python :: Implementation :: PyPy
  28. Classifier: Topic :: Software Development :: Libraries
  29. Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
  30. Provides-Extra: asyncio
  31. Provides-Extra: twisted
  32. Provides-Extra: all
  33. Provides-Extra: dev
  34. Requires-Dist: six
  35. Provides-Extra: all
  36. Requires-Dist: zope.interface (>=3.6); extra == 'all'
  37. Requires-Dist: twisted (>=12.1.0); extra == 'all'
  38. Provides-Extra: asyncio
  39. Provides-Extra: dev
  40. Requires-Dist: wheel; extra == 'dev'
  41. Requires-Dist: pytest (>=2.6.4); extra == 'dev'
  42. Requires-Dist: pytest-cov (>=1.8.1); extra == 'dev'
  43. Requires-Dist: pep8 (>=1.6.2); extra == 'dev'
  44. Requires-Dist: sphinx (>=1.2.3); extra == 'dev'
  45. Requires-Dist: pyenchant (>=1.6.6); extra == 'dev'
  46. Requires-Dist: sphinxcontrib-spelling (>=2.1.2); extra == 'dev'
  47. Requires-Dist: sphinx-rtd-theme (>=0.1.9); extra == 'dev'
  48. Requires-Dist: tox (>=2.1.1); extra == 'dev'
  49. Requires-Dist: mock (==1.3.0); extra == 'dev'
  50. Requires-Dist: twine (>=1.6.5); extra == 'dev'
  51. Provides-Extra: twisted
  52. Requires-Dist: zope.interface (>=3.6); extra == 'twisted'
  53. Requires-Dist: twisted (>=12.1.0); extra == 'twisted'
  54. txaio
  55. =====
  56. | |Version| |Build Status| |Coverage| |Docs|
  57. --------------
  58. **txaio** is a helper library for writing code that runs unmodified on
  59. both `Twisted <https://twistedmatrix.com/>`_ and `asyncio <https://docs.python.org/3/library/asyncio.html>`_ / `Trollius <http://trollius.readthedocs.org/en/latest/index.html>`_.
  60. This is like `six <http://pythonhosted.org/six/>`_, but for wrapping
  61. over differences between Twisted and asyncio so one can write code
  62. that runs unmodified on both (aka *source code compatibility*). In
  63. other words: your *users* can choose if they want asyncio **or** Twisted
  64. as a dependency.
  65. Note that, with this approach, user code **runs under the native event
  66. loop of either Twisted or asyncio**. This is different from attaching
  67. either one's event loop to the other using some event loop adapter.
  68. Platform support
  69. ----------------
  70. **txaio** runs on CPython 2.7/3.3+ and PyPy 2/3, on top of Twisted or asyncio. Specifically, **txaio** is tested on the following platforms:
  71. **Python 2:**
  72. * CPython 2.7 on Twisted 12.1, 13.2, 15.4, 16.5, trunk and on Trollius 2.0
  73. * PyPy 2 on Twisted 12.1, 13.2, 15.4, 16.5, trunk and on Trollius 2.0
  74. **Python 3:**
  75. * CPython 3.4 on Twisted 15.4, 16.5, trunk and on asyncio (stdlib)
  76. * CPython 3.5 on Twisted 15.4, 16.5, trunk and on asyncio (stdlib)
  77. * CPython 3.6 on Twisted 15.4, 16.5, trunk and on asyncio (stdlib)
  78. * PyPy 3 on Twisted 15.4, 16.5, trunk and on asyncio (stdlib)
  79. How it works
  80. ------------
  81. Instead of directly importing, instantiating and using ``Deferred``
  82. (for Twisted) or ``Future`` (for asyncio) objects, **txaio** provides
  83. helper-functions to do that for you, as well as associated things like
  84. adding callbacks or errbacks.
  85. This obviously changes the style of your code, but then you can choose
  86. at runtime (or import time) which underlying event-loop to use. This
  87. means you can write **one** code-base that can run on Twisted *or*
  88. asyncio (without a Twisted dependency) as you or your users see fit.
  89. Code like the following can then run on *either* system:
  90. .. sourcecode:: python
  91. import txaio
  92. txaio.use_twisted() # or .use_asyncio()
  93. f0 = txaio.create_future()
  94. f1 = txaio.as_future(some_func, 1, 2, key='word')
  95. txaio.add_callbacks(f0, callback, errback)
  96. txaio.add_callbacks(f1, callback, errback)
  97. # ...
  98. txaio.resolve(f0, "value")
  99. txaio.reject(f1, RuntimeError("it failed"))
  100. Please refer to the `documentation <https://txaio.readthedocs.io/en/latest/>`_ for description and usage of the library features.
  101. .. |Version| image:: https://img.shields.io/pypi/v/txaio.svg
  102. :target: https://pypi.python.org/pypi/txaio
  103. .. |Build Status| image:: https://travis-ci.org/crossbario/txaio.svg?branch=master
  104. :target: https://travis-ci.org/crossbario/txaio
  105. .. |Coverage| image:: https://codecov.io/github/crossbario/txaio/coverage.svg?branch=master
  106. :target: https://codecov.io/github/crossbario/txaio
  107. .. |Docs| image:: https://readthedocs.org/projects/txaio/badge/?version=latest
  108. :target: https://txaio.readthedocs.io/en/latest/