Skip to main content

A modular, metadata-driven business application framework

Project description

Framework M

The complete metadata-driven business application framework for Python 3.12+.

Official Website: frameworkm.dev

Python 3.12+ PyPI version GitLab Pipeline Status License Code style: ruff Type checked: mypy TestPyPI

📦 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

Development

# Clone and setup
git clone https://gitlab.com/castlecraft/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)

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

framework_m-0.7.0.tar.gz (44.3 kB view details)

Uploaded Source

Built Distribution

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

framework_m-0.7.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file framework_m-0.7.0.tar.gz.

File metadata

  • Download URL: framework_m-0.7.0.tar.gz
  • Upload date:
  • Size: 44.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for framework_m-0.7.0.tar.gz
Algorithm Hash digest
SHA256 cc7599800744c0ab53824eb50983bbdff2c3d3979e4b0cae159d3ac938c7b1c5
MD5 020465e4b4ad662aaf177f7ab4458dbd
BLAKE2b-256 f53053322c847f0593a725aa5c75aed9ed7918827a63c6dff57be40f8500fc05

See more details on using hashes here.

File details

Details for the file framework_m-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: framework_m-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for framework_m-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4e9a7bb35ac3ccc5b7abbcbca02924c813f1f13ad5a2cae1eb3a5de734c0f53
MD5 3909c4457efe3d40d46b3c190a5af1e2
BLAKE2b-256 f0b2002ea2d68cb95731f3751fad3d54482b84fd3431dc0c5df2c13afe6fef5f

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