Skip to main content

Fast addressable priority queues supporting advanced operations

Project description

apq

PyPI PyPI - Python Version PyPI - Wheel PyPI - License GitHub Workflow Status (branch)

apq implements different variants of addressable priority queue data structures importable from Python 3 projects.

The project aims to provide run-time efficient implementations of priority queues whilst remaining practical in use and maintaining a legible code base.

  • All priority queues provided by apq are backed by a C++ binary heap implementation. The priority queue types exposed to Python are implemented in Cython.

  • apq has no installation or runtime dependencies on all common platforms. Note: A compiler and basic C++ headers are required on platforms for which no binary distribution of apq is available.

  • Type stubs are installed along with the package so that mypy can fully check dependent code.

Priority Queue Types

These priority queues use 64 bit floating point as priority values (value) and FIFO semantic for entries with the same value. Note: 64 bit floats can represent 54 bit signed integers.

  • AddressablePQ - Not implemented. This priority queue exposes persistent references in the form of Item its entries. Through Item, the value of entries can be changed and arbitrary entries can be removed from the PQ.

  • KeyedPQ - This priority queue allows lookup of entries through a string key. That means it combines an addressable priority queue with a dictionary, creating a str to item mapping (almost implementing typing.Mapping[str, KeyedItem]). KeyedPQ is recommended whenever individual entries are looked up using a key.

  • SimplePQ - Not implemented. This priority queue is a non-addressable variant of AddressablePQ. SimplePQ is recommended when a fast PQ is required which is only modified via add() and pop().

Quickstart

Installation:

$ pip install apq

Usage:

>>> from apq import KeyedPQ
>>> pq: KeyedPQ[None] = KeyedPQ()
>>> pq.add('my_first_key', 34.0, None)
<apq.Item object at 0x7f506884bd70>
>>> pq.add('my_second_key', 36.0, None)
<apq.Item object at 0x7f506884bcb0>
>>> pq.change_value('my_second_key', 12.0)
<apq.Item object at 0x7f50663604f0>
>>> print(pq.pop())
('my_second_key', 12.0, None)

Releases and Compatibility

apq uses semantic versioning to derive the version identifier of releases. Code using the documented public API of apq will continue to work with all future releases of apq which are API compatible. API compatibility is indicated through the major component of the version identifier.

apq is currently under active development / in beta. Breaking changes of the public interface will occur. Beta releases are indicated through a 0 in the major component of the version identifier, e.g. 0.10.0.

To encourage use during beta, apq extends semantic versioning to beta releases as follows: From 0.10.0 onwards, API compatibility is guaranteed for all future releases with the same MINOR // 10 value. E.g. 0.17.3 is API compatible with 0.10.1.

Depending packages should use this semantic for specifying version constraints, e.g. apq >= 0.11.1, < 0.20.0 (c.f. PEP 508). Pinning is still recommended for applications, e.g. using Poetry or Pipenv.

apq aims to fully work on all active versions of Python. Python 3.5 is not supported at the moment. Information on the state of Python releases is described in the Python Developer's Guide with further details on the Development Cycle page.

Distribution

apq is distributed through PyPi. The PyPi apq Project contains a source distribution for each release. Additionally, pre-built binary distribution in the form of wheels are available for common platforms. pip install apq will automatically detect the most appropriate distribution.

TODO: Table of machine platform and OS, Python implementation and version for which wheels are built.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apq-0.10.0.tar.gz (91.8 kB view details)

Uploaded Source

Built Distributions

apq-0.10.0-cp38-cp38-manylinux2014_x86_64.whl (492.6 kB view details)

Uploaded CPython 3.8

apq-0.10.0-cp38-cp38-manylinux2014_i686.whl (622.9 kB view details)

Uploaded CPython 3.8

apq-0.10.0-cp38-cp38-manylinux2010_x86_64.whl (611.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

apq-0.10.0-cp38-cp38-manylinux2010_i686.whl (453.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

apq-0.10.0-cp37-cp37m-manylinux2014_x86_64.whl (480.2 kB view details)

Uploaded CPython 3.7m

apq-0.10.0-cp37-cp37m-manylinux2014_i686.whl (606.7 kB view details)

Uploaded CPython 3.7m

apq-0.10.0-cp37-cp37m-manylinux2010_x86_64.whl (596.0 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

apq-0.10.0-cp37-cp37m-manylinux2010_i686.whl (439.8 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

apq-0.10.0-cp36-cp36m-manylinux2014_x86_64.whl (480.6 kB view details)

Uploaded CPython 3.6m

apq-0.10.0-cp36-cp36m-manylinux2014_i686.whl (605.0 kB view details)

Uploaded CPython 3.6m

apq-0.10.0-cp36-cp36m-manylinux2010_x86_64.whl (596.4 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

apq-0.10.0-cp36-cp36m-manylinux2010_i686.whl (441.1 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

File details

Details for the file apq-0.10.0.tar.gz.

File metadata

  • Download URL: apq-0.10.0.tar.gz
  • Upload date:
  • Size: 91.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0.tar.gz
Algorithm Hash digest
SHA256 44399f32fbac3427b8a49984b96f9d75ff3f8c18b35d28ca5fac7d12bd9996d4
MD5 befd87dd617aa05dba22094ed62b1dde
BLAKE2b-256 ff798ab087d893da7581bddd55ddc7fcf5366a6dec8888953287b7cc1b4ebe00

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: apq-0.10.0-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 492.6 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a46a44f954de23b708cd56fbea3ee8b78890a40d3d35cb659cf977f623a78514
MD5 c2db9358ea272ea92946702990d6df3c
BLAKE2b-256 f22f997edd9ff81f9166c355fe4e97e290fc98969c0990dbe9344b84b8d38a99

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp38-cp38-manylinux2014_i686.whl.

File metadata

  • Download URL: apq-0.10.0-cp38-cp38-manylinux2014_i686.whl
  • Upload date:
  • Size: 622.9 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.7

File hashes

Hashes for apq-0.10.0-cp38-cp38-manylinux2014_i686.whl
Algorithm Hash digest
SHA256 2ddf08be305dbd96f4b79da795773776b3fc7e2646bdfa3667798c1529443cf2
MD5 592fac34d124b343a5d53e92a557d547
BLAKE2b-256 912fbeb7bb1dde6216f1719d945d7c823b4266199d3e81db507bd49e0d855e7c

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: apq-0.10.0-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 611.6 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e291df4f0881a4930e1da82bc218d55a3f6992f48df8e4eb4b25de489b537e0e
MD5 3e1eae357cfd3ef502bebaefa28bd185
BLAKE2b-256 04940f89abb071198145e5449bd827e83834500bc3bb0e02b9e525f85931a573

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp38-cp38-manylinux2010_i686.whl.

File metadata

  • Download URL: apq-0.10.0-cp38-cp38-manylinux2010_i686.whl
  • Upload date:
  • Size: 453.6 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp38-cp38-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 fc39d9b4d67c6b3812a3fef5fe00e97510fedd02b5a424a1c5db8c8bde2900a8
MD5 e1f61509fcdb96966a8313f71920a35e
BLAKE2b-256 bf28089e53ebe8871723ff7b634c6ac95532847b3722625bb44366f26beb5d45

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: apq-0.10.0-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 480.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3cb3d9e8ca0d683b345fe87037d9c1d43e4fffc5604ef7f208b732250be92eae
MD5 1983e7c85f8048cb2fdf93bb8a186bcf
BLAKE2b-256 17ab037d3953cade27511c9ad8cb02ba303942980036685a6c3d17e12b8fd282

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp37-cp37m-manylinux2014_i686.whl.

File metadata

  • Download URL: apq-0.10.0-cp37-cp37m-manylinux2014_i686.whl
  • Upload date:
  • Size: 606.7 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.7

File hashes

Hashes for apq-0.10.0-cp37-cp37m-manylinux2014_i686.whl
Algorithm Hash digest
SHA256 189d0b281418a92200e3cf815a14516f122c168b445ae67d610b52680a44f82d
MD5 aa38782d0280842d9151640ce5c23b90
BLAKE2b-256 15e1ffcd7885781cd0922336b6404c9ab57fe8272ac66481cf3b2902196fd352

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: apq-0.10.0-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 596.0 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 089e1080c8d3b525e321e1ad348a755dbcb2e09b9ff682b06177b3444f53fa96
MD5 f273b156b3841ec43fdb4540f93c95cf
BLAKE2b-256 324a2b9d6b094abc5e220fb04bf3d583ec919780a7440c99ea7d7f02e29f1bb4

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp37-cp37m-manylinux2010_i686.whl.

File metadata

  • Download URL: apq-0.10.0-cp37-cp37m-manylinux2010_i686.whl
  • Upload date:
  • Size: 439.8 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp37-cp37m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 a78f26ba6e2a104115bc397012101187fbd1c612d7fefdc643c0a75601740f07
MD5 06108e6fcc3e485855ae526cf01ad6d8
BLAKE2b-256 e794a23da0d3f4ca330b2eaaae7aba0b2c5c3314cb843fabfc2253a5c7a35299

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: apq-0.10.0-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 480.6 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1a1b4cd7cd60364d64f880fc39fd564edd694dc3a0ee64b429c3c4242257668
MD5 e03692710ca579ce2a0e2e449dd8942b
BLAKE2b-256 8a7123a501baa6d88833c2d0bf95e860664d8eb9633b65a95ae42c3c0f64ea1d

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp36-cp36m-manylinux2014_i686.whl.

File metadata

  • Download URL: apq-0.10.0-cp36-cp36m-manylinux2014_i686.whl
  • Upload date:
  • Size: 605.0 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.7

File hashes

Hashes for apq-0.10.0-cp36-cp36m-manylinux2014_i686.whl
Algorithm Hash digest
SHA256 2294a6c3971f3ddf0b7da63b35843adcd7c30f75f7df21905953df937f069c3a
MD5 7d2892d29fc3baa9c3300c954dade265
BLAKE2b-256 3fd43345a32334aed9ab9b84263b1c03ff23c625d91603d5cbb4cf7e436b36bf

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: apq-0.10.0-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 596.4 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 69ce772c107cea9c69a5ebf69213d93f7f374e1ae2343cdb74aff0caf41b1678
MD5 1a57355686086f36e675a5baf60555d3
BLAKE2b-256 284e5d18dc16b0e1d7e4f995f5025331f102b8bfbbfa28e781548e89783f8649

See more details on using hashes here.

File details

Details for the file apq-0.10.0-cp36-cp36m-manylinux2010_i686.whl.

File metadata

  • Download URL: apq-0.10.0-cp36-cp36m-manylinux2010_i686.whl
  • Upload date:
  • Size: 441.1 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for apq-0.10.0-cp36-cp36m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 58da2a3509e4a01667c2849a0495fd85d8c36800aabe8740c52827cfacfc8c82
MD5 b6fe8659431118cd7a198c0ae5e2b633
BLAKE2b-256 ebac416e28b401c72cd2f373b99f18e07a04ff3445bc115a75b4401b7130d2fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page