rust-multipart
[!WARNING] This project is a work in progress and is not ready for production use.
This package provides a Sans-IO parser for RFC 7578 multipart/form-data.
It is heavily inspired by defnull/multipart.
Installation
pip install rust-multipart
Usage
from rust_multipart import MultipartParser, PartBegin, PartData, PartEnd
parser = MultipartParser(boundary=b"boundary")
events = parser.feed(b'--boundary\r\nContent-Disposition: form-data; name="user"\r\n\r\nPotato\r\n--boundary--\r\n')
parser.finish()
begin, data, end = events
assert isinstance(begin, PartBegin)
assert begin.headers == [(b"Content-Disposition", b'form-data; name="user"')]
assert isinstance(data, PartData)
assert data.data == b"Potato"
assert isinstance(end, PartEnd)
You can call feed() repeatedly with partial input. Each call returns the batch of events produced by that chunk:
PartBegin carries the ordered raw byte headers, PartData carries a body chunk, and PartEnd closes the part. The
parser never accumulates part bodies, so memory stays bounded regardless of upload size. Call finish() once the
input ends: it raises ValueError if the closing boundary was never received.
Use parse_options_header() to parse header values like Content-Disposition:
from rust_multipart import parse_options_header
value, parameters = parse_options_header('form-data; name="user"')
assert value == "form-data"
assert parameters == {"name": "user"}
Development
uv sync --group dev
uv run maturin develop
scripts/check
scripts/check runs formatting, linting, type checking, Python coverage, native Rust coverage, and the high-level test suite.
Both Python and Rust line coverage must remain at 100%.
Run the CodSpeed benchmarks locally with:
uv run pytest benchmarks --codspeed
License
This project is licensed under the MIT License.
Metadata
Release files for rust-multipart 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rust_multipart-0.0.2.tar.gz | 78.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| rust_multipart-0.0.2-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| rust_multipart-0.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| rust_multipart-0.0.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| rust_multipart-0.0.2-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| rust_multipart-0.0.2-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 1.3 MB
Release files / rust_multipart-0.0.2.tar.gz
| Download URL | rust_multipart-0.0.2.tar.gz |
|---|---|
| Size | 78.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e137d0117e815b8670187919af6b3f7deebfad8408dbe005415d94f4c5b38174
|
|
BLAKE2b-256 checksum How to use checksums |
6f8d631f8d74d0d1c7674863ab4c067d1cd81e037023e27a5d98a0515ee01807
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rust_multipart-0.0.2-cp310-abi3-win_amd64.whl
| Download URL | rust_multipart-0.0.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 154.7 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f5ea6ca6bf40a62b680237854e0948ab2a9021e68db9d16a0b820b9b4b34ac3e
|
|
BLAKE2b-256 checksum How to use checksums |
2aeac29e91b8bba4384d73d90db94bbd25026f1e5717d19213e44ae134347c2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rust_multipart-0.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rust_multipart-0.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 271.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
81a77c5a838849d6472a810962dddea283682b38ff7e1cb77b2433bb968dd075
|
|
BLAKE2b-256 checksum How to use checksums |
5f7b87985969f423dce9772d8b1b08e5086b22c6d3a1edf094aad38076337b1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rust_multipart-0.0.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | rust_multipart-0.0.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 265.8 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d426911d37de9ff74c7d99a1319524433c12abdd6e787b60dc4f0305c009da7c
|
|
BLAKE2b-256 checksum How to use checksums |
a931d19552da649a18686f673f2d4371c6020c1bcc425af286df1e4ec88fd3ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rust_multipart-0.0.2-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | rust_multipart-0.0.2-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 244.5 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1e8639c9d90ce83374de6166c1093e88f4dcb2506aebaa98349563f7b37663f9
|
|
BLAKE2b-256 checksum How to use checksums |
413a6031b6e6619f1a0c6c5e660eaa9f012628e1b727036c1db3dffd20c02b7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rust_multipart-0.0.2-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | rust_multipart-0.0.2-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 254.2 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c8f0087ae9b3d3362544b3822e4a2d2004dc8811338ba3a0958bdf1985c6b2fa
|
|
BLAKE2b-256 checksum How to use checksums |
8091f7b6c372574c24da43988084c02d33ee97dd94d7bfc7a46aff455ebc1c07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|