Skip to main content

A gRPC integration for SVCS

Project description

grpc-svcs: A gRPC integration for SVCS

Very in-development

Installation

pip install grpc-svcs

Usage

import grpc_svcs
import svcs

registry = svcs.Registry()
# Register services
registry.register_value(MyType, MyType())

# Attach a `SVCSInterceptor` when creating server.
server = grpc.server(intercepters=[grpc_svcs.SVCSInterceptor(registry)])

# Attach a `SVCSAsyncIntercept` when creating an async server.
server = grpc.aio.server(intercepters=[grpc_svcs.SVCSAsyncInterceptor(registry)])

# Retrieve container inside a servicer
class Greeter(helloworld_pb2_grpc.GreeterServicer):
    def SayHello(self, request, context):
        # call svcs_from
        container = grpc_svcs.svcs_from()
        # get items from svcs
        my_type = container.get(MyType)

        return helloworld_pb2.HelloReply(message="Hello, %s!" % request.name)

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

grpc_svcs-0.1.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

grpc_svcs-0.1.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file grpc_svcs-0.1.2.tar.gz.

File metadata

  • Download URL: grpc_svcs-0.1.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.1

File hashes

Hashes for grpc_svcs-0.1.2.tar.gz
Algorithm Hash digest
SHA256 acefd6558d8d36787d2d2a04fcdacfacee83f9db91b5d5b3a399dc9b3f456b1b
MD5 77529f5cab05bd4809eea4a274cbda64
BLAKE2b-256 c5a2d21669df3ed1e0d03f60617a77e35f2dd4f9eee705b74d22f485a040f61c

See more details on using hashes here.

File details

Details for the file grpc_svcs-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: grpc_svcs-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.1

File hashes

Hashes for grpc_svcs-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7faa0abac0928b392a7a7320cfa4aac2c298717021e0c5a55764894045028032
MD5 46564cd1eb15be3d03979ba59ce115fd
BLAKE2b-256 f7c81f503aa1b0dbb253c8d7f33d1342f6b7926e593e83e0a2741a819473ab2d

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