HeapDict
a heap with decrease-key and increase-key operations
What it is and what it does
HeapDict implements a priority queue as a mutable mapping—it behaves like a Python dict but maintains heap ordering. You assign priorities to keys and retrieve the lowest-priority item with popitem(), or peek at it without removal using peekitem(). Unlike the standard library's heapq, HeapDict lets you efficiently update an existing key's priority, which is essential for graph algorithms like Dijkstra's shortest path and A* search.
The package has no runtime dependencies and installs cleanly as a pure Python wheel. It is marked abandoned, with the last release in 2019-09-09 and no active repository maintenance, so it receives no updates or bug fixes. The BSD license is permissive and poses no restrictions for most use cases.
Use it for:
- Implementing Dijkstra's shortest-path algorithm where you need to update node priorities as better paths are discovered.
- Building an A* pathfinding search where heuristic estimates require efficient priority adjustment during exploration.
- Any graph or optimization algorithm that maintains a working set of candidates with changing priority scores.
- Prototyping or teaching priority queue concepts when you need dict-like access with heap semantics.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
HeapDict is a mutable mapping that acts as a priority queue, supporting efficient priority updates on existing keys—a capability the standard library's heapq module lacks.
Yes, if you need a priority queue with efficient decrease-key operations and can accept that the package is no longer maintained. It has no dependencies, installs easily, carries no known vulnerabilities, and solves a real problem the standard library doesn't address. However, verify it works on your target Python version and consider whether an actively maintained alternative better suits your long-term needs.
Install
heapdict on PyPI
pip
pip install heapdictuv
uv add heapdictpoetry
poetry add heapdictInstalling HeapDict
Before you install
Installation is straightforward with no runtime dependencies. The package is marked abandoned (last release 2019-09-09, 2531 days ago), so expect no active maintenance or bug fixes.
License in practice
Licensed under BSD (permissive), so you may use, modify, and distribute it freely in both open and closed projects with minimal restrictions.
Quickstart
from heapdict import heapdict
hd = heapdict()
hd['obj1'] = 1
hd['obj2'] = 2
key, priority = hd.popitem()
Verify before relying
- Whether the package works reliably on modern Python versions beyond those listed in classifiers.
- Performance characteristics compared to alternative priority queue implementations for large datasets.
- Whether any edge cases or bugs have been discovered since the final 2019-09-09 release.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,531 days since the last release |
| First released | |
| Downloads | 412,649/month — #6,846 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: HeapDict-1.0.1-py3-none-any.whl
Keywords: heap, decrease-key, increase-key, dictionary, Dijkstra, A*, priority, queue
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
queuelibQueuelib provides in-memory and disk-persisted…
permissive · top 5,000 on PyPI
zictProvides mutable mapping tools and data…
permissive · top 5,000 on PyPI
persist-queueProvides thread-safe, disk-based queue…
permissive · top 15,000 on PyPI
recordclassRecordclass provides memory-efficient, mutable…
permissive · top 15,000 on PyPI
multisetProvides a mutable and immutable multiset data…
permissive · top 15,000 on PyPI
DijkstarDijkstar implements Dijkstra's shortest-path…
permissive · top 15,000 on PyPI
guppy3Guppy 3 analyzes Python heap memory to identify…
permissive · top 5,000 on PyPI
priorityImplements HTTP/2 stream priority scheduling…
permissive · top 5,000 on PyPI
rqRQ is a Python library for queueing jobs and…
permissive · top 5,000 on PyPI
constantdictProvides an immutable dictionary class that…
permissive · top 15,000 on PyPI