Core utilities and decorators for the Genro framework.
Development Status: Alpha This package contains shared utilities and decorators used across Genro projects.
- API Decorators: Auto-generate API endpoints with
@apireadydecorator - Type-safe: Leverages Pydantic for automatic validation and schema generation
- DRY Principle: Declare once, use everywhere
pip install genro-coreMark methods as API-ready for automatic endpoint generation:
from genro_core.decorators import apiready
class MyBackend:
@apiready
def read_file(self, path: str, encoding: str = 'utf-8') -> str:
"""Read file content."""
...
@apiready(method='POST')
def delete_file(self, path: str) -> None:
"""Delete file."""
...The decorator auto-generates:
- Pydantic request/response models from type hints
- HTTP method detection (GET for read-only, POST for mutations)
- OpenAPI/Swagger documentation
- Input validation
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black genro_core tests
# Lint
ruff genro_core testsMIT License - see LICENSE file for details.