Schism

A service framework for Python that makes modularity simple

Features

Autowiring

Simplifies dependency injection between services using Bevy's dependency injection system.

Modular Design

Makes modularity straightforward in monolithic applications and facilitates code sharing in microservices.

Flexible Deployment

Run as a monolith or distributed services with minimal code changes.

Simple Configuration

Configure your services with a simple YAML file.

Getting Started

Installation

pip install schism

Requires Python 3.12 or higher

Basic Usage

Create a service by inheriting from schism.Service:

# greetings.py
from bevy import inject, dependency
from schism import Service, start_app

class GreetingService(Service):
    async def greet(self, name: str) -> str:
        print("Handling request...")
        return f"Hello, {name}!"


@inject
async def greet(greeting_service: GreetingService = dependency()):
    print(await greeting_service.greet("World"))


async def main():
    await greet()


if __name__ == "__main__":
    start_app(main())  # Activate a Schism controller and launch the app

Create a schism.config.yaml file:

launch:
  app: greetings:main
services:
  - name: greeting
    service: greetings:GreetingService
    bridge:
      type: schism.ext.bridges.simple_tcp:SimpleTCP
      serve_on: localhost:1234

Running Your Application

Run as a service:

schism run service greeting

Run the client application:

schism run

Or run as a monolith:

python greetings.py

Documentation

For more detailed documentation and examples, please visit the GitHub repository.