--- id: jh2 version: "5.0.13" license: MIT license_treatment: permissive maintenance: active --- # jh2 — HTTP/2 State-Machine based protocol implementation License: permissive · Maintenance: active · Downloads: 1.9M/mo ## 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 above — 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 pip install jh2 uv add jh2 poetry add jh2 ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 1.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags http/2 protocol implementation, http2 state machine, pure python http2, h2 protocol stack, http2 frame handling, hpack encoding decoding, http2 connection management, http2, protocol-implementation, state-machine [View on SkillFed](https://skillfed.io/packages/jh2) · [View on PyPI](https://pypi.org/project/jh2/)