scgraph 3.3.0__tar.gz → 3.4.1__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 (28) hide show
  1. scgraph-3.4.1/CMakeLists.txt +91 -0
  2. {scgraph-3.3.0 → scgraph-3.4.1}/PKG-INFO +27 -12
  3. {scgraph-3.3.0 → scgraph-3.4.1}/README.md +13 -8
  4. {scgraph-3.3.0 → scgraph-3.4.1}/pyproject.toml +31 -3
  5. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/__init__.py +15 -7
  6. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/utils.py +12 -1
  7. scgraph-3.3.0/CMakeLists.txt +0 -83
  8. scgraph-3.3.0/build/cp314-cp314-linux_x86_64/CMakeFiles/CheckCXX/CMakeLists.txt +0 -6
  9. {scgraph-3.3.0 → scgraph-3.4.1}/LICENSE +0 -0
  10. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/contraction_hierarchies.py +0 -0
  11. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/bindings/graph_bindings.cpp +0 -0
  12. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/bmssp.hpp +0 -0
  13. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/contraction_hierarchies.cpp +0 -0
  14. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/contraction_hierarchies.hpp +0 -0
  15. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/graph.cpp +0 -0
  16. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/graph.hpp +0 -0
  17. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/graph_utils.cpp +0 -0
  18. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/graph_utils.hpp +0 -0
  19. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/transit_node_routing.cpp +0 -0
  20. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/cpp/src/transit_node_routing.hpp +0 -0
  21. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/geograph.py +0 -0
  22. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/graph.py +0 -0
  23. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/graph_utils.py +0 -0
  24. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/grid.py +0 -0
  25. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/helpers/__init__.py +0 -0
  26. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/helpers/geojson.py +0 -0
  27. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/helpers/visvalingam.py +0 -0
  28. {scgraph-3.3.0 → scgraph-3.4.1}/scgraph/transit_node_routing.py +0 -0
@@ -0,0 +1,91 @@
1
+ cmake_minimum_required(VERSION 3.15)
2
+
3
+ # -----------------------------
4
+ # Define The Project
5
+ # -----------------------------
6
+ project(scgraph LANGUAGES NONE)
7
+
8
+ # -----------------------------
9
+ # Build Options
10
+ # -----------------------------
11
+ option(SKIP_CPP_BUILD "Skip C++ extension module building" OFF)
12
+
13
+ # -----------------------------
14
+ # C++ detection
15
+ # -----------------------------
16
+ if(NOT SKIP_CPP_BUILD)
17
+ include(CheckLanguage)
18
+ check_language(CXX)
19
+
20
+ if(CMAKE_CXX_COMPILER)
21
+ enable_language(CXX OPTIONAL)
22
+ endif()
23
+ endif()
24
+
25
+
26
+ if(SKIP_CPP_BUILD)
27
+
28
+ message(STATUS
29
+ "C++ build skipped. Using pure python version. Performance will be reduced."
30
+ )
31
+
32
+ elseif(NOT CMAKE_CXX_COMPILER_LOADED)
33
+
34
+ message(WARNING
35
+ "No usable C++ compiler detected. Using pure python version. Performance will be reduced."
36
+ )
37
+
38
+ else()
39
+
40
+ # -----------------------------
41
+ # Find Packages
42
+ # -----------------------------
43
+ find_package(Python 3.10 COMPONENTS Interpreter Development.Module QUIET)
44
+ find_package(nanobind CONFIG QUIET)
45
+
46
+ if(Python_FOUND AND nanobind_FOUND)
47
+ message(STATUS
48
+ "C++ compiler detected: Building compiled extension."
49
+ )
50
+
51
+ # -----------------------------
52
+ # Set C++ standard
53
+ # -----------------------------
54
+ set(CMAKE_CXX_STANDARD 20)
55
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
56
+
57
+ # -----------------------------
58
+ # OPTIMIZATION FLAGS
59
+ # -----------------------------
60
+ set(CMAKE_BUILD_TYPE Release)
61
+ if(MSVC)
62
+ set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG")
63
+ else()
64
+ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG")
65
+ endif()
66
+
67
+ # -----------------------------
68
+ # Graph module
69
+ # -----------------------------
70
+ nanobind_add_module(cpp
71
+ STABLE_ABI
72
+ scgraph/cpp/bindings/graph_bindings.cpp
73
+ scgraph/cpp/src/graph.cpp
74
+ scgraph/cpp/src/graph_utils.cpp
75
+ scgraph/cpp/src/contraction_hierarchies.cpp
76
+ scgraph/cpp/src/transit_node_routing.cpp
77
+ )
78
+
79
+ install(TARGETS cpp DESTINATION scgraph)
80
+ else()
81
+ message(WARNING
82
+ "Python development headers or nanobind not found. Using pure python version. Performance will be reduced."
83
+ )
84
+ endif()
85
+
86
+ endif()
87
+
88
+ # -----------------------------
89
+ # Install Python package files
90
+ # -----------------------------
91
+ install(DIRECTORY scgraph DESTINATION . FILES_MATCHING PATTERN "*.py")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scgraph
3
- Version: 3.3.0
3
+ Version: 3.4.1
4
4
  Summary: Determine an approximate distance and route between two points on earth.
