Skip to content

Roadmap 2.1.0 — make typing the product #105

Description

@EONRaider

Tier 3 of the post-1.3.0 roadmap. Target version: 2.1.0 (minor).

Typing is the niche nobody else occupies. A good deal of claiming it is
a writing problem, not a code problem.

# Item
#93 Document structural pattern matching — it already works
#94 Curate __match_args__ for the wide headers
#95 Enum accessors alongside the int fields
#96 Turn the remaining display strings into typed values

Start with #93, which costs nothing

match/case dissection works on our headers today, with no code
changes, because frozen dataclasses auto-generate __match_args__ and
IntEnum subclasses int. It appears in no documentation anywhere.
This is the most distinctive thing about the library and it is
currently invisible.

The niche, concretely

No library on PyPI combines: zero dependencies, frozen-dataclass
headers, IntEnum field values, __match_args__-driven match/case
dissection, and py.typed with real (non-Any) field types under
mypy --strict. The single neighbour is PyTCP-net_proto — GPL-3.0,
Python ≥3.14, Alpha, one dependency, carved out of a TCP/IP stack.

For contrast, under mypy --strict: scapy accepts
p.ThisFieldDoesNotExist with no error (every field is Any via
__getattr__), and dpkt cannot be analysed at all (no py.typed).
We catch ip.proto and suggest protocol.

One deliberate non-goal

Do not retype the wire fields as enums. ethertype: EtherType is
the obvious move and the wrong one — an IntEnum field cannot hold an
unrecognized value, and round-trip fidelity for unknown protocol
numbers is worth more than the annotation. #95 adds accessors instead,
mirroring the src_address pattern 1.3.0 already established.

#94 depends on #93. #95 and #96 are independent; #96 is really four
separate pieces of work and should be split into separate PRs.

Part of the post-1.3.0 roadmap: #107

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestroadmapPost-1.0 roadmap

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions