{"id":13741076,"url":"https://github.com/vmagamedov/grpclib","last_synced_at":"2025-05-14T13:10:02.326Z","repository":{"id":41452692,"uuid":"79909496","full_name":"vmagamedov/grpclib","owner":"vmagamedov","description":"Pure-Python gRPC implementation for asyncio","archived":false,"fork":false,"pushed_at":"2025-05-04T16:26:54.000Z","size":799,"stargazers_count":958,"open_issues_count":41,"forks_count":92,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-05-12T06:39:29.511Z","etag":null,"topics":["asyncio","grpc","h2","microservices","protobuf","python"],"latest_commit_sha":null,"homepage":"http://grpclib.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vmagamedov.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2017-01-24T12:27:42.000Z","updated_at":"2025-05-09T02:10:43.000Z","dependencies_parsed_at":"2025-03-09T20:42:54.974Z","dependency_job_id":"8f064ea3-d5c8-4907-ba59-d4d622c79de1","html_url":"https://github.com/vmagamedov/grpclib","commit_stats":{"total_commits":417,"total_committers":17,"mean_commits":"24.529411764705884","dds":0.04796163069544368,"last_synced_commit":"c0021f1102c897baaee342952f9bc1868bdd535c"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmagamedov%2Fgrpclib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmagamedov%2Fgrpclib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmagamedov%2Fgrpclib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmagamedov%2Fgrpclib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmagamedov","download_url":"https://codeload.github.com/vmagamedov/grpclib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149977,"owners_count":22022852,"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":["asyncio","grpc","h2","microservices","protobuf","python"],"created_at":"2024-08-03T04:00:55.221Z","updated_at":"2025-05-14T13:09:57.311Z","avatar_url":"https://github.com/vmagamedov.png","language":"Python","funding_links":[],"categories":["Language-Specific"],"sub_categories":["Python"],"readme":"Pure-Python gRPC implementation for asyncio\n===========================================\n\n.. image:: https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/7e1631d13476f1e870af0d5605b643fc14471a6d/banner-direct-single.svg\n  :target: https://standforukraine.com\n\n|project|_ |documentation|_ |version|_ |tag|_ |downloads|_ |license|_\n\nThis project is based on `hyper-h2`_ and **requires Python \u003e= 3.8**.\n\n.. contents::\n  :local:\n\nExample\n~~~~~~~\n\nSee `examples`_ directory in the project's repository for all available\nexamples.\n\nClient\n------\n\n.. code-block:: python3\n\n  import asyncio\n\n  from grpclib.client import Channel\n\n  # generated by protoc\n  from .helloworld_pb2 import HelloRequest, HelloReply\n  from .helloworld_grpc import GreeterStub\n\n\n  async def main():\n      async with Channel('127.0.0.1', 50051) as channel:\n          greeter = GreeterStub(channel)\n\n          reply = await greeter.SayHello(HelloRequest(name='Dr. Strange'))\n          print(reply.message)\n\n\n  if __name__ == '__main__':\n      asyncio.run(main())\n\nServer\n------\n\n.. code-block:: python3\n\n  import asyncio\n\n  from grpclib.utils import graceful_exit\n  from grpclib.server import Server\n\n  # generated by protoc\n  from .helloworld_pb2 import HelloReply\n  from .helloworld_grpc import GreeterBase\n\n\n  class Greeter(GreeterBase):\n\n      async def SayHello(self, stream):\n          request = await stream.recv_message()\n          message = f'Hello, {request.name}!'\n          await stream.send_message(HelloReply(message=message))\n\n\n  async def main(*, host='127.0.0.1', port=50051):\n      server = Server([Greeter()])\n      # Note: graceful_exit isn't supported in Windows\n      with graceful_exit([server]):\n          await server.start(host, port)\n          print(f'Serving on {host}:{port}')\n          await server.wait_closed()\n\n\n  if __name__ == '__main__':\n      asyncio.run(main())\n\nInstallation\n~~~~~~~~~~~~\n\n.. code-block:: console\n\n  $ pip3 install \"grpclib[protobuf]\"\n\nBug fixes and new features are frequently published via release candidates:\n\n.. code-block:: console\n\n  $ pip3 install --upgrade --pre \"grpclib[protobuf]\"\n\nFor the code generation you will also need a ``protoc`` compiler, which can be\ninstalled with ``protobuf`` system package:\n\n.. code-block:: console\n\n  $ brew install protobuf  # example for macOS users\n  $ protoc --version\n  libprotoc ...\n\n\n**Or** you can use ``protoc`` compiler from the ``grpcio-tools`` Python package:\n\n.. code-block:: console\n\n  $ pip3 install grpcio-tools\n  $ python3 -m grpc_tools.protoc --version\n  libprotoc ...\n\n**Note:** ``grpcio`` and ``grpcio-tools`` packages are **not required in\nruntime**, ``grpcio-tools`` package will be used only during code generation.\n\n``protoc`` plugin\n~~~~~~~~~~~~~~~~~\n\nIn order to use this library you will have to generate special stub files using\nplugin provided, which can be used like this:\n\n.. code-block:: console\n\n  $ python3 -m grpc_tools.protoc -I. --python_out=. --grpclib_python_out=. helloworld/helloworld.proto\n                                                      ^----- note -----^\n\nThis command will generate ``helloworld_pb2.py`` and ``helloworld_grpc.py``\nfiles.\n\nPlugin which implements ``--grpclib_python_out`` option should be available for\nthe ``protoc`` compiler as the ``protoc-gen-grpclib_python`` executable which\nshould be installed by ``pip`` into your ``$PATH`` during installation of the\n``grpclib`` library.\n\nChanged in v0.3.2: ``--python_grpc_out`` option was renamed into\n``--grpclib_python_out``.\n\nContributing\n~~~~~~~~~~~~\n\n* Please submit an issue before working on a Pull Request\n* Do not merge/squash/rebase your development branch while you work on a Pull\n  Request, use rebase if this is really necessary\n* You may use Tox_ in order to test and lint your changes, but it is Ok to rely\n  on CI for this matter\n\n.. _gRPC: http://www.grpc.io\n.. _hyper-h2: https://github.com/python-hyper/hyper-h2\n.. _grpcio: https://pypi.org/project/grpcio/\n.. _Tox: https://tox.readthedocs.io/\n.. _examples: https://github.com/vmagamedov/grpclib/tree/master/examples\n.. |version| image:: https://img.shields.io/pypi/v/grpclib.svg?label=stable\u0026color=blue\n.. _version: https://pypi.org/project/grpclib/\n.. |license| image:: https://img.shields.io/pypi/l/grpclib.svg?color=blue\n.. _license: https://github.com/vmagamedov/grpclib/blob/master/LICENSE.txt\n.. |tag| image:: https://img.shields.io/github/tag/vmagamedov/grpclib.svg?label=latest\u0026color=blue\n.. _tag: https://pypi.org/project/grpclib/#history\n.. |project| image:: https://img.shields.io/badge/vmagamedov%2Fgrpclib-blueviolet.svg?logo=github\u0026color=blue\n.. _project: https://github.com/vmagamedov/grpclib\n.. |documentation| image:: https://img.shields.io/badge/docs-grpclib.rtfd.io-blue.svg\n.. _documentation: https://grpclib.readthedocs.io/en/latest/\n.. |downloads| image:: https://static.pepy.tech/badge/grpclib/month\n.. _downloads: https://pepy.tech/project/grpclib\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmagamedov%2Fgrpclib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmagamedov%2Fgrpclib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmagamedov%2Fgrpclib/lists"}