Python port of @mailkite/mail-parse — MIME parser + cross-language failure-signature primitive.
Project description
MailKite mail-parse (Python)
Streaming, memory-efficient MIME email parser — the Python port of @mailkite/mail-parse.
Same parsed Message shape, and a failure-signature primitive whose hashes match the TypeScript package byte-for-byte.
Docs · Libraries · Node / TypeScript · mailkite.dev
·
Maintained in the MailKite monorepo; this is the public home for the Python port. The TypeScript package (
mail-parse) is the reference implementation.
Why
- Cross-language SSOT —
compute_signature()produces the same failure-signature hash as the TypeScript package for the same failure (conformance-tested against hashes captured from TS). - Same
Messageshape —parse()returns the same structured fields, so payloads are consistent across your stack. - Tolerant — malformed input never raises.
Install
pip install mailparse-mailkite
Quickstart
from mailparse import parse, compute_signature
msg = parse(raw_bytes)
msg.from_ # Address(address=..., name=...)
msg.subject
msg.text; msg.html
msg.attachments # [Attachment(filename, mimeType, content: bytes, size, ...)]
# Deterministic, PII-free fingerprint of a parse failure — identical hash to the TS package.
sig = compute_signature({"scope": "part", "diagnosticCodes": ["UNKNOWN_CHARSET"],
"contentType": "text/plain"})
sig["hash"]
Status
The failure-signature primitive is fully ported and cross-language conformance-tested. parse() is
built on the stdlib email package (the documented ContentManager precedent) — the buffered path.
Porting the streaming splitter + middleware registry to Python is in progress; the
TypeScript package is the reference.
Develop
python3 -m unittest discover -s tests
All MailKite libraries
| Library | Repo | Distribution |
|---|---|---|
| mail-parse (Node / TypeScript) | mail-parse |
npm |
| mail-parse (Python) (this repo) | mail-parse-py |
PyPI |
| MailKite for Python | mailkite-python |
PyPI |
| MailKite for Node.js | mailkite-node |
npm |
Full list: https://mailkite.dev/docs/libraries.
Docs & links
- 📚 Documentation: https://mailkite.dev/docs
- 🟦 TypeScript reference: https://github.com/mailkite/mail-parse
- 🌐 Website: https://mailkite.dev
MIT licensed. © MailKite.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mailparse_mailkite-0.1.0.tar.gz.
File metadata
- Download URL: mailparse_mailkite-0.1.0.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ad25ef56fa8a04b8ea6d046b1eaf27036cfc955269aa5613f0f88738e3793b8
|
|
| MD5 |
fbf331f366b3ea78b12a8d206ca672d9
|
|
| BLAKE2b-256 |
81c80fff8206953ff2f39882d739300838af1100d40e09fa0edfb106a9a73ab9
|
File details
Details for the file mailparse_mailkite-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mailparse_mailkite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76f0972b86cf9a554c7cdec57093d0faf87ad9741ed642fb23c99b396ee21944
|
|
| MD5 |
f988892d93c1dc463ab793ed94d02ca0
|
|
| BLAKE2b-256 |
f3f101b9d34fd0bcea1c42c5775c279753dbae2b37a7299b9f6428e588fd79ee
|