Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lonnen/heapq-container
a Container datatype wrapper for the Python standard library heapq module
https://github.com/lonnen/heapq-container
Last synced: 5 days ago
JSON representation
a Container datatype wrapper for the Python standard library heapq module
- Host: GitHub
- URL: https://github.com/lonnen/heapq-container
- Owner: lonnen
- License: apache-2.0
- Created: 2024-06-14T21:59:22.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-16T03:38:23.000Z (8 months ago)
- Last Synced: 2024-12-21T06:34:18.117Z (2 months ago)
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# heapq-container
[](https://pypi.org/project/heapq-container/)
[](https://github.com/lonnen/heapq-container/actions/workflows/test.yml)
[](https://github.com/lonnen/heapq-container/releases)
[](https://github.com/lonnen/heapq-container/blob/main/LICENSE)a Container datatype wrapper for the Python standard library heapq module.
## Installation
Install this library using `pip`:
```bash
pip install heapq-container
```
## Usage```python
from heapqueue import HeapQueue
def heapsort(iterable):
h = HeapQueue(iterable)
return [h.pop() for _ in range(len(h))]heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])
# -> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
```## Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
```bash
cd heapq-container
python -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
pytest
```