priority
A pure-Python implementation of the HTTP/2 priority tree
What it is and what it does
Priority is a pure-Python implementation of the HTTP/2 stream priority algorithm specified in RFC 7540 Section 5.3. It provides a priority tree data structure that servers can use to fairly schedule resource allocation across multiple concurrent HTTP/2 streams, respecting client-expressed preferences for stream weights and dependencies. The implementation is based on the H2O project's approach and is used by nghttp2.
The package exposes a simple API: insert streams into the tree with optional weights and dependencies, iterate over the tree to determine which stream should send data next, and call block/unblock/reprioritize methods to update the tree as stream states change. This allows servers to automatically emit stream data in conformance with RFC 7540 without manual priority logic.
Use it for:
- HTTP/2 server implementations that need to schedule multiple concurrent streams fairly according to client priority hints.
- Proxies or load balancers that must respect HTTP/2 stream priorities when forwarding requests.
- Testing or validating HTTP/2 priority behavior in protocol implementations.
- Applications that need to simulate or understand HTTP/2 priority scheduling mechanics.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Implements HTTP/2 stream priority scheduling according to RFC 7540, allowing servers to allocate resources fairly across multiple concurrent streams based on client-expressed preferences.
Yes, if you are building or maintaining an HTTP/2 server or proxy that needs RFC 7540-compliant priority scheduling. The package has no dependencies, low install friction, and a permissive license. However, note that the last release was 2021-06-27 with no updates since; if you need active maintenance or support for very recent Python versions, verify compatibility first or consider whether the aging status affects your use case.
Install
priority on PyPI
pip
pip install priorityuv
uv add prioritypoetry
poetry add priorityInstalling priority
Before you install
Low install friction with no runtime dependencies. Maintenance is aging—last release was 2021-06-27 and the repository has not been updated since then, though it remains unarchived and the package is marked Production/Stable.
License in practice
MIT License permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
from priority import PriorityTree
p = PriorityTree()
p.insert_stream(stream_id=1)
p.insert_stream(stream_id=3, depends_on=1)
for stream_id in p:
# send_data(stream_id)
Requires Python 3.6.1 or later; supports CPython and PyPy.
Verify before relying
- Whether the package remains compatible with Python versions released after 2021 without explicit testing.
- Current real-world usage patterns and whether the aging maintenance status affects adoption in modern HTTP/2 stacks.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.6.1) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 1,874 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,420,516/month — #1,742 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: priority-2.0.0-py3-none-any.whl
Tags
More WWW/HTTP 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
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
h2h2 is a pure-Python HTTP/2 protocol…
permissive · top 1,000 on PyPI
hyperframehyperframe decodes binary HTTP/2 frame streams…
permissive · top 1,000 on PyPI
hpackEncodes and decodes HTTP/2 headers using the…
permissive · top 1,000 on PyPI
jh2jh2 is a pure-Python HTTP/2 protocol state…
permissive · top 5,000 on PyPI
filigran-sseclientProvides a Python iterator interface for…
permissive · top 5,000 on PyPI
taskiq-aio-pikaProvides a RabbitMQ broker implementation for…
permissive · top 15,000 on PyPI
sentence-streamSplits text streams into sentences even when…
permissive · top 15,000 on PyPI
jsonseqEncodes and decodes JSON text sequences…
permissive · top 15,000 on PyPI
pydocketDocket is a distributed background task system…
permissive · top 5,000 on PyPI
queuelibQueuelib provides in-memory and disk-persisted…
permissive · top 5,000 on PyPI