repowisemiguelgrinberg/microdot

Architecture of miguelgrinberg/microdot

miguelgrinberg/microdot is 171 source files holding 1,225 symbols across 8 modules, written mainly in Python, Shell, Dockerfile. The largest module is examples, with 49 files, and 12 files are entry points into the dependency graph.

How microdot fits together

Application code creates a Microdot object and registers handler functions with its route decorator, which matches URL patterns and HTTP methods. The core framework lives in src/microdot/microdot.py, which dispatches each incoming request to the matching handler. The typings/microdot directory declares type contracts for protocol adapters for WSGI and ASGI, and for features such as authentication, CORS and CSRF protection. For MicroPython targets, libs/micropython and libs/circuitpython provide the module support the framework relies on, and libs/circuitpython/asyncio/core.py defines the scheduling and event loop primitives used by async code. The examples/subapps/app.py file shows how sub-applications are composed into a larger app.

Largest modules

  • examples: 49 files and 1,101 lines of code
  • tests: 22 files and 3,359 lines of code
  • libs: 19 files and 2,325 lines of code
  • src: 16 files and 3,222 lines of code
  • typings: 16 files and 560 lines of code
  • tools: 3 files and 33 lines of code
  • docs: 2 files and 40 lines of code
  • root: 1 file and 11 lines of code

Languages

By file count: Python 122 files, Shell 3 files, Dockerfile 1 file, JavaScript 1 file, Makefile 1 file.

Documentation

Repowise documents microdot in 189 pages generated from the source, 10 of them written explanations of the repository and its modules. Module guides include:

  • libs/circuitpython: CircuitPython Compatibility Layer
  • libs: Libs Overview
  • libs/micropython: MicroPython Crypto and Time
  • typings/microdot: Microdot Type Stubs

More on microdot: summary and FAQ, codebase overview, code health.

Related guide: Best dependency graph tools for monorepos