Skip to main content

egrpc (eazy gRPC)

CI PyPI Python License

egrpc is a Python framework for transparent inter-process communication over gRPC. It generates protobuf definitions and gRPC services automatically from Python type hints at import time, eliminating the need for .proto files or manual code generation. Just add decorators and your functions and classes become callable across process boundaries.

Installation

pip install egrpc

Usage

Remote functions

@egrpc.function makes a function callable over gRPC. Arguments and return values are serialized automatically based on type hints.

import egrpc

@egrpc.function
def add(x: int, y: int) -> int:
    return x + y

Supported types include int, float, str, bool, None, list, dict, tuple, Union, Optional, slice, and nested combinations.

Dataclasses

@egrpc.dataclass defines a value type that is passed by value (serialized by field) across the RPC boundary.

@egrpc.dataclass
class Point:
    x: float
    y: float

@egrpc.function
def distance(p1: Point, p2: Point) -> float:
    return ((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2) ** 0.5

Remote classes

@egrpc.remoteclass defines a stateful object that lives on the server. The client holds a lightweight reference and calls methods via gRPC.

@egrpc.remoteclass
class Counter:
    @egrpc.method
    def __init__(self, initial: int = 0):
        self._count = initial

    @egrpc.property
    def count(self) -> int:
        return self._count

    @egrpc.method
    def increment(self) -> None:
        self._count += 1

Batched calls

egrpc.trace() collects decorated calls into a CallBatch that executes with one RPC.

batch = egrpc.trace(lambda: add(add(1, 2), 3))
assert batch() == 6

egrpc.call() and egrpc.call_type() provide typed Call construction for adapters with their own tracer.

Server / Client

Server:

egrpc.serve(port=12345)

Client:

egrpc.connect("localhost", 12345)

print(add(1, 2))  # 3
print(distance(Point(0, 0), Point(3, 4)))  # 5.0

c = Counter(10)
c.increment()
print(c.count)  # 11

egrpc.disconnect()

Development

This project is managed using uv.

Test:

uv run pytest

Type check:

uv run mypy --strict src/ test/

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Copyright 2025 TOYOTA MOTOR CORPORATION.

Download files

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

Source Distribution

egrpc-0.1.4.tar.gz (49.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

egrpc-0.1.4-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file egrpc-0.1.4.tar.gz.

File metadata

  • Download URL: egrpc-0.1.4.tar.gz
  • Upload date:
  • Size: 49.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for egrpc-0.1.4.tar.gz
Algorithm Hash digest
SHA256 499322297760b39ad1bc5c46848655a17adda732bd8caa3f9674d75dcf6f123a
MD5 c57dbbb4100211c0ecea841adf19e2f8
BLAKE2b-256 c0501630efe42460bda551c498932080238348125f5ca9f223e7b8a792f22d19

See more details on using hashes here.

File details

Details for the file egrpc-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: egrpc-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for egrpc-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b2740fc0e9476a3f404d77bbd97dd6a343a4645bbc98df9e6d159199e154ffd5
MD5 48cda10918b20b81e06aa16413ef3e49
BLAKE2b-256 b755e748cfa8769be623a081d33a86e6c15d067512a3dafcdaead04857146e75

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page