A service framework for Python that makes modularity simple
Simplifies dependency injection between services using Bevy's dependency injection system.
Makes modularity straightforward in monolithic applications and facilitates code sharing in microservices.
Run as a monolith or distributed services with minimal code changes.
Configure your services with a simple YAML file.
pip install schism
Requires Python 3.12 or higher
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
Run as a service:
schism run service greeting
Run the client application:
schism run
Or run as a monolith:
python greetings.py
For more detailed documentation and examples, please visit the GitHub repository.