Release Notes

1.5.1 (2026-05-25)

  • Type annotations:
    • Fixed pqdict.fromkeys() being inferred as pqdict[Any, Any] under pyright and ty. The classmethod now uses method-local typevars in @overload stubs so types are solved from the call arguments.

    • Tightened pqdict.heapify(key) from key: Any to key: KT via overloads.

1.5.0 (2026-05-25)

  • Type annotations:
    • Restored generic type parameters: pqdict is now pqdict[KT, VT] (subclassing MutableMapping[KT, VT]). Keys and values type-check correctly (e.g. when iterating items()) and are inferred from constructor input. (#38)

    • An unparameterized pqdict is treated as pqdict[Any, Any] via PEP 696 type-variable defaults, so it still needs no annotation.

    • Added type overloads so return types are inferred precisely: pop() yields a key while pop(key) yields a value; the peek/pop helpers (top, topvalue, topitem, popvalue, popitem) reflect a supplied default in their return type; and the minpq/maxpq constructors recover their key/value types from the arguments.

  • Maintenance:
    • Dropped support for Python 3.7 and 3.8 (the minimum is now 3.9).

    • Removed the importlib-metadata dependency; pqdict now has no runtime dependencies.

    • Import Self and TypeVar from typing_extensions under TYPE_CHECKING only, keeping them out of the runtime import path.

  • Development:
    • Migrated development, test, and docs dependencies to PEP 735 dependency groups.

    • CI and the Read the Docs build now use uv; the library and test suite are type-checked with mypy, pyright, and ty.

    • Added type checking to CI.

    • Added a test_typing.py regression suite (using assert_type) that passes under mypy, pyright, and ty.

1.4.1 (2025-09-07)

This release does not change any runtime behavior but updates type annotations and the build backend.

  • Maintenance:
    • Modernized type annotations

    • Switch to hatchling build system

    • importlib.metadata for version retrieval

    • Add timing script for benchmarking

  • Development:
    • napoleon for numpydoc rendering

    • uv for project management

Full Changelog: https://github.com/nvictus/pqdict/compare/v1.4.0…v1.4.1

1.4.0 (2024-02-14)

  • API changes:
    • The deprecated module-level minpq and maxpq have been removed in favor of same-named classmethods introduced in v1.3.0 (#24)

    • Introduce a distinct Empty exception for operations that attempt to remove items from an empty pqdict, instead of raising a KeyError. (Note that Empty is derived from KeyError for subclass compatibility with Mapping.popitem and Mapping.clear.) (#24)

    • Make internal heap nodes immutable and fast copy as originally proposed by @palkeo in #14

  • Maintenance:
    • Factored out indexed heap operations to reduce redundancy

    • Better docstrings and type annotations

Full Changelog: https://github.com/nvictus/pqdict/compare/v1.3.0…v1.4.0

1.3.0 (2023-07-01)

This minor release drops support for Python versions <3.7. In turn, we now provide full static type annotations and have migrated to modern package build tools.

  • API changes:
    • Added popvalue method to mirror recent topvalue addition.

    • Added default argument to top and support for default using pop with PQ semantics. If given, this value is returned when the collection is empty.

    • minpq and maxpq module-level functions are deprecated in favor of pqdict classmethods and will be removed in v1.4.

  • Maintenance:
    • Dropped support for Python 2.7, 3.4, 3.5, and 3.6 (#22).

    • Inlined type annotations and removed stub file. Thanks for advice from @aqeelat.

    • Migrate to pyproject.toml.

    • Linting and static type checking in CI.

1.2.1 (2023-06-26)

  • Typing:
    • Provided typing support (#19) applying stub generated by @noamraph

  • Maintenance:
    • Replaced CI badge.

    • Dropped Python 2.7 from CI, no longer supported there. Next minor release of pqdict will no longer support Python 2.

1.2.0 (2022-10-14)

  • API changes:
    • Added topvalue method (#17). By @ShivKJ

  • Maintenance:
    • Replaced Travis CI with Github Actions.

1.1.1 (2020-09-21)

  • Maintenance:
    • Performance of copy improved by avoiding re-heapifying (#12). By @palkeo.

    • Removed redundant heapify call in constructor.

    • Removed unused node_factory kwargs.

    • Formatting with black.

1.1.0 (2020-08-21)

  • API changes:
    • nlargest and nsmallest now support an optional key parameter (#10). By Eugene Prilepin.

1.0.1 (2020-07-12)

  • Maintenance:
    • Dropped 3.3 support.

    • Future-proofed for upcoming collections import breakage (#6). By R. Bernstein.

    • Upgraded test suite from nose to pytest (#7). By R. Bernstein.

1.0.0 (2015-09-02)

  • Stable release.

  • Supporting 2.7+, 3.3+ and pypy. Dropped 3.2 support.

0.6 (2015-08-31)

  • Conceptual changes:
    • Clearer terminology in API and documentation (e.g., value vs. priority key).

    • Functional philosophy: pqdict accepts optional priority key function and precedence function.

  • API changes:
    • PQDict name is deprecated.

    • Several backwards-incompatible changes to fit the new conceptual model.

    • Heapsort iterators (iterkeys, itervalues, iteritems) were renamed (popkeys, popvalues, popitems). In Python 2, the old names persist as regular iterators.

    • Dropped module functions except for nlargest and nsmallest.

  • Docs:
    • Revised and updated

    • Switch to RTD theme

0.5 (2014-02-09)

  • API changes:
    • PQDict.pq_type property: ‘min’, ‘max’ or ‘custom’

    • fromkeys keyword ‘sort_by’ is replaced with ‘rank_by’

  • Bug fixes:
    • turns out PQDict.create and sort_by_value were broken! (oops!)

    • consume: the collector was comparing the wrong pkeys

  • Improved test coverage:
    • improved coverage of unit tests

    • using travis-ci

0.4 (2013-12-08)

  • API changes:
    • renamed peek() to top()

    • semantics of top, pop, vs. topitem, popitem, *item, now hopefully more consistent

    • prioritykeys() and iterprioritykeys() are aliases for values() and itervalues()

    • new methods: pushpopitem, swap_priority, replace_key

  • New functions:
    • nsmallest, nlargest

    • consume

  • Added Sphinx documentation

0.3 (2013-07-23)

  • Bug fixes:
    • off-by one error caused the queue to not reheapify properly in a special case

0.2 (2013-07-18)

  • Bug fixes:
    • Fixed error in __all__ list

0.1 (2013-07-17)

  • First release.