Type compatibility with `h11._headers.Header`
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python
- Domain
- networking
Research direction
Start in src/wsproto/typing.py and inspect how the Headers alias is defined. Compare it with h11._headers.Headers from version 0.13.0, then verify that the reported mypy error is resolved and that existing checks still pass. Done means wsproto.Header is type-compatible with h11 headers.
Written by the indexing model from the issue text.
Description
At the moment, the wsproto.typing.Header type is not compatible with h11._headers.Header which is defined as the following, starting with version 0.13.0:
class Headers(Sequence[Tuple[bytes, bytes]]):
[...]
The following patch might provide this compatibility:
diff --git a/src/wsproto/typing.py b/src/wsproto/typing.py
index a44b27e..1786501 100644
--- a/src/wsproto/typing.py
+++ b/src/wsproto/typing.py
@@ -1,3 +1,3 @@
-from typing import List, Tuple
+from typing import Sequence, Tuple
-Headers = List[Tuple[bytes, bytes]]
+Headers = Sequence[Tuple[bytes, bytes]]
This would fix mypy errors such as:
error: Argument "headers" to "initiate_upgrade_connection" of "WSConnection" has incompatible type "Headers"; expected "List[Tuple[bytes, bytes]]" [arg-type]
Would that make sense? I can make a PR if necessary.
- Dominant language
- Python
- Stars
- 303
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-hyper/wsproto
-
Compression Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
python-hyper/wsproto#199 · 5 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
python-hyper/wsproto#182 ·
All issues in python-hyper/wsproto
Similar issues
-
from:qa priority:P2 reliability tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
spec-kitty/spec-kitty#4874 ·
-
fix: inaccuracy ⚠️
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
uabrc/uabrc.github.io#1255 · 1 comment ·
-
kind:bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ethereum-optimism/factory#64 ·