Compare commits
No commits in common. "926587450e2e44f79073a0c4f44ac51023d46241" and "70295da0ba0a5b6ab347d3fef7d3dfa956510694" have entirely different histories.
926587450e
...
70295da0ba
2 changed files with 2 additions and 54 deletions
55
README.md
55
README.md
|
@ -6,57 +6,4 @@ Implementations of priority queues in Python using Rust bindings for speed.
|
||||||
|
|
||||||
I'm doing this to learn Rust, so don't judge me too hard lol.
|
I'm doing this to learn Rust, so don't judge me too hard lol.
|
||||||
I've noted a few places where I'm unhappy with the implementation (mostly w.r.t. code duplication), but hopefully as I become more comfortable in Rust I can go back and fix those.
|
I've noted a few places where I'm unhappy with the implementation (mostly w.r.t. code duplication), but hopefully as I become more comfortable in Rust I can go back and fix those.
|
||||||
|
Better to have a bad implementation now than a good implementation never is my view.
|
||||||
Better to have a bad implementation now than a good implementation never.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
The package provides 3 queues: `Pure`, `Paired`, and `Indexed`, all of which are min-queues.
|
|
||||||
The `PureQueue` directly sorts the values it is given and returns them in order.
|
|
||||||
The `PairedQueue` pairs an arbitrary Python object with a float priority and returns the objects in the order specified by their priorities.
|
|
||||||
The `IndexedQueue` works the same as the `PairedQueue`, but allows arbitrary priority modification and object deletion at the cost of some runtime overhead and no support for duplicate objects (duplicate priorities are okay).
|
|
||||||
|
|
||||||
Typing is provided in `pyority_queue.pyi`, and should be picked up by your IDE.
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
Install venv and setup as usual
|
|
||||||
|
|
||||||
```sh
|
|
||||||
python -m venv venv
|
|
||||||
pip install -r requirements.txt
|
|
||||||
source venv/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
Build rust code with
|
|
||||||
|
|
||||||
```sh
|
|
||||||
maturin develop
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that after you build the project for the first time you may have to restart the venv for it to pick up the new module
|
|
||||||
|
|
||||||
```sh
|
|
||||||
deactivate
|
|
||||||
source venv/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
Develop as usual, you should now be able to import the code through Python
|
|
||||||
|
|
||||||
```py
|
|
||||||
from pyority_queue import *
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
Run the rust test suite with
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cargo test
|
|
||||||
```
|
|
||||||
|
|
||||||
Run the python test suite with
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pytest tests/*.py
|
|
||||||
```
|
|
||||||
|
|
|
@ -2,4 +2,5 @@ iniconfig==2.0.0
|
||||||
maturin==1.8.1
|
maturin==1.8.1
|
||||||
packaging==24.2
|
packaging==24.2
|
||||||
pluggy==1.5.0
|
pluggy==1.5.0
|
||||||
|
-e git+ssh://git@git.mmbradley.ca:222/MichaelBradley/pyority_queue.git@661e1d220ae71002d66d2ba2d3dfddfe4ff1035d#egg=pyority_queue
|
||||||
pytest==8.3.4
|
pytest==8.3.4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue