Skip to main content

pmultipart

PyPI version Python versions License

Fast streaming multipart and form-data parser for Python.

pmultipart is a drop-in replacement for python-multipart that eliminates Python regex and byte-scanning bottlenecks in file uploads and form parsing. It delivers up to 13.4x faster multi-part parsing and 6.5x faster streaming uploads while keeping full API, exception, and callback compatibility with Starlette, FastAPI, and Gradio.

pip install pmultipart
from pmultipart.multipart import MultipartParser, parse_options_header

content_type, params = parse_options_header(b'multipart/form-data; boundary="abc123"')
parser = MultipartParser(params[b"boundary"], {"on_part_data": lambda data, s, e: print(data[s:e])})
parser.write(b"--abc123\r\nContent-Disposition: form-data; name=\"field\"\r\n\r\nhello\r\n--abc123--\r\n")
parser.finalize()

Drop-In Compatibility

pmultipart mirrors the python_multipart package layout (pmultipart.multipart, pmultipart.decoders, pmultipart.exceptions) and passes the full upstream python-multipart test suite (188/188 tests) as well as Starlette, FastAPI, and Gradio integration suites.

Streaming Form Parsing (FormParser / parse_form)

from io import BytesIO
from pmultipart import parse_form

fields = {}
files = {}

parse_form(
    headers={"Content-Type": "multipart/form-data; boundary=myboundary"},
    input_stream=BytesIO(body),
    on_field=lambda field: fields.__setitem__(field.field_name, field.value),
    on_file=lambda file: files.__setitem__(file.field_name, file.file_name),
)

Decoders (Base64Decoder / QuotedPrintableDecoder)

from pmultipart.decoders import Base64Decoder

chunks = []
decoder = Base64Decoder(type("Sink", (), {"write": lambda self, b: chunks.append(b) or len(b), "finalize": lambda self: None, "close": lambda self: None})())
decoder.write(b"SGVsbG8gd29ybGQh")
decoder.finalize()

Benchmarks

Measured against python-multipart v0.0.34 (median of 5 runs):

Workload x86-64 (i5-12400 AVX2) Apple M4 (ARM64 NEON)
10 MB Multipart (64 KB chunks) 6.52x faster 1.89x faster (0.47 ms → 0.25 ms)
50-part Multipart (×200) 13.42x faster 12.83x faster (20.65 ms → 1.61 ms)
parse_options_header (×20k) 4.62x faster 4.41x faster (32.78 ms → 7.43 ms)
100-field Querystring (×500) 2.57x faster 3.23x faster (14.11 ms → 4.37 ms)

End-to-end framework benchmarks (including ASGI/HTTP/SpooledTemporaryFile overhead):

  • Starlette (10 MB upload): 21.84 ms → 13.23 ms (1.65x faster)
  • FastAPI (5 MB upload via TestClient): 13.21 ms → 8.43 ms (1.57x faster)
  • Gradio (10 MB upload + SHA-256 staging): 24.85 ms → 19.66 ms (1.26x faster)

Under the Hood

  • Zero external runtime dependencies: Built in Rust with PyO3 (cp39-abi3 limited API, gil_used = false for free-threaded Python 3.13t/3.14t).
  • Runtime SIMD dispatch: AVX2 (32 B/iter) and SSE2 (16 B/iter) on x86-64, 64 B/iter 4x-unrolled NEON on ARM64, plus a pure scalar fallback.
  • PEP 561 typed: Ships with py.typed and .pyi stubs verified with mypy --strict and stubtest.
  • Battle-tested: Verified with Hypothesis property-based fuzzing, Rust SIMD alignment tests across offsets 0..32, abi3audit --strict, and downstream integration suites.

Metadata

Release files for pmultipart 0.1.0

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

Source distribution (sdist)

Source distribution for pmultipart 0.1.0
File Size Uploaded Provenance Actions
pmultipart-0.1.0.tar.gz 34.3 kB With provenance Details for pmultipart-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pmultipart 0.1.0
File Actions
pmultipart-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for pmultipart-0.1.0-cp39-abi3-win_amd64.whl
pmultipart-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for pmultipart-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
pmultipart-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for pmultipart-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
pmultipart-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for pmultipart-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pmultipart-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for pmultipart-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pmultipart-0.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for pmultipart-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
pmultipart-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for pmultipart-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 2.2 MB

Release files / pmultipart-0.1.0.tar.gz

Download URL pmultipart-0.1.0.tar.gz
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a8bd3b048ff31d32fd9fcd5fe175e3fdf8885d944e27b424d8626ef817d34366
BLAKE2b-256 checksum
How to use checksums
8703023973578a68540211690f7ceeefa2be979d33cca4e7c259e73b6e80536d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / pmultipart-0.1.0-cp39-abi3-win_amd64.whl

Download URL pmultipart-0.1.0-cp39-abi3-win_amd64.whl
Size 192.1 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a83dd81e25cab8153314196dd42263c24011815b97503d594495d1195c671c92
BLAKE2b-256 checksum
How to use checksums
f403cc792bd7a90bbac97c72160c900e62b2a48da0dfd241aee9b29d319e6ff8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / pmultipart-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pmultipart-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 413.1 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
1f3b8fdc3d5c7ffa215cd8952213e9abec8b49eb2390c393311518579341269e
BLAKE2b-256 checksum
How to use checksums
ba289a4705ee9498eda1bed10c9ad6ef6688eadca9936d30cbe3779ee5951e3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / pmultipart-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pmultipart-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 401.4 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
ae2b8ce1201ca34da04329d4f17a561ebf46976102c64091b8d5970ee95d2589
BLAKE2b-256 checksum
How to use checksums
1e543d07190b9546157304fd36ae857c9b724b5f3e9c6feab8ad8a7e90788033
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / pmultipart-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pmultipart-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 308.3 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
1e1574f839135397f562c74d5cc9bfcd8a08c35c42fc40b05a6a466ffde750b8
BLAKE2b-256 checksum
How to use checksums
55e4b74b1064d8f35497c0e77f85f019782a58415fbe189b6f5f959937204bb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / pmultipart-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pmultipart-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 306.7 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
60643a5c0630cf9cbf1f21b50e3e7118fc93c34f29db89ab5a75e433dca345f7
BLAKE2b-256 checksum
How to use checksums
9b21dcc4687f09866c8c579b96c334d14196daae7714f0b851a07a6655ff3e03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / pmultipart-0.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pmultipart-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Size 278.8 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7092c4f826e1a280a81424009055dc2a06c6e2640f38dd99e4a23ab83fa504b3
BLAKE2b-256 checksum
How to use checksums
39c31ee1182cf7f3137b0b2b0117bff247865b372d2ba70dee98ac6f7759605d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / pmultipart-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pmultipart-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 287.0 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
bb00fe2e4452843db43f28d9be4496e971b6aaf32d52344d8b05f03a842b2265
BLAKE2b-256 checksum
How to use checksums
01564d56f41fe536d20e6fb78453d9fd3038b428f7bcc1fa2f55638cbea2f9c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Security for pmultipart 0.1.0

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.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for pmultipart-0.1.0.tar.gz

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 Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

8 release files Full provenance

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