From dc65a3c5e6c034609cdaf5aa356c0238323b614a Mon Sep 17 00:00:00 2001 From: czgdp1807 Date: Sat, 26 Jul 2025 17:59:50 +0530 Subject: [PATCH 1/4] Add Meson build system --- meson.build | 7 ++++ pydatastructs/meson.build | 68 +++++++++++++++++++++++++++++++++++++++ pyproject.toml | 3 ++ 3 files changed, 78 insertions(+) create mode 100644 meson.build create mode 100644 pydatastructs/meson.build create mode 100644 pyproject.toml diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..46b3a7b1 --- /dev/null +++ b/meson.build @@ -0,0 +1,7 @@ +project('pydatastructs', 'cpp', + version : '1.0.1-dev', + default_options : ['cpp_std=c++17']) + +python = import('python').find_installation(pure: false) + +subdir('pydatastructs') diff --git a/pydatastructs/meson.build b/pydatastructs/meson.build new file mode 100644 index 00000000..446c9243 --- /dev/null +++ b/pydatastructs/meson.build @@ -0,0 +1,68 @@ +python = import('python').find_installation(pure: false) + +# Install pure python sources +install_subdir( + '.', + install_dir: python.get_install_dir(subdir: 'pydatastructs'), +) + +# utils extension modules +python.extension_module( + 'pydatastructs.utils._backend.cpp._nodes', + 'utils/_backend/cpp/nodes.cpp', + install: true, + subdir: 'pydatastructs/utils' +) +python.extension_module( + 'pydatastructs.utils._backend.cpp._graph_utils', + 'utils/_backend/cpp/graph_utils.cpp', + install: true, + subdir: 'pydatastructs/utils' +) + +# linear_data_structures extension modules +python.extension_module( + 'pydatastructs.linear_data_structures._backend.cpp._arrays', + 'linear_data_structures/_backend/cpp/arrays/arrays.cpp', + install: true, + subdir: 'pydatastructs/linear_data_structures' +) +python.extension_module( + 'pydatastructs.linear_data_structures._backend.cpp._algorithms', + 'linear_data_structures/_backend/cpp/algorithms/algorithms.cpp', + install: true, + subdir: 'pydatastructs/linear_data_structures' +) + +# miscellaneous_data_structures extension module +python.extension_module( + 'pydatastructs.miscellaneous_data_structures._backend.cpp._stack', + 'miscellaneous_data_structures/_backend/cpp/stack/stack.cpp', + install: true, + subdir: 'pydatastructs/miscellaneous_data_structures' +) + +# trees extension module +python.extension_module( + 'pydatastructs.trees._backend.cpp._trees', + 'trees/_backend/cpp/trees.cpp', + install: true, + subdir: 'pydatastructs/trees' +) + +# graphs extension modules +py_include = include_directories('utils/_backend/cpp') +python.extension_module( + 'pydatastructs.graphs._backend.cpp._graph', + 'graphs/_backend/cpp/graph.cpp', + include_directories: py_include, + install: true, + subdir: 'pydatastructs/graphs' +) +python.extension_module( + 'pydatastructs.graphs._backend.cpp._algorithms', + 'graphs/_backend/cpp/algorithms.cpp', + include_directories: py_include, + install: true, + subdir: 'pydatastructs/graphs' +) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..abbc7e15 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["meson-python"] +build-backend = "mesonpy" From 54ecbf577a7e1c8de0c0aa4b4b9228a85a8c8285 Mon Sep 17 00:00:00 2001 From: czgdp1807 Date: Sat, 26 Jul 2025 21:07:08 +0530 Subject: [PATCH 2/4] Add spin config and install Python sources --- pydatastructs/graphs/meson.build | 38 ++++++++++ pydatastructs/graphs/tests/meson.build | 12 +++ .../linear_data_structures/meson.build | 33 +++++++++ .../linear_data_structures/tests/meson.build | 15 ++++ pydatastructs/meson.build | 74 ++----------------- .../miscellaneous_data_structures/meson.build | 31 ++++++++ .../tests/meson.build | 16 ++++ pydatastructs/strings/meson.build | 12 +++ pydatastructs/strings/tests/meson.build | 11 +++ pydatastructs/trees/meson.build | 22 ++++++ pydatastructs/trees/tests/meson.build | 14 ++++ pydatastructs/utils/meson.build | 28 +++++++ pydatastructs/utils/tests/meson.build | 11 +++ pyproject.toml | 7 ++ 14 files changed, 258 insertions(+), 66 deletions(-) create mode 100644 pydatastructs/graphs/meson.build create mode 100644 pydatastructs/graphs/tests/meson.build create mode 100644 pydatastructs/linear_data_structures/meson.build create mode 100644 pydatastructs/linear_data_structures/tests/meson.build create mode 100644 pydatastructs/miscellaneous_data_structures/meson.build create mode 100644 pydatastructs/miscellaneous_data_structures/tests/meson.build create mode 100644 pydatastructs/strings/meson.build create mode 100644 pydatastructs/strings/tests/meson.build create mode 100644 pydatastructs/trees/meson.build create mode 100644 pydatastructs/trees/tests/meson.build create mode 100644 pydatastructs/utils/meson.build create mode 100644 pydatastructs/utils/tests/meson.build diff --git a/pydatastructs/graphs/meson.build b/pydatastructs/graphs/meson.build new file mode 100644 index 00000000..ecd83290 --- /dev/null +++ b/pydatastructs/graphs/meson.build @@ -0,0 +1,38 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + '_extensions.py', + 'adjacency_list.py', + 'adjacency_matrix.py', + 'algorithms.py', + 'graph.py' + ], + subdir: 'pydatastructs/graphs' +) + +python.install_sources( + ['_backend/__init__.py', '_backend/cpp/__init__.py'], + subdir: 'pydatastructs/graphs/_backend' +) + +py_include = include_directories('../utils/_backend/cpp') + +python.extension_module( + 'pydatastructs.graphs._backend.cpp._graph', + '_backend/cpp/graph.cpp', + include_directories: py_include, + install: true, + subdir: 'pydatastructs/graphs' +) + +python.extension_module( + 'pydatastructs.graphs._backend.cpp._algorithms', + '_backend/cpp/algorithms.cpp', + include_directories: py_include, + install: true, + subdir: 'pydatastructs/graphs' +) + +subdir('tests') diff --git a/pydatastructs/graphs/tests/meson.build b/pydatastructs/graphs/tests/meson.build new file mode 100644 index 00000000..e887b63a --- /dev/null +++ b/pydatastructs/graphs/tests/meson.build @@ -0,0 +1,12 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + 'test_adjacency_list.py', + 'test_adjacency_matrix.py', + 'test_algorithms.py' + ], + subdir: 'pydatastructs/graphs/tests', + install_tag: 'tests' +) diff --git a/pydatastructs/linear_data_structures/meson.build b/pydatastructs/linear_data_structures/meson.build new file mode 100644 index 00000000..bf30078d --- /dev/null +++ b/pydatastructs/linear_data_structures/meson.build @@ -0,0 +1,33 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + '_extensions.py', + 'algorithms.py', + 'arrays.py', + 'linked_lists.py' + ], + subdir: 'pydatastructs/linear_data_structures' +) + +python.install_sources( + ['_backend/__init__.py', '_backend/cpp/__init__.py'], + subdir: 'pydatastructs/linear_data_structures/_backend' +) + +python.extension_module( + 'pydatastructs.linear_data_structures._backend.cpp._arrays', + '_backend/cpp/arrays/arrays.cpp', + install: true, + subdir: 'pydatastructs/linear_data_structures' +) + +python.extension_module( + 'pydatastructs.linear_data_structures._backend.cpp._algorithms', + '_backend/cpp/algorithms/algorithms.cpp', + install: true, + subdir: 'pydatastructs/linear_data_structures' +) + +subdir('tests') diff --git a/pydatastructs/linear_data_structures/tests/meson.build b/pydatastructs/linear_data_structures/tests/meson.build new file mode 100644 index 00000000..343f068f --- /dev/null +++ b/pydatastructs/linear_data_structures/tests/meson.build @@ -0,0 +1,15 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + 'benchmarks/__init__.py', + 'benchmarks/test_algorithms.py', + 'benchmarks/test_arrays.py', + 'test_algorithms.py', + 'test_arrays.py', + 'test_linked_lists.py' + ], + subdir: 'pydatastructs/linear_data_structures/tests', + install_tag: 'tests' +) diff --git a/pydatastructs/meson.build b/pydatastructs/meson.build index 446c9243..f7e11646 100644 --- a/pydatastructs/meson.build +++ b/pydatastructs/meson.build @@ -1,68 +1,10 @@ python = import('python').find_installation(pure: false) -# Install pure python sources -install_subdir( - '.', - install_dir: python.get_install_dir(subdir: 'pydatastructs'), -) - -# utils extension modules -python.extension_module( - 'pydatastructs.utils._backend.cpp._nodes', - 'utils/_backend/cpp/nodes.cpp', - install: true, - subdir: 'pydatastructs/utils' -) -python.extension_module( - 'pydatastructs.utils._backend.cpp._graph_utils', - 'utils/_backend/cpp/graph_utils.cpp', - install: true, - subdir: 'pydatastructs/utils' -) - -# linear_data_structures extension modules -python.extension_module( - 'pydatastructs.linear_data_structures._backend.cpp._arrays', - 'linear_data_structures/_backend/cpp/arrays/arrays.cpp', - install: true, - subdir: 'pydatastructs/linear_data_structures' -) -python.extension_module( - 'pydatastructs.linear_data_structures._backend.cpp._algorithms', - 'linear_data_structures/_backend/cpp/algorithms/algorithms.cpp', - install: true, - subdir: 'pydatastructs/linear_data_structures' -) - -# miscellaneous_data_structures extension module -python.extension_module( - 'pydatastructs.miscellaneous_data_structures._backend.cpp._stack', - 'miscellaneous_data_structures/_backend/cpp/stack/stack.cpp', - install: true, - subdir: 'pydatastructs/miscellaneous_data_structures' -) - -# trees extension module -python.extension_module( - 'pydatastructs.trees._backend.cpp._trees', - 'trees/_backend/cpp/trees.cpp', - install: true, - subdir: 'pydatastructs/trees' -) - -# graphs extension modules -py_include = include_directories('utils/_backend/cpp') -python.extension_module( - 'pydatastructs.graphs._backend.cpp._graph', - 'graphs/_backend/cpp/graph.cpp', - include_directories: py_include, - install: true, - subdir: 'pydatastructs/graphs' -) -python.extension_module( - 'pydatastructs.graphs._backend.cpp._algorithms', - 'graphs/_backend/cpp/algorithms.cpp', - include_directories: py_include, - install: true, - subdir: 'pydatastructs/graphs' -) +python.install_sources(['__init__.py'], subdir: 'pydatastructs') + +subdir('utils') +subdir('linear_data_structures') +subdir('miscellaneous_data_structures') +subdir('trees') +subdir('graphs') +subdir('strings') diff --git a/pydatastructs/miscellaneous_data_structures/meson.build b/pydatastructs/miscellaneous_data_structures/meson.build new file mode 100644 index 00000000..0cbe0695 --- /dev/null +++ b/pydatastructs/miscellaneous_data_structures/meson.build @@ -0,0 +1,31 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + '_extensions.py', + 'algorithms.py', + 'multiset.py', + 'sparse_table.py', + 'disjoint_set.py', + 'queue.py', + 'binomial_trees.py', + 'segment_tree.py', + 'stack.py' + ], + subdir: 'pydatastructs/miscellaneous_data_structures' +) + +python.install_sources( + ['_backend/__init__.py', '_backend/cpp/__init__.py'], + subdir: 'pydatastructs/miscellaneous_data_structures/_backend' +) + +python.extension_module( + 'pydatastructs.miscellaneous_data_structures._backend.cpp._stack', + '_backend/cpp/stack/stack.cpp', + install: true, + subdir: 'pydatastructs/miscellaneous_data_structures' +) + +subdir('tests') diff --git a/pydatastructs/miscellaneous_data_structures/tests/meson.build b/pydatastructs/miscellaneous_data_structures/tests/meson.build new file mode 100644 index 00000000..9841338b --- /dev/null +++ b/pydatastructs/miscellaneous_data_structures/tests/meson.build @@ -0,0 +1,16 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + 'test_binomial_trees.py', + 'test_disjoint_set.py', + 'test_multiset.py', + 'test_queue.py', + 'test_range_query_dynamic.py', + 'test_range_query_static.py', + 'test_stack.py' + ], + subdir: 'pydatastructs/miscellaneous_data_structures/tests', + install_tag: 'tests' +) diff --git a/pydatastructs/strings/meson.build b/pydatastructs/strings/meson.build new file mode 100644 index 00000000..5a588232 --- /dev/null +++ b/pydatastructs/strings/meson.build @@ -0,0 +1,12 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + 'algorithms.py', + 'trie.py' + ], + subdir: 'pydatastructs/strings' +) + +subdir('tests') diff --git a/pydatastructs/strings/tests/meson.build b/pydatastructs/strings/tests/meson.build new file mode 100644 index 00000000..30f1da93 --- /dev/null +++ b/pydatastructs/strings/tests/meson.build @@ -0,0 +1,11 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + 'test_algorithms.py', + 'test_trie.py' + ], + subdir: 'pydatastructs/strings/tests', + install_tag: 'tests' +) diff --git a/pydatastructs/trees/meson.build b/pydatastructs/trees/meson.build new file mode 100644 index 00000000..d30cf494 --- /dev/null +++ b/pydatastructs/trees/meson.build @@ -0,0 +1,22 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + '_extensions.py', + 'binary_trees.py', + 'heaps.py', + 'm_ary_trees.py', + 'space_partitioning_trees.py' + ], + subdir: 'pydatastructs/trees' +) + +python.extension_module( + 'pydatastructs.trees._backend.cpp._trees', + '_backend/cpp/trees.cpp', + install: true, + subdir: 'pydatastructs/trees' +) + +subdir('tests') diff --git a/pydatastructs/trees/tests/meson.build b/pydatastructs/trees/tests/meson.build new file mode 100644 index 00000000..fcafdff3 --- /dev/null +++ b/pydatastructs/trees/tests/meson.build @@ -0,0 +1,14 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + 'benchmarks/test_binary_trees.py', + 'test_binary_trees.py', + 'test_heaps.py', + 'test_m_ary_trees.py', + 'test_space_partitioning_tree.py' + ], + subdir: 'pydatastructs/trees/tests', + install_tag: 'tests' +) diff --git a/pydatastructs/utils/meson.build b/pydatastructs/utils/meson.build new file mode 100644 index 00000000..17a285ee --- /dev/null +++ b/pydatastructs/utils/meson.build @@ -0,0 +1,28 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + '_extensions.py', + 'misc_util.py', + 'raises_util.py', + 'testing_util.py' + ], + subdir: 'pydatastructs/utils' +) + +python.extension_module( + 'pydatastructs.utils._backend.cpp._nodes', + '_backend/cpp/nodes.cpp', + install: true, + subdir: 'pydatastructs/utils' +) + +python.extension_module( + 'pydatastructs.utils._backend.cpp._graph_utils', + '_backend/cpp/graph_utils.cpp', + install: true, + subdir: 'pydatastructs/utils' +) + +subdir('tests') diff --git a/pydatastructs/utils/tests/meson.build b/pydatastructs/utils/tests/meson.build new file mode 100644 index 00000000..880f4098 --- /dev/null +++ b/pydatastructs/utils/tests/meson.build @@ -0,0 +1,11 @@ +python = import('python').find_installation(pure: false) + +python.install_sources( + [ + '__init__.py', + 'test_misc_util.py', + 'test_code_quality.py' + ], + subdir: 'pydatastructs/utils/tests', + install_tag: 'tests' +) diff --git a/pyproject.toml b/pyproject.toml index abbc7e15..e0a56a44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,10 @@ [build-system] requires = ["meson-python"] build-backend = "mesonpy" + +[tool.spin] +package = "pydatastructs" + +[tool.spin.commands] +Build = ["spin.cmds.meson.build"] +Test = ["spin.cmds.meson.test"] From 06182228320bab34b283acdd8532b1ebbecd93dd Mon Sep 17 00:00:00 2001 From: czgdp1807 Date: Sat, 26 Jul 2025 21:52:18 +0530 Subject: [PATCH 3/4] Use spin build system and update CI --- .github/workflows/ci.yml | 22 ++++++++++++------- environment.yml | 2 ++ pydatastructs/graphs/meson.build | 8 +++---- .../linear_data_structures/meson.build | 8 +++---- .../miscellaneous_data_structures/meson.build | 4 ++-- pydatastructs/trees/_backend/__init__.py | 0 pydatastructs/trees/_backend/cpp/__init__.py | 0 pydatastructs/trees/meson.build | 9 ++++++-- pydatastructs/utils/_backend/__init__.py | 0 pydatastructs/utils/_backend/cpp/__init__.py | 0 pydatastructs/utils/meson.build | 13 +++++++---- pyproject.toml | 7 ++++++ requirements.txt | 2 ++ 13 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 pydatastructs/trees/_backend/__init__.py create mode 100644 pydatastructs/trees/_backend/cpp/__init__.py create mode 100644 pydatastructs/utils/_backend/__init__.py create mode 100644 pydatastructs/utils/_backend/cpp/__init__.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27343bb9..c1b99553 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,12 +40,15 @@ jobs: sudo apt-get install -y lcov - name: Build package + env: + CXXFLAGS: "-std=c++17 --coverage" + CFLAGS: "--coverage" run: | - CXXFLAGS="-std=c++17 --coverage" CFLAGS="--coverage" python scripts/build/install.py + spin build -v # coverage tests - name: Run tests run: | - python -m pytest --doctest-modules --cov=./ --cov-report=xml -s + spin test -v - name: Capture Coverage Data with lcov run: | @@ -101,12 +104,14 @@ jobs: python -m pip install -r docs/requirements.txt - name: Build package + env: + CXXFLAGS: "-std=c++17" run: | - CXXFLAGS="-std=c++17" python scripts/build/install.py + spin build -v - name: Run tests run: | - python -c "import pydatastructs; pydatastructs.test(only_benchmarks=True)" + spin test -v - name: Build Documentation run: | @@ -144,11 +149,12 @@ jobs: - name: Build package env: MACOSX_DEPLOYMENT_TARGET: 11.0 + CXXFLAGS: "-std=c++17" run: | - CXXFLAGS="-std=c++17" python scripts/build/install.py + spin build -v - name: Run tests run: | - python -c "import pydatastructs; pydatastructs.test()" + spin test -v - name: Build Documentation run: | @@ -194,11 +200,11 @@ jobs: env: CL: "/std:c++17" run: | - python scripts/build/install.py + spin build -v - name: Run tests run: | - python -c "import pydatastructs; pydatastructs.test()" + spin test -v - name: Build Documentation run: | diff --git a/environment.yml b/environment.yml index 2d2ce160..f08245fb 100644 --- a/environment.yml +++ b/environment.yml @@ -9,6 +9,8 @@ dependencies: - pip: - codecov - pytest-cov + - spin + - meson - sphinx==5.0 - sphinx-readable-theme==1.3.0 - myst_nb==0.17.2 diff --git a/pydatastructs/graphs/meson.build b/pydatastructs/graphs/meson.build index ecd83290..50c3a3fe 100644 --- a/pydatastructs/graphs/meson.build +++ b/pydatastructs/graphs/meson.build @@ -20,19 +20,19 @@ python.install_sources( py_include = include_directories('../utils/_backend/cpp') python.extension_module( - 'pydatastructs.graphs._backend.cpp._graph', + '_graph', '_backend/cpp/graph.cpp', include_directories: py_include, install: true, - subdir: 'pydatastructs/graphs' + subdir: 'pydatastructs/graphs/_backend/cpp' ) python.extension_module( - 'pydatastructs.graphs._backend.cpp._algorithms', + '_algorithms', '_backend/cpp/algorithms.cpp', include_directories: py_include, install: true, - subdir: 'pydatastructs/graphs' + subdir: 'pydatastructs/graphs/_backend/cpp' ) subdir('tests') diff --git a/pydatastructs/linear_data_structures/meson.build b/pydatastructs/linear_data_structures/meson.build index bf30078d..50bf3b77 100644 --- a/pydatastructs/linear_data_structures/meson.build +++ b/pydatastructs/linear_data_structures/meson.build @@ -17,17 +17,17 @@ python.install_sources( ) python.extension_module( - 'pydatastructs.linear_data_structures._backend.cpp._arrays', + '_arrays', '_backend/cpp/arrays/arrays.cpp', install: true, - subdir: 'pydatastructs/linear_data_structures' + subdir: 'pydatastructs/linear_data_structures/_backend/cpp' ) python.extension_module( - 'pydatastructs.linear_data_structures._backend.cpp._algorithms', + '_algorithms', '_backend/cpp/algorithms/algorithms.cpp', install: true, - subdir: 'pydatastructs/linear_data_structures' + subdir: 'pydatastructs/linear_data_structures/_backend/cpp' ) subdir('tests') diff --git a/pydatastructs/miscellaneous_data_structures/meson.build b/pydatastructs/miscellaneous_data_structures/meson.build index 0cbe0695..d6872ff2 100644 --- a/pydatastructs/miscellaneous_data_structures/meson.build +++ b/pydatastructs/miscellaneous_data_structures/meson.build @@ -22,10 +22,10 @@ python.install_sources( ) python.extension_module( - 'pydatastructs.miscellaneous_data_structures._backend.cpp._stack', + '_stack', '_backend/cpp/stack/stack.cpp', install: true, - subdir: 'pydatastructs/miscellaneous_data_structures' + subdir: 'pydatastructs/miscellaneous_data_structures/_backend/cpp' ) subdir('tests') diff --git a/pydatastructs/trees/_backend/__init__.py b/pydatastructs/trees/_backend/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pydatastructs/trees/_backend/cpp/__init__.py b/pydatastructs/trees/_backend/cpp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pydatastructs/trees/meson.build b/pydatastructs/trees/meson.build index d30cf494..fac490cd 100644 --- a/pydatastructs/trees/meson.build +++ b/pydatastructs/trees/meson.build @@ -12,11 +12,16 @@ python.install_sources( subdir: 'pydatastructs/trees' ) +python.install_sources( + ['_backend/__init__.py', '_backend/cpp/__init__.py'], + subdir: 'pydatastructs/trees/_backend' +) + python.extension_module( - 'pydatastructs.trees._backend.cpp._trees', + '_trees', '_backend/cpp/trees.cpp', install: true, - subdir: 'pydatastructs/trees' + subdir: 'pydatastructs/trees/_backend/cpp' ) subdir('tests') diff --git a/pydatastructs/utils/_backend/__init__.py b/pydatastructs/utils/_backend/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pydatastructs/utils/_backend/cpp/__init__.py b/pydatastructs/utils/_backend/cpp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pydatastructs/utils/meson.build b/pydatastructs/utils/meson.build index 17a285ee..a2f9be4c 100644 --- a/pydatastructs/utils/meson.build +++ b/pydatastructs/utils/meson.build @@ -11,18 +11,23 @@ python.install_sources( subdir: 'pydatastructs/utils' ) +python.install_sources( + ['_backend/__init__.py', '_backend/cpp/__init__.py'], + subdir: 'pydatastructs/utils/_backend' +) + python.extension_module( - 'pydatastructs.utils._backend.cpp._nodes', + '_nodes', '_backend/cpp/nodes.cpp', install: true, - subdir: 'pydatastructs/utils' + subdir: 'pydatastructs/utils/_backend/cpp' ) python.extension_module( - 'pydatastructs.utils._backend.cpp._graph_utils', + '_graph_utils', '_backend/cpp/graph_utils.cpp', install: true, - subdir: 'pydatastructs/utils' + subdir: 'pydatastructs/utils/_backend/cpp' ) subdir('tests') diff --git a/pyproject.toml b/pyproject.toml index e0a56a44..c2ee4144 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,13 @@ requires = ["meson-python"] build-backend = "mesonpy" +[project] +name = "pydatastructs" +version = "1.0.1.dev0" +description = "Data structures and algorithms implemented using Python and C++" +readme = "README.md" +requires-python = ">=3.8" + [tool.spin] package = "pydatastructs" diff --git a/requirements.txt b/requirements.txt index a8b867d7..9855a419 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ codecov pytest pytest-cov +spin +meson From 1b0790295e2f09e2818e1dc20c228cfaf84d6218 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Sat, 26 Jul 2025 23:32:14 +0530 Subject: [PATCH 4/4] Remove _extensions.py dummy installation --- pydatastructs/graphs/__init__.py | 1 - pydatastructs/graphs/meson.build | 1 - pydatastructs/linear_data_structures/__init__.py | 1 - pydatastructs/linear_data_structures/meson.build | 1 - pydatastructs/miscellaneous_data_structures/__init__.py | 1 - pydatastructs/miscellaneous_data_structures/meson.build | 1 - pydatastructs/trees/__init__.py | 1 - pydatastructs/trees/meson.build | 1 - pydatastructs/utils/__init__.py | 1 - pydatastructs/utils/meson.build | 1 - 10 files changed, 10 deletions(-) diff --git a/pydatastructs/graphs/__init__.py b/pydatastructs/graphs/__init__.py index c1a70574..21e0a5f3 100644 --- a/pydatastructs/graphs/__init__.py +++ b/pydatastructs/graphs/__init__.py @@ -9,7 +9,6 @@ from . import algorithms from . import adjacency_list from . import adjacency_matrix -from . import _extensions from .algorithms import ( breadth_first_search, diff --git a/pydatastructs/graphs/meson.build b/pydatastructs/graphs/meson.build index 50c3a3fe..2878bc18 100644 --- a/pydatastructs/graphs/meson.build +++ b/pydatastructs/graphs/meson.build @@ -3,7 +3,6 @@ python = import('python').find_installation(pure: false) python.install_sources( [ '__init__.py', - '_extensions.py', 'adjacency_list.py', 'adjacency_matrix.py', 'algorithms.py', diff --git a/pydatastructs/linear_data_structures/__init__.py b/pydatastructs/linear_data_structures/__init__.py index de247b88..c6b3341d 100644 --- a/pydatastructs/linear_data_structures/__init__.py +++ b/pydatastructs/linear_data_structures/__init__.py @@ -4,7 +4,6 @@ arrays, linked_lists, algorithms, - _extensions ) from .arrays import ( diff --git a/pydatastructs/linear_data_structures/meson.build b/pydatastructs/linear_data_structures/meson.build index 50bf3b77..fca4004c 100644 --- a/pydatastructs/linear_data_structures/meson.build +++ b/pydatastructs/linear_data_structures/meson.build @@ -3,7 +3,6 @@ python = import('python').find_installation(pure: false) python.install_sources( [ '__init__.py', - '_extensions.py', 'algorithms.py', 'arrays.py', 'linked_lists.py' diff --git a/pydatastructs/miscellaneous_data_structures/__init__.py b/pydatastructs/miscellaneous_data_structures/__init__.py index 60754c41..6ed09976 100644 --- a/pydatastructs/miscellaneous_data_structures/__init__.py +++ b/pydatastructs/miscellaneous_data_structures/__init__.py @@ -6,7 +6,6 @@ queue, disjoint_set, sparse_table, - _extensions, ) from .binomial_trees import ( diff --git a/pydatastructs/miscellaneous_data_structures/meson.build b/pydatastructs/miscellaneous_data_structures/meson.build index d6872ff2..644ec7e3 100644 --- a/pydatastructs/miscellaneous_data_structures/meson.build +++ b/pydatastructs/miscellaneous_data_structures/meson.build @@ -3,7 +3,6 @@ python = import('python').find_installation(pure: false) python.install_sources( [ '__init__.py', - '_extensions.py', 'algorithms.py', 'multiset.py', 'sparse_table.py', diff --git a/pydatastructs/trees/__init__.py b/pydatastructs/trees/__init__.py index 1c99cca2..89273012 100644 --- a/pydatastructs/trees/__init__.py +++ b/pydatastructs/trees/__init__.py @@ -5,7 +5,6 @@ m_ary_trees, space_partitioning_trees, heaps, - _extensions ) from .binary_trees import ( diff --git a/pydatastructs/trees/meson.build b/pydatastructs/trees/meson.build index fac490cd..bcaae16a 100644 --- a/pydatastructs/trees/meson.build +++ b/pydatastructs/trees/meson.build @@ -3,7 +3,6 @@ python = import('python').find_installation(pure: false) python.install_sources( [ '__init__.py', - '_extensions.py', 'binary_trees.py', 'heaps.py', 'm_ary_trees.py', diff --git a/pydatastructs/utils/__init__.py b/pydatastructs/utils/__init__.py index 20a8c750..c4971be3 100644 --- a/pydatastructs/utils/__init__.py +++ b/pydatastructs/utils/__init__.py @@ -3,7 +3,6 @@ from . import ( misc_util, testing_util, - _extensions ) from .misc_util import ( diff --git a/pydatastructs/utils/meson.build b/pydatastructs/utils/meson.build index a2f9be4c..cdc46602 100644 --- a/pydatastructs/utils/meson.build +++ b/pydatastructs/utils/meson.build @@ -3,7 +3,6 @@ python = import('python').find_installation(pure: false) python.install_sources( [ '__init__.py', - '_extensions.py', 'misc_util.py', 'raises_util.py', 'testing_util.py'