skillfed

jh2

HTTP/2 State-Machine based protocol implementation

jh2 v5.0.13 1.9M downloads/30d#3,456 on PyPI3
Permissive license MIT Active released

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 jh2

uv

uv add jh2

poetry

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 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries

Tags

http/2 protocol implementationhttp2 state machinepure python http2h2 protocol stackhttp2 frame handlinghpack encoding decodinghttp2 connection management
http2protocol-implementationstate-machine

More Libraries packages