fastquadtree 0.4.1__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.
Files changed (45) hide show
  1. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/.github/workflows/release.yml +29 -11
  2. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/.pre-commit-config.yaml +2 -11
  3. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/Cargo.lock +1 -1
  4. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/Cargo.toml +1 -1
  5. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/PKG-INFO +1 -1
  6. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/engines.py +1 -1
  7. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/pyproject.toml +15 -0
  8. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/pysrc/fastquadtree/_bimap.py +3 -3
  9. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/test_wrapper_edges.py +17 -0
  10. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/.gitignore +0 -0
  11. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/LICENSE +0 -0
  12. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/README.md +0 -0
  13. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/assets/interactive_v2_screenshot.png +0 -0
  14. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/assets/quadtree_bench_throughput.png +0 -0
  15. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/assets/quadtree_bench_time.png +0 -0
  16. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/benchmark_native_vs_shim.py +0 -0
  17. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/cross_library_bench.py +0 -0
  18. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/__init__.py +0 -0
  19. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/main.py +0 -0
  20. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/plotting.py +0 -0
  21. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/quadtree_bench/runner.py +0 -0
  22. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/requirements.txt +0 -0
  23. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/benchmarks/runner.py +0 -0
  24. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/examples/delete_demo.rs +0 -0
  25. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/interactive/interactive.py +0 -0
  26. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/interactive/interactive_v2.py +0 -0
  27. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/interactive/requirements.txt +0 -0
  28. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/pysrc/fastquadtree/__init__.py +0 -0
  29. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/pysrc/fastquadtree/__init__.pyi +0 -0
  30. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/pysrc/fastquadtree/_item.py +0 -0
  31. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/pysrc/fastquadtree/py.typed +0 -0
  32. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/src/geom.rs +0 -0
  33. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/src/lib.rs +0 -0
  34. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/src/quadtree.rs +0 -0
  35. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/insertions.rs +0 -0
  36. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/nearest_neighbor.rs +0 -0
  37. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/query.rs +0 -0
  38. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/rectangle_traversal.rs +0 -0
  39. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/test_bimap.py +0 -0
  40. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/test_delete.rs +0 -0
  41. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/test_delete_by_object.py +0 -0
  42. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/test_delete_python.py +0 -0
  43. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/test_python.py +0 -0
  44. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/test_unconventional_bounds.py +0 -0
  45. {fastquadtree-0.4.1 → fastquadtree-0.4.2}/tests/unconventional_bounds.rs +0 -0
@@ -2,8 +2,7 @@ name: Publish to PyPI
2
2
 
3
3
  on:
4
4
  push:
5
- tags:
6
- - "v*"
5
+ tags: ["v*"]
7
6
  release:
8
7
  types: [published]
9
8
  workflow_dispatch:
@@ -18,21 +17,41 @@ jobs:
18
17
  uses: actions/setup-python@v5
19
18
  with:
20
19
  python-version: "3.10"
21
- - name: Build with maturin
20
+
21
+ - name: Create venv for maturin develop
22
+ run: python -m venv .venv
23
+
24
+ - name: Build with maturin & install into .venv
22
25
  uses: PyO3/maturin-action@v1
23
26
  with:
24
- command: build
27
+ command: develop
28
+ args: --release
25
29
  manylinux: manylinux2014
26
- - name: Install Dependencies
27
- run: pip install pytest pytest-cov
28
- - name: Test with pytest
29
- run: pytest --cov --cov-branch --cov-report=xml
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
+
30
47
  - name: Upload coverage to Codecov
31
48
  uses: codecov/codecov-action@v5
32
49
  with:
33
50
  token: ${{ secrets.CODECOV_TOKEN }}
51
+
34
52
  build:
35
53
  name: Build wheels
54
+ needs: test
36
55
  runs-on: ${{ matrix.os }}
37
56
  strategy:
38
57
  matrix:
@@ -45,8 +64,7 @@ jobs:
45
64
  args: "--skip-existing"
46
65
  steps:
47
66
  - uses: actions/checkout@v4
48
- - name: Set up Python
49
- uses: actions/setup-python@v5
67
+ - uses: actions/setup-python@v5
50
68
  with:
51
69
  python-version: "3.10"
52
70
  - name: Build and publish with maturin
@@ -56,4 +74,4 @@ jobs:
56
74
  with:
57
75
  command: publish
58
76
  args: ${{ matrix.args }}
59
- manylinux: manylinux2014
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: bash -c "coverage run -m pytest -q"
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
@@ -22,7 +22,7 @@ checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
22
22
 
23
23
  [[package]]
24
24
  name = "fastquadtree"
25
- version = "0.4.1"
25
+ version = "0.4.2"
26
26
  dependencies = [
27
27
  "pyo3",
28
28
  ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "fastquadtree"
3
- version = "0.4.1"
3
+ version = "0.4.2"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastquadtree
3
- Version: 0.4.1
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
@@ -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), # Brute force doesn't scale well on the graphs so omit it from the main set
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
- if self._id_to_item.get(item.id) is item:
84
- removed = self._id_to_item.pop(item.id)
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 and self._objid_to_item.get(id(obj)) is item:
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
File without changes
File without changes
File without changes
File without changes
File without changes