PKG-INFO 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. Metadata-Version: 2.1
  2. Name: thriftpy2
  3. Version: 0.4.12
  4. Summary: Pure python implementation of Apache Thrift.
  5. Home-page: https://thriftpy2.readthedocs.io/
  6. Author: ThriftPy Organization
  7. Author-email: gotzehsing@gmail.com
  8. License: MIT
  9. Description: ============
  10. ThriftPy2
  11. ============
  12. .. image:: https://travis-ci.com/Thriftpy/thriftpy2.svg?branch=develop
  13. :target: https://travis-ci.com/Thriftpy/thriftpy2
  14. .. image:: https://img.shields.io/codecov/c/github/Thriftpy/thriftpy2.svg
  15. :target: https://codecov.io/gh/Thriftpy/thriftpy2
  16. .. image:: https://img.shields.io/pypi/dm/thriftpy2.svg
  17. :target: https://pypi.org/project/thriftpy2/
  18. .. image:: https://img.shields.io/pypi/v/thriftpy2.svg
  19. :target: https://pypi.org/project/thriftpy2/
  20. .. image:: https://img.shields.io/pypi/pyversions/thriftpy2.svg
  21. :target: https://pypi.org/project/thriftpy2/
  22. .. image:: https://img.shields.io/pypi/implementation/thriftpy2.svg
  23. :target: https://pypi.org/project/thriftpy2/
  24. ThriftPy: https://github.com/eleme/thriftpy has been deprecated, ThriftPy2 aims to provide long term support.
  25. Migrate from Thriftpy?
  26. ======================
  27. All you need is:
  28. .. code:: python
  29. import thriftpy2 as thriftpy
  30. That's it! thriftpy2 is fully compatible with thriftpy.
  31. Installation
  32. ============
  33. Install with pip.
  34. .. code:: bash
  35. $ pip install thriftpy2
  36. You may also install cython first to build cython extension locally.
  37. .. code:: bash
  38. $ pip install cython thriftpy2
  39. Code Demo
  40. =========
  41. ThriftPy make it super easy to write server/client code with thrift. Let's
  42. checkout this simple pingpong service demo.
  43. We need a 'pingpong.thrift' file:
  44. ::
  45. service PingPong {
  46. string ping(),
  47. }
  48. Then we can make a server:
  49. .. code:: python
  50. import thriftpy2
  51. pingpong_thrift = thriftpy2.load("pingpong.thrift", module_name="pingpong_thrift")
  52. from thriftpy2.rpc import make_server
  53. class Dispatcher(object):
  54. def ping(self):
  55. return "pong"
  56. server = make_server(pingpong_thrift.PingPong, Dispatcher(), '127.0.0.1', 6000)
  57. server.serve()
  58. And a client:
  59. .. code:: python
  60. import thriftpy2
  61. pingpong_thrift = thriftpy2.load("pingpong.thrift", module_name="pingpong_thrift")
  62. from thriftpy2.rpc import make_client
  63. client = make_client(pingpong_thrift.PingPong, '127.0.0.1', 6000)
  64. print(client.ping())
  65. And it also supports asyncio on Python 3.5 or later:
  66. .. code:: python
  67. import thriftpy2
  68. import asyncio
  69. from thriftpy2.rpc import make_aio_client
  70. echo_thrift = thriftpy2.load("echo.thrift", module_name="echo_thrift")
  71. async def request():
  72. client = await make_aio_client(
  73. echo_thrift.EchoService, '127.0.0.1', 6000)
  74. print(await client.echo('hello, world'))
  75. client.close()
  76. .. code:: python
  77. import asyncio
  78. import thriftpy2
  79. from thriftpy2.rpc import make_aio_server
  80. echo_thrift = thriftpy2.load("echo.thrift", module_name="echo_thrift")
  81. class Dispatcher(object):
  82. async def echo(self, param):
  83. print(param)
  84. await asyncio.sleep(0.1)
  85. return param
  86. def main():
  87. server = make_aio_server(
  88. echo_thrift.EchoService, Dispatcher(), '127.0.0.1', 6000)
  89. server.serve()
  90. if __name__ == '__main__':
  91. main()
  92. See, it's that easy!
  93. You can refer to 'examples' and 'tests' directory in source code for more
  94. usage examples.
  95. Features
  96. ========
  97. Currently ThriftPy have these features (also advantages over the upstream
  98. python lib):
  99. - Supports Python 2.7, Python 3.4+, PyPy and PyPy3.
  100. - Pure python implementation. No longer need to compile & install the 'thrift'
  101. package. All you need is thriftpy2 and thrift file.
  102. - Compatible with Apache Thrift. You can use ThriftPy together with the
  103. official implementation servers and clients, such as a upstream server with
  104. a thriftpy2 client or the opposite.
  105. Currently implemented protocols and transports:
  106. * binary protocol (python and cython)
  107. * compact protocol (python and cython)
  108. * json protocol
  109. * buffered transport (python & cython)
  110. * framed transport
  111. * tornado server and client (with tornado 4.0)
  112. * http server and client
  113. * asyncio support (python 3.5 or later)
  114. - Can directly load thrift file as module, the sdk code will be generated on
  115. the fly.
  116. For example, ``pingpong_thrift = thriftpy2.load("pingpong.thrift", module_name="pingpong_thrift")``
  117. will load 'pingpong.thrift' as 'pingpong_thrift' module.
  118. Or, when import hook enabled by ``thriftpy2.install_import_hook()``, you can
  119. directly use ``import pingpong_thrift`` to import the 'pingpong.thrift' file
  120. as module, you may also use ``from pingpong_thrift import PingService`` to
  121. import specific object from the thrift module.
  122. - Easy RPC server/client setup.
  123. Contribute
  124. ==========
  125. 1. Fork the repo and make changes.
  126. 2. Write a test which shows a bug was fixed or the feature works as expected.
  127. 3. Make sure ``travis-ci`` or ``tox`` tests succeed.
  128. 4. Send pull request.
  129. Contributors
  130. ============
  131. https://github.com/Thriftpy/thriftpy2/graphs/contributors
  132. Sponsors:
  133. ============
  134. .. image:: ./docs/jetbrains.svg
  135. :target: https://www.jetbrains.com/?from=ThriftPy
  136. Changelog
  137. =========
  138. https://github.com/Thriftpy/thriftpy2/blob/master/CHANGES.rst
  139. Keywords: thrift python thriftpy thriftpy2
  140. Platform: UNKNOWN
  141. Classifier: Topic :: Software Development
  142. Classifier: Development Status :: 4 - Beta
  143. Classifier: Intended Audience :: Developers
  144. Classifier: License :: OSI Approved :: MIT License
  145. Classifier: Programming Language :: Python :: 2
  146. Classifier: Programming Language :: Python :: 2.7
  147. Classifier: Programming Language :: Python :: 3
  148. Classifier: Programming Language :: Python :: 3.4
  149. Classifier: Programming Language :: Python :: 3.5
  150. Classifier: Programming Language :: Python :: 3.6
  151. Classifier: Programming Language :: Python :: 3.7
  152. Classifier: Programming Language :: Python :: Implementation :: CPython
  153. Classifier: Programming Language :: Python :: Implementation :: PyPy
  154. Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
  155. Provides-Extra: dev
  156. Provides-Extra: tornado