5
5
  Author-Email: Connor Makowski <conmak@mit.edu>
6
6
  License-Expression: MIT
@@ -10,10 +10,20 @@ Classifier: Operating System :: OS Independent
10
10
  Project-URL: Homepage, https://github.com/connor-makowski/scgraph
11
11
  Project-URL: Bug Tracker, https://github.com/connor-makowski/scgraph/issues
12
12
  Project-URL: Documentation, https://connor-makowski.github.io/scgraph/scgraph.html
13
- Requires-Python: >=3.10
14
- Requires-Dist: geokdtree==1.2.3
15
- Requires-Dist: bmsspy<3.0.0,>=2.2.0
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: geokdtree==1.2.4
15
+ Requires-Dist: bmsspy<3.0.0,>=2.2.1
16
16
  Requires-Dist: requests<3.0.0,>=2.32.0
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest>=9.0.3; extra == "dev"
19
+ Requires-Dist: pamda>=2.10.0; extra == "dev"
20
+ Requires-Dist: autoflake>=2.3.1; extra == "dev"
21
+ Requires-Dist: black>=25.1.0; extra == "dev"
22
+ Requires-Dist: build>=1.2.2; extra == "dev"
23
+ Requires-Dist: nox>=2026.4.10; extra == "dev"
24
+ Requires-Dist: nox-uv>=0.8.0; extra == "dev"
25
+ Requires-Dist: pdoc>=15.0.1; extra == "dev"
26
+ Requires-Dist: twine>=6.1.0; extra == "dev"
17
27
  Description-Content-Type: text/markdown
18
28
 
19
29
  # SCGraph
@@ -733,17 +743,22 @@ dist_mi = distance_converter(dist_km, input_units='km', output_units='mi')
733
743
 
734
744
  # Development
735
745
 
736
- Make sure Docker is installed and running on a Unix system (Linux, macOS, WSL2).
746
+ Dev dependencies are declared in `[project.optional-dependencies] dev` in `pyproject.toml`. Install them with:
747
+
748
+ ```bash
749
+ uv sync --extra dev
750
+ ```
737
751
 
738
752
  | Command | Description |
739
753
  |---|---|
740
- | `./run.sh` | Create a Docker container and drop into a shell |
741
- | `./run.sh test` | Run all tests |
742
- | `./run.sh test test/01_graph_basic_test.py` | Run a specific test file |
743
- | `./run.sh prettify` | Prettify the code |
744
- | `./run.sh docs` | Update the docs |
745
-
746
- You can modify the `Dockerfile` to test against different Python versions.
754
+ | `uv run pytest` | Run all tests |
755
+ | `uv run pytest test/NN_*.py` | Run a specific test file |
756
+ | `uv run nox` | Run tests (C++ then no-C++) across Python 3.11–3.14 |
757
+ | `uv run nox -s tests-3.14` | Run both build variants on a single Python version |
758
+ | `uv run utils/benchmark.py` | Run all benchmarks, output `benchmark_results.json` |
759
+ | `uv run utils/prettify.py` | Format with autoflake + black |
760
+
761
+ For full developer documentation see [DEVELOPMENT.md](DEVELOPMENT.md).
747
762
 
748
763
  ---
749
764
 
@@ -715,17 +715,22 @@ dist_mi = distance_converter(dist_km, input_units='km', output_units='mi')
715
715
 
716
716
  # Development
717
717
 
718
- Make sure Docker is installed and running on a Unix system (Linux, macOS, WSL2).
718
+ Dev dependencies are declared in `[project.optional-dependencies] dev` in `pyproject.toml`. Install them with:
719
+
720
+ ```bash
721
+ uv sync --extra dev
722
+ ```
719
723
 
720
724
  | Command | Description |
721
725
  |---|---|
