Framework M
The complete metadata-driven business application framework for Python 3.12+.
Official Website: frameworkm.dev
📦 Metapackage: This is the primary Framework M package. Installing it gives you everything required to build applications. For individual components, see the Related Packages section.
Overview
Framework M is inspired by Frappe Framework but built with modern Python practices:
- Hexagonal Architecture: Clean separation via Ports & Adapters
- Async-First: Native asyncio with Litestar and SQLAlchemy
- Type-Safe: 100% type hints, mypy strict compatible
- Stateless: JWT/Token auth, no server-side sessions
- Metadata-Driven: Define DocTypes as Pydantic models
Installation
pip install framework-m
Or with uv:
uv add framework-m
Quick Start
1. Define a DocType
from framework_m import DocType, Field
class Todo(DocType):
"""A simple task document."""
title: str = Field(description="Task title")
description: str | None = Field(default=None, description="Task details")
is_completed: bool = Field(default=False, description="Completion status")
priority: int = Field(default=1, ge=1, le=5, description="Priority (1-5)")
2. Use the CLI
# Show version
m --version
# Show framework info
m info
# Start production server
m prod
# Start development server
m dev
Architecture & Features
Framework M follows a strict Ports & Adapters (Hexagonal) architecture. The core domain logic is isolated from infrastructure concerns.
- Primary Adapters: HTTP API (Litestar), CLI, WebSockets, Job Workers.
- Core Domain: DocTypes, Controllers, and Business Logic.
- Ports (Interfaces): Defined protocols for Repositories, Events, Storage, etc.
- Secondary Adapters: Implementations for PostgreSQL, Redis, S3, etc.
Key Capabilities:
- Automatic CRUD operations (
RepositoryProtocol) - Event-driven architecture (
EventBusProtocol) - Row-level security & permissions (
PermissionProtocol) - Background jobs (
JobQueueProtocol) - File storage abstraction (
StorageProtocol)
Technology Stack
- Web Framework: Litestar 2.0+
- ORM: SQLAlchemy 2.0 (Async)
- Validation: Pydantic V2
- Task Queue: Taskiq + NATS JetStream
- DI Container: dependency-injector
- Database: PostgreSQL (default), SQLite (testing)
- Cache: Redis
- Events: NATS JetStream
Development
# Clone and setup
git clone https://gitlab.com/framework-m/framework-m.git
cd framework-m
# Install dependencies
uv sync --all-packages --all-extras --all-groups
# Run tests
uv run pytest
# Type checking
uv run mypy src/framework_m --strict
# Linting
uv run ruff check .
uv run ruff format .
Documentation
Related Packages
Framework M is split into modular packages:
| Package | Description |
|---|---|
framework-m |
This package - Metapackage with CLI, kernel, and re-exports |
framework-m-core |
Core protocols and dependency injection |
framework-m-standard |
Default adapters (SQLAlchemy, Redis, Litestar) |
framework-m-studio |
Visual DocType builder UI |
License
Apache 2.0 License - see LICENSE for details.
Acknowledgments
Inspired by Frappe Framework, reimagined with:
- Modern Python (3.12+, async/await, type hints)
- Clean architecture (Hexagonal/Ports & Adapters)
- No global state (Dependency Injection)
- Code-first schemas (Pydantic, not database JSON)
Metadata
Release files for framework-m 0.16.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| framework_m-0.16.13.tar.gz | 52.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| framework_m-0.16.13-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.9 kB
Release files / framework_m-0.16.13.tar.gz
| Download URL | framework_m-0.16.13.tar.gz |
|---|---|
| Size | 52.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
644f97e02a3f5ff213b8817e9cf2e37aae129ff3f93ae17972c4b86bcc4ca1a2
|
|
BLAKE2b-256 checksum How to use checksums |
b42b9dfdcb760aa11ecd83e067fe11f3c2cd1cbd24f42cdb0b5b51d0af019abc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / framework_m-0.16.13-py3-none-any.whl
| Download URL | framework_m-0.16.13-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
766f458be3d69f206b9966f66222c1441e5d38c22d943416eef4d81cda92b93d
|
|
BLAKE2b-256 checksum How to use checksums |
4a8fe8d4a8b85c6b26b5d821d91eab4dde80cc663260829d94e7f4778161e851
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for framework-m 0.16.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.