{"id":19272384,"url":"https://github.com/pskopnik/apq","last_synced_at":"2026-03-12T11:36:46.674Z","repository":{"id":52697538,"uuid":"237626912","full_name":"pskopnik/apq","owner":"pskopnik","description":"Fast addressable priority queues for Python implementing advanced operations","archived":false,"fork":false,"pushed_at":"2021-04-20T19:28:42.000Z","size":117,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-13T21:46:45.768Z","etag":null,"topics":["cython","data-structures-and-algorithms","data-structures-python","priority-queue","priority-queues","priorityqueue","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pskopnik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-01T14:31:05.000Z","updated_at":"2021-08-21T07:01:31.000Z","dependencies_parsed_at":"2022-08-21T17:50:10.032Z","dependency_job_id":null,"html_url":"https://github.com/pskopnik/apq","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pskopnik%2Fapq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pskopnik%2Fapq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pskopnik%2Fapq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pskopnik%2Fapq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pskopnik","download_url":"https://codeload.github.com/pskopnik/apq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223881340,"owners_count":17219265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cython","data-structures-and-algorithms","data-structures-python","priority-queue","priority-queues","priorityqueue","python"],"created_at":"2024-11-09T20:36:32.069Z","updated_at":"2026-03-12T11:36:38.758Z","avatar_url":"https://github.com/pskopnik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# apq\n\n[![PyPI](https://img.shields.io/pypi/v/apq)][pypi-apq]\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/apq)][pypi-apq]\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/apq)][pypi-apq]\n[![PyPI - License](https://img.shields.io/pypi/l/apq)](https://github.com/pskopnik/apq/blob/master/LICENSE)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/pskopnik/apq/Test/master)](https://github.com/pskopnik/apq/actions?query=workflow%3ATest)\n\n`apq` implements different variants of addressable priority queue data\nstructures importable from Python 3 projects.\n\nThe project aims to provide run-time efficient implementations of priority\nqueues whilst remaining practical in use and maintaining a legible code base.\n\n * All priority queues provided by `apq` are backed by a C++ binary heap\n   implementation. The priority queue types exposed to Python are implemented\n   in Cython.\n\n * `apq` has no installation or runtime dependencies on all common platforms.\n   **Note:** A compiler and basic C++ headers are required on platforms for\n   which no binary distribution of `apq` is available.\n\n * Type stubs are installed along with the package so that mypy can fully\n   check dependent code.\n\n[pypi-apq]: https://pypi.org/project/apq/\n\n## Priority Queue Types\n\nThese priority queues use 64 bit floating point as priority values (`value`)\nand FIFO semantic for entries with the same `value`. **Note:** 64 bit floats\ncan represent 54 bit signed integers.\n\n * `AddressablePQ` - **Not implemented.** This priority queue exposes\n   persistent references in the form of `Item` its entries. Through `Item`,\n   the `value` of entries can be changed and arbitrary entries can be removed\n   from the PQ.\n\n * `KeyedPQ` - This priority queue allows lookup of entries through a string\n   key. That means it combines an addressable priority queue with a\n   dictionary, creating a `str` to item mapping (**almost** implementing\n   `typing.Mapping[str, KeyedItem]`). `KeyedPQ` is recommended whenever\n   individual entries are looked up using a key.\n\n * `SimplePQ` - **Not implemented.** This priority queue is a non-addressable\n   variant of AddressablePQ. `SimplePQ` is recommended when a fast PQ is\n   required which is only modified via `add()` and `pop()`.\n\n## Quickstart\n\nInstallation:\n\n```shell\n$ pip install apq\n```\n\nUsage:\n\n```python\n\u003e\u003e\u003e from apq import KeyedPQ\n\u003e\u003e\u003e pq: KeyedPQ[None] = KeyedPQ()\n\u003e\u003e\u003e pq.add('my_first_key', 34.0, None)\n\u003capq.Item object at 0x7f506884bd70\u003e\n\u003e\u003e\u003e pq.add('my_second_key', 36.0, None)\n\u003capq.Item object at 0x7f506884bcb0\u003e\n\u003e\u003e\u003e pq.change_value('my_second_key', 12.0)\n\u003capq.Item object at 0x7f50663604f0\u003e\n\u003e\u003e\u003e print(pq.pop())\n('my_second_key', 12.0, None)\n```\n\n## Releases and Compatibility\n\n`apq` uses [semantic versioning][semver] to derive the version identifier of\nreleases. Code using the documented public API of `apq` will continue to work\nwith all future releases of `apq` which are API compatible. API compatibility\nis indicated through the major component of the version identifier.\n\n`apq` is currently under active development / in beta. Breaking changes of the\npublic interface will occur. Beta releases are indicated through a `0` in the\nmajor component of the version identifier, e.g. `0.10.0`.\n\nTo encourage use during beta, `apq` extends semantic versioning to beta\nreleases as follows: From `0.10.0` onwards, API compatibility is guaranteed\nfor all future releases with the same `MINOR // 10` value. E.g. `0.17.3` is\nAPI compatible with `0.10.1`.\n\nDepending packages should use this semantic for specifying version\nconstraints, e.g. `apq \u003e= 0.11.1, \u003c 0.20.0` (c.f. [PEP 508][pep-508]). Pinning\nis still recommended for applications, e.g. using [Poetry][poetry] or\n[Pipenv][pipenv].\n\n`apq` aims to fully work on all active versions of Python. **Python 3.5 is not\nsupported at the moment.** Information on the state of Python releases is\ndescribed in the [Python Developer's Guide][python-devguide] with further\ndetails on the [Development Cycle][python-devguide-devcycle] page.\n\n[semver]: https://semver.org/\n[pep-508]: https://www.python.org/dev/peps/pep-0508/\n[poetry]: https://python-poetry.org/\n[pipenv]: https://pipenv.readthedocs.io/en/latest/\n[python-devguide]: https://devguide.python.org/\n[python-devguide-devcycle]: https://devguide.python.org/devcycle/\n\n## Distribution\n\n`apq` is distributed through [PyPi][pypi]. The [PyPi `apq` Project][pypi-apq]\ncontains a source distribution for each release. Additionally, pre-built\nbinary distribution in the form of wheels are available for common platforms.\n`pip install apq` will automatically detect the most appropriate distribution.\n\nTODO: Table of machine platform and OS, Python implementation and version for\nwhich wheels are built.\n\n[pypi]: https://pypi.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpskopnik%2Fapq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpskopnik%2Fapq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpskopnik%2Fapq/lists"}