--- id: abnf version: "2.7.0" license: unclear license_treatment: permissive maintenance: active --- # abnf — Parsers for ABNF grammars. License: permissive · Maintenance: active · Downloads: 1.1M/mo ## What it is and what it does abnf is a parser generator that turns ABNF grammar specifications into working parsers. It implements RFC 5234 and RFC 7405, the standards for ABNF syntax itself, and ships with ready-to-use grammar modules for 30+ common RFCs covering HTTP headers, email addresses, URIs, and similar structured text formats. The package has been in production use since its original deployment for HTTP header parsing in a web framework. You use it by either loading one of the bundled RFC grammar modules and calling parse or parse_all on input strings, or by compiling your own ABNF rule inline using Rule.create(). The library works with code points (strings), not raw bytes; to parse wire data, you decode it with latin-1 first to preserve the byte-to-code-point mapping. An optional Rust backend is available for substantially faster parsing when needed. Use it for: - Parse and validate HTTP headers (ETag, Content-Type, etc.) using the bundled RFC 7232, RFC 7230 grammars. - Validate email addresses and other RFC 5322 message format data against standard ABNF rules. - Extract structured data from URIs, hostnames, or other RFC-defined formats using built-in grammar modules. - Compile and parse custom ABNF grammars for proprietary or domain-specific text formats. - Validate wire protocol data by decoding bytes as latin-1 and parsing against RFC-based ABNF rules. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates parsers from ABNF grammars as specified in RFC 5234 and RFC 7405, with 30+ built-in grammar modules for common RFCs like HTTP headers, email addresses, and URIs. Yes. The package is actively maintained, has no known vulnerabilities, zero runtime dependencies, and low install friction. It solves a real problem—parsing RFC-defined text formats—with production-proven code and comprehensive built-in grammar coverage. The MIT license is permissive. Install it if you need to parse or validate structured text defined by RFCs or custom ABNF grammars. ## Install pip install abnf uv add abnf poetry add abnf ## Installing abnf Before you install: Minimal friction: pure Python wheel, no runtime dependencies, tested on Python 3.10–3.14. Active maintenance with a release 2 days ago; last commit 2026-08-14. License in practice: MIT license (permissive); you can use, modify, and distribute this package freely with minimal restrictions. Quickstart: pip install abnf from abnf.grammars import rfc7232 node, offset = rfc7232.Rule("ETag").parse('W/"moof"', 0) print(node.value) # 'W/"moof"' Requires Python 3.10 or later. To parse wire data (bytes), decode with latin-1 first before passing to parse methods. Verify before relying: - Performance characteristics of the optional Rust backend relative to the pure Python implementation. - Whether the 30+ bundled grammar modules cover all common RFC use cases or if custom grammar compilation is often needed. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags ABNF parser generator, RFC grammar parser, HTTP header parsing, email address validation, URI parsing library, ABNF rule compiler, RFC 5234 parser, parser-generator, rfc-compliance, grammar-engine [View on SkillFed](https://skillfed.io/packages/abnf) · [View on PyPI](https://pypi.org/project/abnf/)