722
- | `./run.sh` | Create a Docker container and drop into a shell |
723
- | `./run.sh test` | Run all tests |
724
- | `./run.sh test test/01_graph_basic_test.py` | Run a specific test file |
725
- | `./run.sh prettify` | Prettify the code |
726
- | `./run.sh docs` | Update the docs |
727
-
728
- You can modify the `Dockerfile` to test against different Python versions.
726
+ | `uv run pytest` | Run all tests |
727
+ | `uv run pytest test/NN_*.py` | Run a specific test file |
728
+ | `uv run nox` | Run tests (C++ then no-C++) across Python 3.11–3.14 |
729
+ | `uv run nox -s tests-3.14` | Run both build variants on a single Python version |
730
+ | `uv run utils/benchmark.py` | Run all benchmarks, output `benchmark_results.json` |
731
+ | `uv run utils/prettify.py` | Format with autoflake + black |
732
+
733
+ For full developer documentation see [DEVELOPMENT.md](DEVELOPMENT.md).
729
734
 
730
735
  ---
731
736
 
@@ -11,6 +11,10 @@ build-backend = "scikit_build_core.build"
11
11
  build.verbose = false
12
12
  build-dir = "build/{wheel_tag}"
13
13
 
14
+ [[tool.scikit-build.overrides]]
15
+ if.failed = true
16
+ wheel.cmake = false
17
+
14
18
  [tool.scikit-build.sdist]
15
19
  exclude = ["*"]
