Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Flaskion

Flaskion is a Laravel-inspired application framework and project scaffolder for Flask. The 2.0.0a1 runtime adds a small interface-independent use-case boundary while retaining the Flask project generators from Phase 1.

Flaskion 2 is being designed as an AI-native application framework. The generic Task List uses Flaskion's optional MCP API as a third adapter beside HTTP and CLI; authentication and remote deployment integration remain future work.

Current features

  • Flask application factory and explicit extension initialization
  • flaskion.Application for registering and invoking plain Python use cases
  • Constructor-based service and repository dependencies without a DI container
  • Optional flaskion.mcp API backed by FastMCP 4
  • Local stdio and remote Streamable HTTP serving with MCP test support
  • Separate web and JSON API blueprints
  • SQLite, MySQL, or PostgreSQL project configuration
  • SQLAlchemy and Flask-Migrate
  • Conflict-safe model, controller, schema, resource, and authentication generators
  • Session authentication scaffold with CSRF-protected forms
  • Cross-platform virtual-environment invocation

Installation

pipx install flaskion
# or
pip install flaskion
# Optional MCP adapter support
pip install "flaskion[mcp]"

Flaskion requires Python 3.11 or newer. The core package and optional MCP integration share the same supported Python floor.

Create a project

flaskion make:new myproject --db=sqlite
cd myproject
source .venv/bin/activate
flask run

On Windows, activate the environment with .venv\Scripts\activate.

Use --db=mysql or --db=postgres to install and configure the matching SQLAlchemy driver. Use --no-install to create files without creating an environment or installing dependencies.

The default creation flow:

  1. builds the project in a staging directory;
  2. writes a random development secret and a database URL to .env;
  3. initializes Git;
  4. creates .venv and installs dependencies;
  5. initializes the Alembic migration repository;
  6. moves the complete project into its final directory.

If a setup command fails, Flaskion reports the command and removes the incomplete staging directory.

Generated project structure

myproject/
├── app/
│   ├── __init__.py           # Application factory
│   ├── application.py        # Interface-independent use-case registration
│   ├── config.py             # Environment-backed configuration
│   ├── extensions.py         # Unbound Flask extensions
│   ├── controllers/
│   ├── models/
│   ├── routes/
│   ├── schemas/
│   ├── static/
│   └── templates/
├── migrations/               # Created by `flask db init`
├── .env.example
├── requirements.txt
└── run.py

Commands

Command Description
flaskion make:new NAME Create a project; accepts --db and --no-install
flaskion make:model NAME Create and explicitly register a SQLAlchemy model
flaskion make:schema NAME Create a Marshmallow SQLAlchemy schema
flaskion make:controller NAME Create a web controller; accepts --api for JSON stubs
flaskion make:resource NAME Atomically create model, controller, schema, and routes; accepts --api
flaskion make:auth Create session authentication and CSRF-protected templates

Generators refuse to overwrite existing files. Multi-file generation is planned before writing, so a conflict does not leave a partially changed project. Names such as CardGrader, card-grader, and card_grader normalize to consistent Python module and class names.

Generated API controller methods return explicit 501 Not Implemented JSON until application behavior is supplied. Flaskion does not generate pretend persistence logic.

Database migrations

The normal project-creation flow runs flask db init. Create and apply revisions with:

flask db migrate -m "Initial schema"
flask db upgrade

When a project is created with --no-install, install its dependencies and run flask db init yourself before creating the first revision.

Authentication scaffold

flaskion make:auth

This creates a user model, schema, controller, and login/register/dashboard templates. Forms carry Flask-WTF CSRF tokens, login clears prior session data, passwords must contain at least 12 characters, and logout is POST-only.

This remains starter authentication, not a complete identity product. Production applications still need requirements appropriate to their threat model, such as email verification, password reset, rate limiting, secure-cookie deployment settings, and authorization policies.

Development

Install the development dependency group with a compatible environment manager, then run:

python -m unittest discover -v
ruff check .
python -m build

When running directly from a source checkout with the src/ layout, use an editable install or set PYTHONPATH=src:..

Runtime usage

Use cases do not inherit from Flaskion classes. Register a plain function, bound service method, or callable object against any message type:

from dataclasses import dataclass

from flaskion import Application


@dataclass(frozen=True)
class Greet:
    name: str


application = Application()
application.register(Greet, lambda message: f"Hello, {message.name}")

assert application.handle(Greet("Ada")) == "Hello, Ada"

The decorator form @application.use_case(Greet) is available but optional. Services and repository protocols are application-owned; Flaskion does not require base classes or a universal repository abstraction.

Task List example

The canonical example is under examples/task_list. It implements create, list, and complete through one TaskService, a repository protocol, and a SQLite adapter. HTTP, CLI, and MCP receive the same Application instance and invoke the same handlers.

PYTHONPATH=src:. flask --app examples.task_list.run run
PYTHONPATH=src:. python -m examples.task_list.cli create "Write documentation"
PYTHONPATH=src:. python -m examples.task_list.cli list
PYTHONPATH=src:. python -m examples.task_list.cli complete 1
PYTHONPATH=src:. flaskion mcp:serve --app examples.task_list.mcp_server:mcp

Install the MCP adapter with pip install -e '.[mcp]'. MCP remains optional: FastMCP is imported only by flaskion.mcp's private compatibility boundary, never by Task List code.

For a remotely connectable development endpoint, use Streamable HTTP:

PYTHONPATH=src:. flaskion mcp:serve \
  --app examples.task_list.mcp_server:mcp \
  --transport http --host 127.0.0.1 --port 8000

The MCP endpoint is http://127.0.0.1:8000/mcp. Inspect it locally with:

npx -y @modelcontextprotocol/inspector --web http://127.0.0.1:8000/mcp

Loopback is the safe default. Binding to a public interface exposes an unauthenticated MCP endpoint until Flaskion's remote authentication boundary is implemented; use network controls and do not treat the development command as a production deployment configuration.

The example intentionally does not include jobs, events, authentication policy, generic middleware, or a dependency-injection container.

Architecture documents

Metadata

Release files for flaskion 2.0.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flaskion 2.0.0a1
File Size Uploaded
flaskion-2.0.0a1.tar.gz 299.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flaskion 2.0.0a1
File Interpreter ABI Platform
flaskion-2.0.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 574.0 kB

Release files / flaskion-2.0.0a1.tar.gz

Download URL flaskion-2.0.0a1.tar.gz
Size 299.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8871418977061a53129078357ca18316c7a988e661f659df9d3dd4494fbc6149
BLAKE2b-256 checksum
How to use checksums
6c5459998e871f65ddfb317b7f8dea25a54265285cea8f1d3e5b41d8092786fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / flaskion-2.0.0a1-py3-none-any.whl

Download URL flaskion-2.0.0a1-py3-none-any.whl
Size 274.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fbf3b3ec5e5d936d4c8c935d06d38a0684a4e50d467420a80b9049903f869e3
BLAKE2b-256 checksum
How to use checksums
c3597e3c2489d20f5cbb7f9cd3e20feaf9527a1bead19705c3d71717cb6d6cf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0a1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page