Skip to main content

Polyglot RPC over Redis — call functions across languages

Project description

Python - AnyCall

This directory contains the Python components of the AnyCall project. Call functions across Python services using Redis, with no .proto files, exposed ports, or extra service plumbing to maintain.

Structure

  • AnyCall core library in this directory
  • example-consumer/ - Consumer example
  • example-supplier/ - Supplier example
  • Dockerfile - Docker image for the project
  • pyproject.toml - uv workspace configuration

How to use

Install

# Using uv (recommended)
uv sync

# Or using pip
pip install -e .

Quick usage

  • Supplier: decorate methods with @supply, register the class, and start the server.
  • Consumer: create an AnyCall client and call the supplier method by name.
server = AnyCall.server(redis_uri)
server.register(SentimentAnalyzer())
server.start()

client = AnyCall.client(redis_uri)
sentiment = client.call("analyze-sentiment", request, Sentiment)

For details on how to use as a supplier or consumer, see USAGE.md.

Modules

lib

Core library implementing an RPC framework via Redis Streams. Uses the AnyCall factory class to create clients and servers:

  • AnyCall Client: Synchronous interface for invoking remote methods. Serializes the request to JSON, publishes to a Redis Stream, waits for the response on a callback stream. Supports configurable timeout and optional metrics collection.

  • AnyCall Server: Listener that processes requests from Redis. Maintains a thread pool (one per registered method) consuming from specific streams. Methods are discovered via the @supply decorator on registered classes.

  • Configuration: Via AnycallProperties — defines parameters like Redis URI, timeouts, thread pools, etc.

example-consumer

Client application demonstrating the use of AnyCallClient. Makes 100 RPC calls to the analyze-sentiment method and displays latency statistics (min, avg, p50, p95, p99, max). Includes warmup call and metrics support.

example-supplier

Server application that registers suppliers via AnyCall.server(). The SentimentAnalyzer class contains an analyze_sentiment method decorated with @supply("analyze-sentiment"), which handles sentiment analysis. Starts listeners for each registered method and writes a health file to /tmp/anycall/health.

Project details


Download files

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

Source Distribution

anycall_py-0.1.3.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

anycall_py-0.1.3-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file anycall_py-0.1.3.tar.gz.

File metadata

  • Download URL: anycall_py-0.1.3.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for anycall_py-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8762b19787e50605ea60ed1f930dc6a080bae29d357d117fdf03d9a6435d5c52
MD5 1dd835bdab66416889286e8df0122aa2
BLAKE2b-256 db80dfac50fb7054af35833642a55139f4d7e1d83733f5109639bc9f50fb7c19

See more details on using hashes here.

File details

Details for the file anycall_py-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: anycall_py-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for anycall_py-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9b4d91e4ebafc6af710e5a5a517f9fb93391990c49459b773efc84f855a5c709
MD5 917dcd1397ee0004e8bcff2e1fed33ea
BLAKE2b-256 c9b78d58a55b39a8fff06e11abb194189f08e8b83e4a45d47317c306769a2563

See more details on using hashes here.

Supported by

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