python-multipart

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

Library
PyPI
v0.0.32
538 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
68 /100 Good
Development Activity 72
Maintenance 48
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 44 apps in this directory

Python
60%
MIT

Foxel

File Storage

1,100

Self-hosted private cloud storage with AI semantic search and a pluggable multi-backend file management system.

View details
81
Repo Health
68
Technical
73
Dependency
Built with
Python 60%
TypeScript 37%
Updated 1 weeks ago
JavaScript
88%
GPL 3.0

Glass by Pickle

AI Assistants

7,604

A privacy-first desktop AI assistant that sees your screen, hears your meetings, and turns live context into structured summaries—without sending a single byte to the cloud.

View details
43
Repo Health
76
Technical
68
Dependency
Built with
JavaScript 88%
TypeScript 12%
Updated 1 years ago
TypeScript
51%
AGPL 3.0

Glean

Bookmarks Archiving · Knowledge Management

872

Self-hosted RSS reader and personal knowledge management tool with MCP server integration for AI assistant connectivity.

View details
73
Repo Health
75
Technical
70
Dependency
Built with
TypeScript 51%
Python 45%
Updated 1 weeks ago
Python
71%
Apache 2.0

GPT Researcher

AI Assistants · Productivity

30,269

The pioneering open-source autonomous AI agent that conducts deep, multi-source research and produces citation-backed reports exceeding 2,000 words — faster and more reliably than any human researcher.

View details
90
Repo Health
91
Technical
64
Dependency
Built with
Python 71%
TypeScript 18%
Updated 2 weeks ago
TypeScript
55%
Other

Jaaz

AI Agents · AI Design Tools

6,721

Open-source AI creative agent that turns visual sketches and canvas gestures into images and videos — no text prompts required.

View details
45
Repo Health
59
Technical
71
Dependency
Built with
TypeScript 55%
Python 34%
JavaScript 10%
Updated 8 months ago
Python
64%
Other

Keep

Automation · Devops · Monitoring

12,433

The open-source AIOps and alert management platform that unifies 130+ monitoring tools into a single pane of glass with AI-powered correlation, deduplication, and workflow automation.

View details
88
Repo Health
79
Technical
66
Dependency
Built with
Python 64%
TypeScript 36%
Updated 1 weeks ago
Python
51%
AGPL 3.0

Khoj

AI Assistants · Knowledge Management · Productivity

37,802

A self-hostable AI second brain that chats with your documents, searches the web, builds custom agents, and runs entirely on your own LLM.

View details
62
Repo Health
82
Technical
66
Dependency
Built with
Python 51%
TypeScript 36%
Updated 2 months ago
Python
94%
Apache 2.0

knowhere

AI Development · AI Memory · Developer Tools

3,755

Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.

View details
83
Repo Health
75
Technical
66
Dependency
Built with
Python 94%
Updated 6 days ago
Python
71%
MIT

Langflow

AI Agents · AI Development

155,973

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
64
Dependency
Built with
Python 71%
TypeScript 21%
Updated 6 days 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