Back to Architecture Explorer

pallets / flask

The Python micro framework for building web applications.

68.0k
Python
Architecture: library
main
flask
src
flask
__init__.py
app.py
blueprints.py
cli.py
templating.py
json
tests
test_basic.py
templates
examples
tutorial
celery
docs
CHANGES.rst
pyproject.toml
Structural Architecture

Flask is a compact, deliberately unopinionated library that uses the src layout, keeping the importable package isolated from the repository root. The framework itself is a small number of focused modules, with most extensibility pushed out to the surrounding Pallets ecosystem rather than absorbed into the core.

  • src layout, so tests exercise the installed package rather than the working directory.
  • A deliberately small core, with functionality delegated to separate Pallets projects such as Werkzeug and Jinja.
  • Runnable examples kept in the repository as living documentation.

Notable Directories

/src/flask

The framework itself: application object, routing, request and response handling, and templating integration.

/tests

The pytest suite, mirroring the module layout of the package it covers.

/examples

Complete small applications used both as documentation and as integration tests.

/docs

Sphinx documentation source, versioned alongside the code it documents.

Build Your Own Ecosystem

Learn from flask's structure and craft your own software scaffolding.