16
20
  include = [
@@ -26,20 +30,44 @@ include = [
26
30
 
27
31
  [project]
28
32
  name = "scgraph"
29
- version = "3.3.0"
33
+ version = "3.4.1"
30
34
  description = "Determine an approximate distance and route between two points on earth."
31
35
  authors = [
32
36
  {name="Connor Makowski", email="conmak@mit.edu"}
33
37
  ]
34
38
  readme = "README.md"
35
- requires-python = ">=3.10"
39
+ requires-python = ">=3.11"
36
40
  license="MIT"
37
41
  classifiers = [
38
42
  "Programming Language :: Python :: 3",
39
43
  "Programming Language :: C++",
40
44
  "Operating System :: OS Independent",
41
45
  ]
42
- dependencies = ["geokdtree==1.2.3","bmsspy>=2.2.0,<3.0.0","requests>=2.32.0,<3.0.0"]
46
+ dependencies = [
47
+ "geokdtree==1.2.4",
48
+ "bmsspy>=2.2.1,<3.0.0",
49
+ "requests>=2.32.0,<3.0.0"
50
+ ]
51
+
52
+ [project.optional-dependencies]
53
+ dev = [
54
+ "pytest>=9.0.3",
55
+ "pamda>=2.10.0",
56
+ "autoflake>=2.3.1",
57
+ "black>=25.1.0",
58
+ "build>=1.2.2",
59
+ "nox>=2026.4.10",
60
+ "nox-uv>=0.8.0",
61
+ "pdoc>=15.0.1",
62
+ "twine>=6.1.0",
63
+ ]
64
+
65
+ [tool.pytest.ini_options]
66
+ testpaths = ["test"]
67
+ pythonpath = ["test"]
68
+
69
+ [tool.uv]
70
+ no-build-isolation-package = []
43
71
 
44
72
  [project.urls]
45
73
  "Homepage" = "https://github.com/connor-makowski/scgraph"
@@ -716,23 +716,29 @@ dist_mi = distance_converter(dist_km, input_units='km', output_units='mi')
716
716
 
717
717
  # Development
718
718
 
719
- Make sure Docker is installed and running on a Unix system (Linux, macOS, WSL2).
719
+ Dev dependencies are declared in `[project.optional-dependencies] dev` in `pyproject.toml`. Install them with:
720
+
721
+ ```bash
722
+ uv sync --extra dev
723
+ ```
720
724
 
721
725
  | Command | Description |
722
726
  |---|---|
723
- | `./run.sh` | Create a Docker container and drop into a shell |
724
- | `./run.sh test` | Run all tests |
725
- | `./run.sh test test/01_graph_basic_test.py` | Run a specific test file |
726
- | `./run.sh prettify` | Prettify the code |
727
- | `./run.sh docs` | Update the docs |
727
+ | `uv run pytest` | Run all tests |
728
+ | `uv run pytest test/NN_*.py` | Run a specific test file |
729
+ | `uv run nox` | Run tests (C++ then no-C++) across Python 3.11–3.14 |
730
+ | `uv run nox -s tests-3.14` | Run both build variants on a single Python version |
731
+ | `uv run utils/benchmark.py` | Run all benchmarks, output `benchmark_results.json` |
732
+ | `uv run utils/prettify.py` | Format with autoflake + black |
728
733
 
729
- You can modify the `Dockerfile` to test against different Python versions.
734
+ For full developer documentation see [DEVELOPMENT.md](DEVELOPMENT.md).
730
735
 
731
736
  ---
732
737
 
733
738
  ## Attributions and Thanks
734
739
 
735
740
  Originally inspired by [searoute](https://github.com/genthalili/searoute-py), including the use of one of their [datasets](https://github.com/genthalili/searoute-py/blob/main/searoute/data/marnet_densified_v2_old.geojson) that has been modified to work with this package.
741
+
736
742
  """
737
743
 
738
744
  try:
@@ -740,5 +746,7 @@ try:
740
746
  except ImportError:
741
747
  from scgraph.graph import Graph
742
748
  from scgraph.contraction_hierarchies import CHGraph
749
+
743
750
  from scgraph.geograph import GeoGraph
744
751
  from scgraph.grid import GridGraph
752
+
@@ -344,10 +344,21 @@ def time_test(name, function, args=None, kwargs=None):
344
344
  print(f"{name}: {round((time.time()-start)*1000, 4)}ms")
345
345
 
346
346
 
347
+ def has_cpp():
348
+ try:
349
+ from scgraph.cpp import Graph # noqa: F401
350
+
351
+ return True
352
+ except ImportError:
353
+ return False
354
+
355
+
347
356
  def cpp_check():
348
357
  try:
358
+ from scgraph.cpp import Graph # noqa: F401
359
+
349
360
  print("Using C++ & Python implementation of SCGraph.")
350
- except:
361
+ except ImportError:
351
362
  print("Using Pure Python implementation of SCGraph.")
352
363
 
353
364
 
@@ -1,83 +0,0 @@
1
- cmake_minimum_required(VERSION 3.15)
2
-
3
- # -----------------------------
4
- # Define The Project
5
- # -----------------------------
6
- project(scgraph LANGUAGES NONE)
7
-
8
- # -----------------------------
9
- # Build Options
10
- # -----------------------------
11
- option(SKIP_CPP_BUILD "Skip C++ extension module building" OFF)
12
-
13
- # -----------------------------
14
- # C++ detection
15
- # -----------------------------
16
- include(CheckLanguage)
17
- check_language(CXX)
18
-
19
- if(CMAKE_CXX_COMPILER)
20
- enable_language(CXX)
21
- endif()
22
-
23
-
24
- if(SKIP_CPP_BUILD)
25
-
26
- message(STATUS
27
- "C++ build skipped. Using pure python version. Performance will be reduced."
28
- )
29
-
30
- elseif(NOT CMAKE_CXX_COMPILER_LOADED)
31
-
32
- message(WARNING
33
- "No usable C++ compiler detected. Using pure python version. Performance will be reduced."
34
- )
35
-
36
- else()
37
-
38
- message(STATUS
39
- "C++ compiler detected: Building compiled extension."
40
- )
41
-
42
- # -----------------------------
43
- # Set C++ standard
44
- # -----------------------------
45
- set(CMAKE_CXX_STANDARD 20)
46
- set(CMAKE_CXX_STANDARD_REQUIRED ON)
47
-
48
- # -----------------------------
49
- # OPTIMIZATION FLAGS
50
- # -----------------------------
51
- set(CMAKE_BUILD_TYPE Release)
52
- if(MSVC)
53
- set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG")
54
- else()
55
- set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG")
56
- endif()
57
-
58
- # -----------------------------
59
- # Find Packages
60
- # -----------------------------
61
- find_package(Python 3.10 COMPONENTS Interpreter Development REQUIRED)
62
-
63
- # -----------------------------
64
- # Add nanobind
65
- # -----------------------------
66
- find_package(nanobind CONFIG REQUIRED)
67
-
68
- # -----------------------------
69
- # Graph module
70
- # -----------------------------
71
- nanobind_add_module(cpp
72
- STABLE_ABI
73
- scgraph/cpp/bindings/graph_bindings.cpp
74
- scgraph/cpp/src/graph.cpp
75
- scgraph/cpp/src/graph_utils.cpp
76
- scgraph/cpp/src/contraction_hierarchies.cpp
77
- scgraph/cpp/src/transit_node_routing.cpp
78
- )
79
-
80
-
81
- install(TARGETS cpp DESTINATION scgraph)
82
-
83
- endif()
@@ -1,6 +0,0 @@
1
- cmake_minimum_required(VERSION 4.3.2)
2
- set(CMAKE_MODULE_PATH "")
3
-
4
- project(CheckCXX LANGUAGES CXX)
5
- file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/result.cmake" "set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\")
6
- ")
File without changes
File without changes
File without changes
File without changes
File without changes