python-multipart

A fast, streaming multipart/form-data parser for Python that powers file uploads in FastAPI and Starlette.

Library
PyPI
v0.0.32
531 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
65 /100 Good
Development Activity 64
Maintenance 44
Community 72
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
85 /100 Excellent
Architecture 88
Code Quality 92
Innovation 82
Learning Curve 78

python-multipart is an Apache2-licensed, dependency-free streaming parser for multipart/form-data, URL-encoded querystrings, and raw octet streams. It processes uploads incrementally as bytes arrive rather than buffering entire request bodies in memory, making it well suited for large file uploads and high-throughput web servers.

The library is the parsing engine behind Starlette and FastAPI’s request-form handling, and it exposes callback-driven parsers plus a convenient high-level parse_form helper. With 100% test coverage and continuous fuzzing, it is a battle-tested, production-grade component used across the Python web ecosystem.

What You Get

  • A streaming multipart/form-data parser that emits fields and file chunks via callbacks without buffering the full request body
  • Dedicated parsers for querystrings and raw octet streams alongside the multipart parser
  • A high-level parse_form / create_form_parser API plus Field and File abstractions that spool large uploads to disk
  • Base64 and quoted-printable stream decoders for transfer-encoded content
  • Typed exceptions (MultipartParseError, QuerystringParseError, DecodeError) with byte-offset error reporting

Common Use Cases

  • Handling file uploads in ASGI/WSGI web frameworks such as FastAPI and Starlette
  • Parsing form submissions in a custom Python web server or middleware layer
  • Streaming very large uploads to disk with a bounded memory footprint
  • Decoding Base64 or quoted-printable encoded form parts

Under The Hood

Architecture - The core is a hand-written, callback-driven state machine in python_multipart/multipart.py (~1,900 lines). BaseParser defines the callback dispatch, and MultipartParser, QuerystringParser, and OctetStreamParser each advance through explicit IntEnum states (MultipartState, QuerystringState) byte by byte as write() is fed chunks, invoking on_field_data, on_part_begin, and similar callbacks rather than materializing the full body. The high-level FormParser plus create_form_parser/parse_form wire these low-level parsers to Field and File objects that spool oversized parts to temporary files. parse_options_header handles Content-Type/Content-Disposition header parsing.

Tech Stack - Pure Python (>=3.10) with zero runtime dependencies, built with the Hatchling backend and versioned from __init__.py. Development tooling uses uv for locking, pytest with pytest-cov and pytest-codspeed for benchmarks, ruff and mypy for lint/types, nox for task orchestration, and atheris for fuzzing. Docs are built with MkDocs Material.

Code Quality - Exceptionally high. The project advertises 100% test coverage, and the tests/ directory (test_multipart.py, test_file.py, test_benchmarks.py) plus a dedicated fuzz/ suite exercise the parsers extensively. The codebase is fully type-annotated, uses a clean exception hierarchy in exceptions.py (FormParserError -> ParseError -> specific errors) with byte-offset reporting, and keeps a legacy multipart/ shim alongside the canonical python_multipart/ package for import-compatibility.

API Design - The public surface is small and well-documented via docstrings and a hosted docs site. Low-level parsers require wiring callbacks, which is powerful but verbose; the parse_form and create_form_parser helpers give a much simpler entry point for common cases. Naming is consistent and the Field/File abstractions map cleanly onto form semantics, so most users get started with a single high-level call.

Used by 43 apps in this directory

TypeScript
59%
Other

agenta

AI Development · Developer Tools · Devops

4,752

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript 59%
Python 38%
Updated 1 weeks ago
Python
100%
Apache 2.0

Agno

AI Development · Automation · Devops

42,173

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python 100%
Updated 1 weeks ago
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,857

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 90%
Updated 1 weeks ago
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,108

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
66
Repo Health
81
Technical
61
Dependency
Built with
Python 59%
Jupyter Notebook 21%
Updated 1 weeks ago
Other

Arkon

AI Assistants · Knowledge Management

1,448

Self-hosted enterprise AI knowledge hub that compiles internal docs into a scoped, reviewable wiki and serves it to Claude and other LLMs through an MCP server.

View details
48
Repo Health
74
Technical
0
Dependency
Python
67%
Other

AutoGPT

AI Assistants · Automation · Productivity

187,344

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
66
Dependency
Built with
Python 67%
TypeScript 32%
Updated 1 weeks ago
Python
44%
MIT

/dev/push

Developer Tools · Devops

4,746

Self-hosted, open-source Vercel alternative that deploys Python, Node.js, PHP, and any Docker-compatible app from a Git push, with zero-downtime rollouts and real-time logs.

View details
43
Repo Health
68
Technical
72
Dependency
Built with
Python 44%
HTML 31%
CSS 17%
Updated 6 months ago
Python
64%
MIT

Flowfile

Data Engineering

353

Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.

View details
83
Repo Health
81
Technical
66
Dependency
Built with
Python 64%
Vue 18%
TypeScript 16%
Updated 1 weeks ago
TypeScript
53%
Apache 2.0

Flowsint

Automation · Developer Tools

8,374

A privacy-first, graph-based OSINT investigation platform with 30+ automated enrichers for mapping relationships between domains, IPs, people, and organizations.

View details
83
Repo Health
71
Technical
67
Dependency
Built with
TypeScript 53%
Python 44%
Updated 2 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers