[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1005875: ITP: python-headerparser -- Python module to parse key-value pairs in the style of RFC 822 headers



Package: wnpp
Severity: wishlist
Owner: Stephan Lachnit <stephanlachnit@debian.org>
X-Debbugs-Cc: debian-devel@lists.debian.org, stephanlachnit@debian.org

* Package name    : python-headerparser
  Version         : 0.4.0
  Upstream Author : John T. Wodder II
* URL             : https://github.com/jwodder/headerparser
* License         : MIT
  Programming Lang: Python
  Description     : Python module to parse key-value pairs in the style of RFC
822 headers


I intend this maintain this in the Debian Python Team. I will use this library
for my ongoing work to convert SPDX documents to DEP5 documents [1]. The reason
I won't use python-debian is that it is apparently a bit buggy on non-Debian
systems.

Regards,
Stephan

[1] https://lists.debian.org/debian-devel/2022/02/msg00207.html


The long description from the readme:

headerparser parses key-value pairs in the style of RFC 822 (e-mail) headers
and converts them into case-insensitive dictionaries with the trailing message
body (if any) attached. Fields can be converted to other types, marked
required, or given default values using an API based on the standard library’s
argparse module. (Everyone loves argparse, right?) Low-level functions for just
scanning header fields (breaking them into sequences of key-value pairs without
any further processing) are also included.

RFC 822-style headers are header fields that follow the general format of
e-mail headers as specified by RFC 822 and friends: each field is a line of the
form “Name: Value”, with long values continued onto multiple lines (“folded”)
by indenting the extra lines. A blank line marks the end of the header section
and the beginning of the message body.

This basic grammar has been used by numerous textual formats besides e-mail,
including but not limited to:

    HTTP request & response headers
    Usenet messages
    most Python packaging metadata files
    Debian packaging control files
    META-INF/MANIFEST.MF files in Java JARs
    a subset of the YAML serialization format

- all of which this package can parse.

Reply to: