{"id":13936092,"url":"https://github.com/Thriftpy/thriftpy2","last_synced_at":"2025-07-19T21:31:38.609Z","repository":{"id":33898137,"uuid":"150396294","full_name":"Thriftpy/thriftpy2","owner":"Thriftpy","description":"Pure python approach of Apache Thrift. ","archived":false,"fork":false,"pushed_at":"2025-07-14T13:27:45.000Z","size":1298,"stargazers_count":581,"open_issues_count":43,"forks_count":98,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-07-14T16:52:15.161Z","etag":null,"topics":["python","rpc","thrift","thriftpy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Thriftpy.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-09-26T08:47:01.000Z","updated_at":"2025-07-14T13:03:44.000Z","dependencies_parsed_at":"2023-02-18T18:15:18.894Z","dependency_job_id":"a7aa88ce-efce-4c3b-a4f3-3bf9fdb7e67d","html_url":"https://github.com/Thriftpy/thriftpy2","commit_stats":{"total_commits":804,"total_committers":78,"mean_commits":"10.307692307692308","dds":0.6243781094527363,"last_synced_commit":"d48d58cc23e0f70ee7164babd8342074a09ab407"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"purl":"pkg:github/Thriftpy/thriftpy2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thriftpy%2Fthriftpy2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thriftpy%2Fthriftpy2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thriftpy%2Fthriftpy2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thriftpy%2Fthriftpy2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thriftpy","download_url":"https://codeload.github.com/Thriftpy/thriftpy2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thriftpy%2Fthriftpy2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265336610,"owners_count":23749193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","rpc","thrift","thriftpy"],"created_at":"2024-08-07T23:02:22.519Z","updated_at":"2025-07-19T21:31:33.594Z","avatar_url":"https://github.com/Thriftpy.png","language":"Python","readme":"============\nThriftPy2\n============\n\n.. image:: https://img.shields.io/codecov/c/github/Thriftpy/thriftpy2.svg\n    :target: https://codecov.io/gh/Thriftpy/thriftpy2\n\n.. image:: https://img.shields.io/pypi/dm/thriftpy2.svg\n    :target: https://pypi.org/project/thriftpy2/\n\n.. image:: https://img.shields.io/pypi/v/thriftpy2.svg\n    :target: https://pypi.org/project/thriftpy2/\n\n.. image:: https://img.shields.io/pypi/pyversions/thriftpy2.svg\n    :target: https://pypi.org/project/thriftpy2/\n\n.. image:: https://img.shields.io/pypi/implementation/thriftpy2.svg\n    :target: https://pypi.org/project/thriftpy2/\n\n\nThriftPy: https://github.com/eleme/thriftpy has been deprecated, ThriftPy2 aims to provide long term support.\n\n\nMigrate from Thriftpy?\n======================\n\nAll you need is:\n\n.. code:: python\n\n    import thriftpy2 as thriftpy\n\n\nThat's it! thriftpy2 is fully compatible with thriftpy.\n\n\nInstallation\n============\n\nInstall with pip.\n\n.. code:: bash\n\n    $ pip install thriftpy2\n\nYou may also install cython first to build cython extension locally.\n\n.. code:: bash\n\n    $ pip install cython thriftpy2\n\n\nCode Demo\n=========\n\nThriftPy make it super easy to write server/client code with thrift. Let's\ncheckout this simple pingpong service demo.\n\nWe need a 'pingpong.thrift' file:\n\n::\n\n    service PingPong {\n        string ping(),\n    }\n\nThen we can make a server:\n\n.. code:: python\n\n    import thriftpy2\n    pingpong_thrift = thriftpy2.load(\"pingpong.thrift\", module_name=\"pingpong_thrift\")\n\n    from thriftpy2.rpc import make_server\n\n    class Dispatcher(object):\n        def ping(self):\n            return \"pong\"\n\n    server = make_server(pingpong_thrift.PingPong, Dispatcher(), '127.0.0.1', 6000)\n    server.serve()\n\nAnd a client:\n\n.. code:: python\n\n    import thriftpy2\n    pingpong_thrift = thriftpy2.load(\"pingpong.thrift\", module_name=\"pingpong_thrift\")\n\n    from thriftpy2.rpc import make_client\n\n    client = make_client(pingpong_thrift.PingPong, '127.0.0.1', 6000)\n    print(client.ping())\n\nAnd it also supports asyncio on Python 3.5 or later:\n\n.. code:: python\n\n    import thriftpy2\n    import asyncio\n    from thriftpy2.rpc import make_aio_client\n\n\n    echo_thrift = thriftpy2.load(\"echo.thrift\", module_name=\"echo_thrift\")\n\n\n    async def request():\n        client = await make_aio_client(\n            echo_thrift.EchoService, '127.0.0.1', 6000)\n        print(await client.echo('hello, world'))\n        client.close()\n\n.. code:: python\n\n    import asyncio\n    import thriftpy2\n\n    from thriftpy2.rpc import make_aio_server\n\n    echo_thrift = thriftpy2.load(\"echo.thrift\", module_name=\"echo_thrift\")\n\n\n    class Dispatcher(object):\n        async def echo(self, param):\n            print(param)\n            await asyncio.sleep(0.1)\n            return param\n\n\n    def main():\n        server = make_aio_server(\n            echo_thrift.EchoService, Dispatcher(), '127.0.0.1', 6000)\n        server.serve()\n\n\n    if __name__ == '__main__':\n        main()\n\nSee, it's that easy!\n\nYou can refer to 'examples' and 'tests' directory in source code for more\nusage examples.\n\n\nFeatures\n========\n\nCurrently ThriftPy have these features (also advantages over the upstream\npython lib):\n\n- Python 3.6+ and PyPy3.\n\n- Pure python implementation. No longer need to compile \u0026 install the 'thrift'\n  package. All you need is thriftpy2 and thrift file.\n\n- Compatible with Apache Thrift. You can use ThriftPy together with the\n  official implementation servers and clients, such as a upstream server with\n  a thriftpy2 client or the opposite.\n\n  Currently implemented protocols and transports:\n\n  * binary protocol (python and cython)\n\n  * compact protocol (python and cython)\n\n  * json protocol\n\n  * Apache JSON protocol compatible with apache thrift distribution's JSON protocol.\n    Simply do ``from thriftpy2.protocol import TApacheJSONProtocolFactory`` and pass\n    this to the ``proto_factory`` argument where appropriate.\n\n  * buffered transport (python \u0026 cython)\n\n  * framed transport\n\n  * tornado server and client (with tornado 4.0)\n\n  * http server and client\n\n  * asyncio support (python 3.5 or later)\n\n- Can directly load thrift file as module, the sdk code will be generated on\n  the fly.\n\n  For example, ``pingpong_thrift = thriftpy2.load(\"pingpong.thrift\", module_name=\"pingpong_thrift\")``\n  will load 'pingpong.thrift' as 'pingpong_thrift' module.\n\n  Or, when import hook enabled by ``thriftpy2.install_import_hook()``, you can\n  directly use ``import pingpong_thrift`` to import the 'pingpong.thrift' file\n  as module, you may also use ``from pingpong_thrift import PingService`` to\n  import specific object from the thrift module.\n\n- Easy RPC server/client setup.\n\n\n\nContribute\n==========\n\n1. Fork the repo and make changes.\n\n2. Write a test which shows a bug was fixed or the feature works as expected.\n\n3. Make sure ``tox`` tests succeed.\n\n4. Send pull request.\n\n\nContributors\n============\n\nhttps://github.com/Thriftpy/thriftpy2/graphs/contributors\n\n\nSponsors:\n============\n\n.. image:: ./docs/jetbrains.svg\n    :target: https://www.jetbrains.com/?from=ThriftPy\n\n\nChangelog\n=========\n\nhttps://github.com/Thriftpy/thriftpy2/blob/master/CHANGES.rst\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThriftpy%2Fthriftpy2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FThriftpy%2Fthriftpy2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThriftpy%2Fthriftpy2/lists"}