fastquadtree 0.4.0__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastquadtree-0.4.2/.github/workflows/release.yml +77 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/.pre-commit-config.yaml +2 -11
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/Cargo.lock +1 -1
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/Cargo.toml +1 -1
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/PKG-INFO +18 -3
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/README.md +17 -2
- fastquadtree-0.4.2/assets/quadtree_bench_throughput.png +0 -0
- fastquadtree-0.4.2/assets/quadtree_bench_time.png +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/engines.py +1 -1
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/pyproject.toml +15 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/pysrc/fastquadtree/_bimap.py +3 -3
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/test_wrapper_edges.py +17 -0
- fastquadtree-0.4.0/.github/workflows/release.yml +0 -37
- fastquadtree-0.4.0/assets/quadtree_bench_throughput.png +0 -0
- fastquadtree-0.4.0/assets/quadtree_bench_time.png +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/.gitignore +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/LICENSE +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/assets/interactive_v2_screenshot.png +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/benchmark_native_vs_shim.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/cross_library_bench.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/__init__.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/main.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/plotting.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/runner.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/requirements.txt +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/benchmarks/runner.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/examples/delete_demo.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/interactive/interactive.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/interactive/interactive_v2.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/interactive/requirements.txt +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/pysrc/fastquadtree/__init__.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/pysrc/fastquadtree/__init__.pyi +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/pysrc/fastquadtree/_item.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/pysrc/fastquadtree/py.typed +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/src/geom.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/src/lib.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/src/quadtree.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/insertions.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/nearest_neighbor.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/query.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/rectangle_traversal.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/test_bimap.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/test_delete.rs +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/test_delete_by_object.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/test_delete_python.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/test_python.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/test_unconventional_bounds.py +0 -0
- {fastquadtree-0.4.0 → fastquadtree-0.4.2}/tests/unconventional_bounds.rs +0 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
name: Publish to PyPI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags: ["v*"]
|
6
|
+
release:
|
7
|
+
types: [published]
|
8
|
+
workflow_dispatch:
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
test:
|
12
|
+
name: Test build
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v4
|
16
|
+
- name: Set up Python
|
17
|
+
uses: actions/setup-python@v5
|
18
|
+
with:
|
19
|
+
python-version: "3.10"
|
20
|
+
|
21
|
+
- name: Create venv for maturin develop
|
22
|
+
run: python -m venv .venv
|
23
|
+
|
24
|
+
- name: Build with maturin & install into .venv
|
25
|
+
uses: PyO3/maturin-action@v1
|
26
|
+
with:
|
27
|
+
command: develop
|
28
|
+
args: --release
|
29
|
+
manylinux: manylinux2014
|
30
|
+
|
31
|
+
- name: Install Python test deps into .venv
|
32
|
+
run: |
|
33
|
+
. .venv/bin/activate
|
34
|
+
pip install -U pip pytest pytest-cov
|
35
|
+
|
36
|
+
- name: Run Python tests
|
37
|
+
run: |
|
38
|
+
. .venv/bin/activate
|
39
|
+
pytest
|
40
|
+
|
41
|
+
- name: Install Rust toolchain
|
42
|
+
uses: dtolnay/rust-toolchain@stable
|
43
|
+
|
44
|
+
- name: Run Rust tests
|
45
|
+
run: cargo test
|
46
|
+
|
47
|
+
- name: Upload coverage to Codecov
|
48
|
+
uses: codecov/codecov-action@v5
|
49
|
+
with:
|
50
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
51
|
+
|
52
|
+
build:
|
53
|
+
name: Build wheels
|
54
|
+
needs: test
|
55
|
+
runs-on: ${{ matrix.os }}
|
56
|
+
strategy:
|
57
|
+
matrix:
|
58
|
+
include:
|
59
|
+
- os: ubuntu-latest
|
60
|
+
args: "--skip-existing"
|
61
|
+
- os: macos-latest
|
62
|
+
args: "--skip-existing --target universal2-apple-darwin"
|
63
|
+
- os: windows-latest
|
64
|
+
args: "--skip-existing"
|
65
|
+
steps:
|
66
|
+
- uses: actions/checkout@v4
|
67
|
+
- uses: actions/setup-python@v5
|
68
|
+
with:
|
69
|
+
python-version: "3.10"
|
70
|
+
- name: Build and publish with maturin
|
71
|
+
uses: PyO3/maturin-action@v1
|
72
|
+
env:
|
73
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
74
|
+
with:
|
75
|
+
command: publish
|
76
|
+
args: ${{ matrix.args }}
|
77
|
+
manylinux: manylinux2014
|
@@ -31,16 +31,7 @@ repos:
|
|
31
31
|
# This both runs pytest and generates .coverage data
|
32
32
|
- id: pytest
|
33
33
|
name: pytest (under coverage)
|
34
|
-
entry:
|
34
|
+
entry: pytest
|
35
35
|
language: system
|
36
36
|
pass_filenames: false
|
37
|
-
always_run: true
|
38
|
-
|
39
|
-
# 4) Coverage threshold check
|
40
|
-
# Change FAIL_UNDER to your target percent
|
41
|
-
- id: coverage-report
|
42
|
-
name: coverage report
|
43
|
-
entry: bash -c 'coverage report --omit="tests/*" --fail-under=85'
|
44
|
-
language: system
|
45
|
-
pass_filenames: false
|
46
|
-
always_run: true
|
37
|
+
always_run: true
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fastquadtree
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.2
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
5
5
|
Classifier: Programming Language :: Python :: 3 :: Only
|
6
6
|
Classifier: Programming Language :: Rust
|
@@ -23,7 +23,22 @@ Project-URL: Issues, https://github.com/Elan456/fastquadtree/issues
|
|
23
23
|
|
24
24
|
# fastquadtree
|
25
25
|
|
26
|
-
[](https://pypi.org/project/fastquadtree/)
|
27
|
+
[](https://pypi.org/project/fastquadtree/)
|
28
|
+
[](https://pypi.org/project/fastquadtree/#files)
|
29
|
+
[](LICENSE)
|
30
|
+
|
31
|
+
[](https://pepy.tech/projects/fastquadtree)
|
32
|
+
[](https://pepy.tech/projects/fastquadtree)
|
33
|
+
|
34
|
+
[](https://github.com/Elan456/fastquadtree/actions/workflows/ci.yml)
|
35
|
+
[](https://codecov.io/gh/Elan456/fastquadtree)
|
36
|
+
|
37
|
+
[](https://pyo3.rs/)
|
38
|
+
[](https://www.maturin.rs/)
|
39
|
+
[](https://github.com/psf/black)
|
40
|
+
[](http://mypy-lang.org/)
|
41
|
+
|
27
42
|
|
28
43
|

|
29
44
|
|
@@ -86,7 +101,7 @@ id1 = qt_tracked.insert((50, 50), obj=player1)
|
|
86
101
|
id2 = qt_tracked.insert((150, 150), obj=player2)
|
87
102
|
|
88
103
|
# Delete by object reference (O(1) lookup!)
|
89
|
-
deleted = qt_tracked.delete_by_object(player1
|
104
|
+
deleted = qt_tracked.delete_by_object(player1)
|
90
105
|
print(f"Deleted player: {deleted}") # True
|
91
106
|
```
|
92
107
|
|
@@ -1,6 +1,21 @@
|
|
1
1
|
# fastquadtree
|
2
2
|
|
3
|
-
[](https://pypi.org/project/fastquadtree/)
|
4
|
+
[](https://pypi.org/project/fastquadtree/)
|
5
|
+
[](https://pypi.org/project/fastquadtree/#files)
|
6
|
+
[](LICENSE)
|
7
|
+
|
8
|
+
[](https://pepy.tech/projects/fastquadtree)
|
9
|
+
[](https://pepy.tech/projects/fastquadtree)
|
10
|
+
|
11
|
+
[](https://github.com/Elan456/fastquadtree/actions/workflows/ci.yml)
|
12
|
+
[](https://codecov.io/gh/Elan456/fastquadtree)
|
13
|
+
|
14
|
+
[](https://pyo3.rs/)
|
15
|
+
[](https://www.maturin.rs/)
|
16
|
+
[](https://github.com/psf/black)
|
17
|
+
[](http://mypy-lang.org/)
|
18
|
+
|
4
19
|
|
5
20
|

|
6
21
|
|
@@ -63,7 +78,7 @@ id1 = qt_tracked.insert((50, 50), obj=player1)
|
|
63
78
|
id2 = qt_tracked.insert((150, 150), obj=player2)
|
64
79
|
|
65
80
|
# Delete by object reference (O(1) lookup!)
|
66
|
-
deleted = qt_tracked.delete_by_object(player1
|
81
|
+
deleted = qt_tracked.delete_by_object(player1)
|
67
82
|
print(f"Deleted player: {deleted}") # True
|
68
83
|
```
|
69
84
|
|
Binary file
|
Binary file
|
@@ -247,7 +247,7 @@ def get_engines(
|
|
247
247
|
"fastquadtree": _create_fastquadtree_engine(bounds, max_points, max_depth),
|
248
248
|
"e-pyquadtree": _create_e_pyquadtree_engine(bounds, max_points, max_depth),
|
249
249
|
"PyQtree": _create_pyqtree_engine(bounds, max_points, max_depth),
|
250
|
-
"Brute force": _create_brute_force_engine(bounds, max_points, max_depth),
|
250
|
+
# "Brute force": _create_brute_force_engine(bounds, max_points, max_depth), # Brute force doesn't scale well on the graphs so omit it from the main set
|
251
251
|
}
|
252
252
|
|
253
253
|
# Optional engines (only include if import succeeded)
|
@@ -39,3 +39,18 @@ module-name = "fastquadtree._native"
|
|
39
39
|
# Choose a wide wheel tag for Linux. Adjust if your build images are newer.
|
40
40
|
# Options include: manylinux2014, manylinux_2_28, musllinux_1_2, or "off".
|
41
41
|
compatibility = "manylinux2014"
|
42
|
+
|
43
|
+
[tool.pytest.ini_options]
|
44
|
+
addopts = "--cov=fastquadtree --cov-branch --cov-report=xml --cov-fail-under=95"
|
45
|
+
testpaths = ["tests"] # still run tests
|
46
|
+
|
47
|
+
[tool.coverage.run]
|
48
|
+
source = ["fastquadtree"]
|
49
|
+
omit = [
|
50
|
+
"tests/*",
|
51
|
+
]
|
52
|
+
|
53
|
+
[tool.coverage.report]
|
54
|
+
omit = [
|
55
|
+
"tests/*",
|
56
|
+
]
|
@@ -80,11 +80,11 @@ class BiMap:
|
|
80
80
|
"""
|
81
81
|
removed = None
|
82
82
|
# Remove by id first
|
83
|
-
|
84
|
-
|
83
|
+
removed = self._id_to_item.pop(item.id)
|
84
|
+
|
85
85
|
# Remove by obj side
|
86
86
|
obj = item.obj
|
87
|
-
if obj is not None
|
87
|
+
if obj is not None:
|
88
88
|
self._objid_to_item.pop(id(obj), None)
|
89
89
|
removed = removed or item
|
90
90
|
return removed
|
@@ -207,3 +207,20 @@ def test_insert_many_points_exception_for_out_of_bounds():
|
|
207
207
|
|
208
208
|
with pytest.raises(ValueError):
|
209
209
|
qt.insert_many_points(points)
|
210
|
+
|
211
|
+
|
212
|
+
def test_auto_id_collision_prevention():
|
213
|
+
qt = QuadTree(BOUNDS, capacity=8, track_objects=True)
|
214
|
+
id1 = qt.insert((10, 10)) # auto ID
|
215
|
+
|
216
|
+
id2 = qt.insert((20, 20), id=200) # Large ID
|
217
|
+
|
218
|
+
# Next auto ID should be 201
|
219
|
+
id3 = qt.insert((30, 30)) # auto ID
|
220
|
+
|
221
|
+
assert id3 == 201
|
222
|
+
assert len(qt) == 3
|
223
|
+
assert id1 != id2 != id3
|
224
|
+
|
225
|
+
id4 = qt.insert((40, 40), id=150) # Manual ID lower than current auto ID
|
226
|
+
assert id4 == 150
|
@@ -1,37 +0,0 @@
|
|
1
|
-
name: Publish to PyPI
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
tags:
|
6
|
-
- "v*"
|
7
|
-
release:
|
8
|
-
types: [published]
|
9
|
-
workflow_dispatch:
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
build:
|
13
|
-
name: Build wheels
|
14
|
-
runs-on: ${{ matrix.os }}
|
15
|
-
strategy:
|
16
|
-
matrix:
|
17
|
-
include:
|
18
|
-
- os: ubuntu-latest
|
19
|
-
args: "--skip-existing"
|
20
|
-
- os: macos-latest
|
21
|
-
args: "--skip-existing --target universal2-apple-darwin"
|
22
|
-
- os: windows-latest
|
23
|
-
args: "--skip-existing"
|
24
|
-
steps:
|
25
|
-
- uses: actions/checkout@v4
|
26
|
-
- name: Set up Python
|
27
|
-
uses: actions/setup-python@v5
|
28
|
-
with:
|
29
|
-
python-version: "3.10"
|
30
|
-
- name: Build and publish with maturin
|
31
|
-
uses: PyO3/maturin-action@v1
|
32
|
-
env:
|
33
|
-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
34
|
-
with:
|
35
|
-
command: publish
|
36
|
-
args: ${{ matrix.args }}
|
37
|
-
manylinux: manylinux2014
|
Binary file
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|