skillfed

priority

A pure-Python implementation of the HTTP/2 priority tree

priority v2.0.0 7.4M downloads/30d#1,742 on PyPI29
Permissive license MIT License AGING released

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 priority

uv

uv add priority

poetry

poetry add priority

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

HTTP/2 priority treestream schedulingRFC 7540 priorityHTTP/2 resource allocationpriority queue implementationstream weightingHTTP/2 flow control
http2stream-scheduling

More WWW/HTTP packages