jh2
HTTP/2 State-Machine based protocol implementation
What it is and what it does
jh2 is a fork of the hyper/h2 HTTP/2 protocol stack that reimplements the state machine in pure Python with embedded dependencies for a cleaner dependency tree. It provides in-memory HTTP/2 frame handling—encoding headers and data into frames, managing connection state, and parsing incoming frames into events—but does not include network I/O, parsing layers, or concurrency primitives. You supply raw socket data and receive back frames to send and events to process.
The package is designed as a building block for HTTP/2 implementations. You create a connection object, call methods to queue headers and data, retrieve serialized frames via `data_to_send()`, and feed received bytes into `receive_data()` to get back protocol events. It works with any network transport or concurrency model you choose, making it suitable for embedding in async frameworks, synchronous servers, or custom HTTP clients.
Use it for:
- Build HTTP/2 client libraries by handling protocol state and frame serialization without implementing the spec from scratch.
- Implement HTTP/2 servers that need frame-level control independent of a specific async runtime or socket library.
- Add HTTP/2 support to existing network libraries by wrapping jh2's state machine around your own I/O layer.
- Test HTTP/2 protocol compliance by using jh2 to generate and validate frames without network overhead.
- Embed HTTP/2 in embedded systems or constrained environments where a pure-Python, dependency-free implementation is preferred.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
jh2 is a pure-Python HTTP/2 protocol state machine that handles frame encoding, decoding, and connection state management without network or concurrency layers.
Yes. jh2 is actively maintained, has no runtime dependencies, supports Python 3.7–3.14, carries no known vulnerabilities, and is licensed permissively under MIT. It is a solid choice if you need a low-friction, embeddable HTTP/2 state machine. Install it if you are building HTTP/2 support and want to avoid managing separate packages.
Install
jh2 on PyPI
pip
pip install jh2uv
uv add jh2poetry
poetry add jh2Installing jh2
Before you install
Low install friction with no runtime dependencies. Actively maintained with a release within the last 77 days and current Python version support. Repository is not archived.
License in practice
MIT license (permissive) means you can use, modify, and distribute jh2 with minimal restrictions; include the license text in distributions.
Quickstart
pip install jh2
import jh2.connection
import jh2.config
config = jh2.config.H2Configuration()
conn = jh2.connection.H2Connection(config=config)
conn.send_headers(stream_id=stream_id, headers=headers)
data_to_send = conn.data_to_send()
Verify before relying
- Performance comparison with h2 package and whether optimized build is available in this version
- Whether embedded leaf dependencies (hpack, hyperframe) are fully internal or partially exposed in the API
- Specific use-case performance characteristics versus the original h2 package
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 77 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,893,994/month — #3,456 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jh2-5.0.13-py3-none-any.whl
Keywords: http2, hpack, h2
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
h2h2 is a pure-Python HTTP/2 protocol…
permissive · top 1,000 on PyPI
hpackEncodes and decodes HTTP/2 headers using the…
permissive · top 1,000 on PyPI
hyperframehyperframe decodes binary HTTP/2 frame streams…
permissive · top 1,000 on PyPI
hyperhyper is an HTTP/2 client library for Python…
permissive · top 15,000 on PyPI
hyper-upHTTP/2 client library for Python that provides…
permissive · top 15,000 on PyPI
priorityImplements HTTP/2 stream priority scheduling…
permissive · top 5,000 on PyPI
httpcore2A minimal, low-level HTTP client library…
permissive · top 1,000 on PyPI
wsprotowsproto is a pure-Python WebSocket protocol…
permissive · top 1,000 on PyPI
httpx2HTTPX2 is a fully featured HTTP client library…
permissive · top 1,000 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI