scisoftdev-tmp-HiPOP 1.0.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 (48) hide show
  1. scisoftdev_tmp_hipop-1.0.2/.github/workflows/ci.yaml +53 -0
  2. scisoftdev_tmp_hipop-1.0.2/.github/workflows/deploy.yaml +89 -0
  3. scisoftdev_tmp_hipop-1.0.2/.gitignore +30 -0
  4. scisoftdev_tmp_hipop-1.0.2/CMakeLists.txt +50 -0
  5. scisoftdev_tmp_hipop-1.0.2/LICENSE +165 -0
  6. scisoftdev_tmp_hipop-1.0.2/PKG-INFO +64 -0
  7. scisoftdev_tmp_hipop-1.0.2/README.md +53 -0
  8. scisoftdev_tmp_hipop-1.0.2/bump_version.py +48 -0
  9. scisoftdev_tmp_hipop-1.0.2/conda/env.yaml +17 -0
  10. scisoftdev_tmp_hipop-1.0.2/conda/recipe/README.md +11 -0
  11. scisoftdev_tmp_hipop-1.0.2/conda/recipe/build-hipoplib.sh +16 -0
  12. scisoftdev_tmp_hipop-1.0.2/conda/recipe/meta.yaml +57 -0
  13. scisoftdev_tmp_hipop-1.0.2/cpp/CMakeLists.txt +86 -0
  14. scisoftdev_tmp_hipop-1.0.2/cpp/cmake/HipopConfig.cmake.in +7 -0
  15. scisoftdev_tmp_hipop-1.0.2/cpp/examples/CMakeLists.txt +2 -0
  16. scisoftdev_tmp_hipop-1.0.2/cpp/examples/ParallelKShortestPath.cpp +73 -0
  17. scisoftdev_tmp_hipop-1.0.2/cpp/include/hipop/create.h +11 -0
  18. scisoftdev_tmp_hipop-1.0.2/cpp/include/hipop/graph.h +175 -0
  19. scisoftdev_tmp_hipop-1.0.2/cpp/include/hipop/shortest_path.h +137 -0
  20. scisoftdev_tmp_hipop-1.0.2/cpp/src/create.cpp +122 -0
  21. scisoftdev_tmp_hipop-1.0.2/cpp/src/graph.cpp +292 -0
  22. scisoftdev_tmp_hipop-1.0.2/cpp/src/shortest_path.cpp +1552 -0
  23. scisoftdev_tmp_hipop-1.0.2/cpp/tests/CMakeLists.txt +22 -0
  24. scisoftdev_tmp_hipop-1.0.2/cpp/tests/helpers.h +15 -0
  25. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testCopyGraph.cpp +37 -0
  26. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testDijkstra1.cpp +28 -0
  27. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testDijkstra2.cpp +28 -0
  28. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testGraph.cpp +37 -0
  29. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testGraphMerge.cpp +46 -0
  30. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testKShortestPath.cpp +41 -0
  31. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testManhattan.cpp +11 -0
  32. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testYenKShortestPath.cpp +43 -0
  33. scisoftdev_tmp_hipop-1.0.2/cpp/tests/testparallelKShortestPath.cpp +42 -0
  34. scisoftdev_tmp_hipop-1.0.2/pyproject.toml +78 -0
  35. scisoftdev_tmp_hipop-1.0.2/pytest.toml +8 -0
  36. scisoftdev_tmp_hipop-1.0.2/python/CMakeLists.txt +11 -0
  37. scisoftdev_tmp_hipop-1.0.2/python/examples/UpdateCosts.py +80 -0
  38. scisoftdev_tmp_hipop-1.0.2/python/examples/ksp.py +53 -0
  39. scisoftdev_tmp_hipop-1.0.2/python/examples/merge.py +25 -0
  40. scisoftdev_tmp_hipop-1.0.2/python/examples/test.py +28 -0
  41. scisoftdev_tmp_hipop-1.0.2/python/hipop/__init__.py +1 -0
  42. scisoftdev_tmp_hipop-1.0.2/python/hipop/cpp/graph.cpp +58 -0
  43. scisoftdev_tmp_hipop-1.0.2/python/hipop/cpp/main.cpp +23 -0
  44. scisoftdev_tmp_hipop-1.0.2/python/hipop/cpp/shortest_path.cpp +90 -0
  45. scisoftdev_tmp_hipop-1.0.2/python/hipop/graph.py +66 -0
  46. scisoftdev_tmp_hipop-1.0.2/python/hipop/render.py +28 -0
  47. scisoftdev_tmp_hipop-1.0.2/python/hipop/shortest_path.py +1 -0
  48. scisoftdev_tmp_hipop-1.0.2/python/tests/test_Graph.py +24 -0
@@ -0,0 +1,53 @@
1
+ name: Continuous integration checks
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - 'feature/**' # TODO remove feature/* once the workflow is stable
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ build-and-test:
13
+ name: Build & run tests (${{ matrix.os }})
14
+ runs-on: ${{ matrix.os }}
15
+
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: # See https://docs.github.com/en/actions/reference/runners/github-hosted-runners
20
+ - ubuntu-latest # Arch: x64
21
+ - windows-latest # Arch: x64
22
+ - macos-latest # Arch: arm64
23
+
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+
27
+ - uses: actions/setup-python@v7
28
+ with:
29
+ python-version: '3.10'
30
+
31
+ - name: Install OpenMP (macOS only)
32
+ if: runner.os == 'macOS'
33
+ # AppleClang has no OpenMP by default, thus it must be installed separately.
34
+ # The environment variable OpenMP_ROOT is then exported for subsequent steps
35
+ # (CMake uses this variable as a search hint).
36
+ run: |
37
+ brew install libomp
38
+ echo "OpenMP_ROOT=$(brew --prefix libomp)" >> "$GITHUB_ENV"
39
+
40
+ - name: C++ core library - Configure
41
+ run: cmake -S . -B build-cpponly -G Ninja
42
+
43
+ - name: C++ core library - Build
44
+ run: cmake --build build-cpponly
45
+
46
+ - name: C++ core library - Run tests
47
+ run: ctest --test-dir build-cpponly --output-on-failure --no-tests=error
48
+
49
+ - name: Python wrapper - Build & install
50
+ run: pip install --group dev .
51
+
52
+ - name: Python wrapper - Run tests
53
+ run: pytest
@@ -0,0 +1,89 @@
1
+ name: Deploy to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - 'feature/**' # TODO remove feature/* once the workflow is stable
7
+ # TODO define the trigger with EMobLab once the workflow is stable
8
+
9
+ jobs:
10
+
11
+ build-wheels:
12
+ name: Build wheels (${{ matrix.os }})
13
+ runs-on: ${{ matrix.os }}
14
+
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ os: # See https://docs.github.com/en/actions/reference/runners/github-hosted-runners
19
+ - ubuntu-latest # Arch: x64
20
+ # TODO re-enable - windows-latest # Arch: x64
21
+ # TODO re-enable - macos-14 # Arch: arm64
22
+ # Do not use the latest macOS runner to ensure backward compatibility.
23
+ # See comment on MACOSX_DEPLOYMENT_TARGET in pyproject.toml for more details.
24
+
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+
28
+ - uses: actions/setup-python@v7
29
+ with:
30
+ python-version: '3.x' # The exact Python version is not important here.
31
+
32
+ - name: Build wheels
33
+ run: |
34
+ pip install --group distrib
35
+ python -m cibuildwheel
36
+
37
+ - uses: actions/upload-artifact@v7
38
+ with:
39
+ name: wheels-${{ matrix.os }}
40
+ path: ./wheelhouse/*.whl
41
+
42
+ build-sdist:
43
+ name: Build source distribution
44
+ runs-on: ubuntu-latest
45
+
46
+ steps:
47
+ - uses: actions/checkout@v7
48
+
49
+ - uses: actions/setup-python@v7
50
+ with:
51
+ python-version: '3.x' # The exact Python version is not important here.
52
+
53
+ - name: Build sdist
54
+ run: |
55
+ pip install --group distrib
56
+ python -m build --sdist
57
+
58
+ - uses: actions/upload-artifact@v7
59
+ with:
60
+ name: sdist
61
+ path: ./dist/*.tar.gz
62
+
63
+ publish:
64
+ name: Publish to PyPI
65
+ runs-on: ubuntu-latest
66
+ needs:
67
+ - build-wheels
68
+ - build-sdist
69
+ # TODO keep? if: github.event_name == 'release'
70
+
71
+ environment:
72
+ name: pypi-env
73
+ url: https://pypi.org/project/scisoftdev-tmp-HiPOP # TODO fix project name in URL
74
+
75
+ permissions:
76
+ id-token: write # Required for authentication through OIDC.
77
+
78
+ steps:
79
+ - uses: actions/download-artifact@v8
80
+ with:
81
+ path: dist
82
+ merge-multiple: true
83
+
84
+ - name: Debug # TODO to remove
85
+ run: |
86
+ ls -al dist
87
+
88
+ - name: Publish package distributions to PyPI
89
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,30 @@
1
+ # Keep the following list of files/directories to exclude from version control as small as possible.
2
+ # Only patterns relevant for the current project should appear in this list.
3
+
4
+ # Python bytecode directories
5
+ __pycache__/
6
+
7
+ # Output directories for Python distribution files (wheels & source distributions)
8
+ /dist/
9
+ /wheelhouse/
10
+
11
+ # Python virtual environments (usual names)
12
+ env/
13
+ venv/
14
+ .env/
15
+ .venv/
16
+ env[_\-]*/
17
+ venv[_\-]*/
18
+ .env[_\-]*/
19
+ .venv[_\-]*/
20
+
21
+ # CMake build directories (usual names)
22
+ build/
23
+ build[_\-]*/
24
+
25
+ # MacOS files
26
+ .DS_Store
27
+
28
+ # IDE files
29
+ .vscode/
30
+ .idea/
@@ -0,0 +1,50 @@
1
+ cmake_minimum_required(VERSION 3.19)
2
+
3
+ project(HiPOP
4
+ VERSION 0.0.3 # TODO synchronize version number with pyproject.toml
5
+ DESCRIPTION "High Performance Optimal Path module"
6
+ HOMEPAGE_URL "https://github.com/EMob-Lab/HiPOP"
7
+ LANGUAGES CXX
8
+ )
9
+
10
+ option(HIPOP_WITH_PYTHON "Compile Python wrapper" OFF) # Disabled by default, so that pybind11 is not required then.
11
+ option(HIPOP_WITH_TESTS "Compile HiPOP tests (for core library)" ON)
12
+ option(HIPOP_WITH_EXAMPLES "Compile HiPOP examples (for core library)" ON)
13
+
14
+ # Default build configuration.
15
+ # Can be overriden with `-DCMAKE_BUILD_TYPE=<Debug|RelWithDebInfo|Release|...>` when calling CMake.
16
+ if(NOT CMAKE_BUILD_TYPE)
17
+ set(CMAKE_BUILD_TYPE Release)
18
+ endif()
19
+ message(STATUS "CMAKE_BUILD_TYPE set to [${CMAKE_BUILD_TYPE}]")
20
+
21
+ # Default C++ standard for all the targets in the project.
22
+ # Can be overriden with `-DCMAKE_CXX_STANDARD=...` when calling CMake (but should be at least the default value).
23
+ if(NOT CMAKE_CXX_STANDARD)
24
+ set(CMAKE_CXX_STANDARD 17)
25
+ endif()
26
+ message(STATUS "CMAKE_CXX_STANDARD set to [${CMAKE_CXX_STANDARD}]")
27
+
28
+ # 3rd-party dependencies.
29
+ find_package(OpenMP REQUIRED)
30
+ if(HIPOP_WITH_PYTHON)
31
+ set(PYBIND11_FINDPYTHON ON) # See: https://pybind11.readthedocs.io/en/stable/cmake/#modes
32
+ find_package(pybind11 REQUIRED)
33
+ endif()
34
+
35
+ # Enable CTest and related testing features if requested
36
+ # (must be done before adding the subdirectories).
37
+ if(HIPOP_WITH_TESTS)
38
+ enable_testing()
39
+ endif()
40
+
41
+ # `cpp` subdirectory -> C++ library with related tests and examples, excluding the Python wrapper.
42
+ message(STATUS "Building HiPOP core library")
43
+ add_subdirectory(cpp)
44
+
45
+ # `python` subdirectory -> Python wrapper (the tests and examples specific to the Python wrapper
46
+ # are pure Python scripts, thus no compilation is needed for them).
47
+ if(HIPOP_WITH_PYTHON)
48
+ message(STATUS "Building HiPOP Python wrapper")
49
+ add_subdirectory(python)
50
+ endif()
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: scisoftdev-tmp-HiPOP
3
+ Version: 1.0.2
4
+ Summary: High Performance Optimal Path module
5
+ License-Expression: LGPL-3.0-only
6
+ License-File: LICENSE
7
+ Project-URL: Repository, https://github.com/EMob-Lab/HiPOP
8
+ Project-URL: Issues, https://github.com/EMob-Lab/HiPOP/issues
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+
12
+ # HiPOP
13
+ High Performance Optimal Path module
14
+
15
+ ## Install Hipop
16
+
17
+ HiPOP is the C++ graph library used by [MnMS](https://github.com/EMob-Lab/MnMS.git).
18
+ You must have `CMake` and `make` installed on your computer.
19
+
20
+ ## WARNING
21
+ If you are using MacOS ARM64, install the openmp library using Homebrew:
22
+ ```shell
23
+ brew install libomp
24
+ ```
25
+
26
+ ### C++ only
27
+
28
+ Inside your conda environment go to the cpp folder, and install the code using cmake:
29
+
30
+ ```shell
31
+ cd cpp
32
+ mkdir build
33
+ cd build
34
+ cmake .. -DCMAKE_PREFIX_PATH=<PREFIX>\
35
+ -DCMAKE_INSTALL_PREFIX=<PREFIX>\
36
+ -DCMAKE_BUILD_TYPE=Release\
37
+ -DBUILD_TESTS=ON
38
+ cmake --build . --target install --config Release
39
+ ```
40
+ Where `<PREFIX>` is the path to your prefix.
41
+
42
+ If you used conda to install the dependencies, replace it by `$CONDA_PREFIX`.
43
+
44
+ If you used venv to install the dependencies, replace it by the path to your venv.
45
+
46
+ You can then lauch the tests in the `build` directory:
47
+
48
+ ```shell
49
+ ctest --output-on-failure
50
+ ```
51
+
52
+
53
+ ### Python
54
+
55
+ To install C++ code use the script `install_cpp.py`:
56
+
57
+ ```shell
58
+ python python/install_cpp.py
59
+ ```
60
+
61
+ Then install the python lib:
62
+ ```shell
63
+ python -m pip install python/
64
+ ```
@@ -0,0 +1,53 @@
1
+ # HiPOP
2
+ High Performance Optimal Path module
3
+
4
+ ## Install Hipop
5
+
6
+ HiPOP is the C++ graph library used by [MnMS](https://github.com/EMob-Lab/MnMS.git).
7
+ You must have `CMake` and `make` installed on your computer.
8
+
9
+ ## WARNING
10
+ If you are using MacOS ARM64, install the openmp library using Homebrew:
11
+ ```shell
12
+ brew install libomp
13
+ ```
14
+
15
+ ### C++ only
16
+
17
+ Inside your conda environment go to the cpp folder, and install the code using cmake:
18
+
19
+ ```shell
20
+ cd cpp
21
+ mkdir build
22
+ cd build
23
+ cmake .. -DCMAKE_PREFIX_PATH=<PREFIX>\
24
+ -DCMAKE_INSTALL_PREFIX=<PREFIX>\
25
+ -DCMAKE_BUILD_TYPE=Release\
26
+ -DBUILD_TESTS=ON
27
+ cmake --build . --target install --config Release
28
+ ```
29
+ Where `<PREFIX>` is the path to your prefix.
30
+
31
+ If you used conda to install the dependencies, replace it by `$CONDA_PREFIX`.
32
+
33
+ If you used venv to install the dependencies, replace it by the path to your venv.
34
+
35
+ You can then lauch the tests in the `build` directory:
36
+
37
+ ```shell
38
+ ctest --output-on-failure
39
+ ```
40
+
41
+
42
+ ### Python
43
+
44
+ To install C++ code use the script `install_cpp.py`:
45
+
46
+ ```shell
47
+ python python/install_cpp.py
48
+ ```
49
+
50
+ Then install the python lib:
51
+ ```shell
52
+ python -m pip install python/
53
+ ```
@@ -0,0 +1,48 @@
1
+ import re
2
+ from pathlib import Path
3
+ import argparse
4
+
5
+ PATTERN_VERSION = r"\d+\.\d+\.\d+"
6
+
7
+ files = [("cpp/CMakeLists.txt", re.compile(rf"(project\(HiPOP VERSION )({PATTERN_VERSION})(\))")),
8
+ ("python/hipop/__init__.py", re.compile(rf'(__version__ = ")({PATTERN_VERSION})(")')),
9
+ ("conda/recipe/meta.yaml", re.compile(r'({% set version = ")('+PATTERN_VERSION+r')(" %})'))]
10
+
11
+
12
+ def read(file):
13
+ with open(file, "r") as f:
14
+ contents = f.read()
15
+ return contents
16
+
17
+
18
+ def write(file, new_contents):
19
+ with open(file, "w") as f:
20
+ f.write(new_contents)
21
+
22
+
23
+ cwd = Path(__file__).parent.resolve()
24
+
25
+
26
+ def show_diff(contents, new_contents):
27
+ for i, (lc, lnc) in enumerate(zip(contents.split("\n"), new_contents.split("\n"))):
28
+ if lc != lnc:
29
+ print(f"\tline {i}: {lc} -> {lnc}")
30
+
31
+
32
+ if __name__ == "__main__":
33
+ import argparse
34
+ parser = argparse.ArgumentParser()
35
+ parser.add_argument('MAJOR', help='major version number', type=int)
36
+ parser.add_argument('MINOR', help='minor version number', type=int)
37
+ parser.add_argument('PATCH', help='patch version number', type=int)
38
+ args = parser.parse_args()
39
+
40
+ new_version = f"{args.MAJOR}.{args.MINOR}.{args.PATCH}"
41
+
42
+ for f, pattern in files:
43
+ print("Bumping version in file:", f)
44
+ f_path = cwd.joinpath(f)
45
+ contents = read(f_path)
46
+ new_contents = pattern.sub(f"\g<1>{new_version}\g<3>", contents, count=1)
47
+ show_diff(contents, new_contents)
48
+ write(f_path, new_contents)
@@ -0,0 +1,17 @@
1
+ # Development / CI environment for HiPOP.
2
+ #
3
+ # Usage:
4
+ # conda create -f conda/env.yaml # Only once, to create the environment.
5
+ # conda activate hipop-dev # Each time you want to work on HiPOP.
6
+ #
7
+ name: hipop-dev
8
+ channels:
9
+ - conda-forge
10
+ - nodefaults # Disable the default Anaconda channel. TODO still some warnings in CI logs...
11
+ dependencies:
12
+ - cxx-compiler
13
+ - cmake
14
+ - ninja
15
+ - llvm-openmp
16
+ - pip
17
+ - python=3.10
@@ -0,0 +1,11 @@
1
+ # Build conda pkgs
2
+
3
+ You need to have the conda package `conda-build` installed in your `base` environment.
4
+
5
+ At the root of `hipop` run the following command inside a terminal:
6
+
7
+ ```shell
8
+ conda build . -c conda-forge --output-folder conda-bld
9
+ ```
10
+
11
+ If it is a success, you will find the package inside the `conda-bld` folder.
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ set -ex
3
+
4
+ cd cpp
5
+
6
+ cmake \
7
+ -DCMAKE_PREFIX_PATH=$PREFIX\
8
+ -DCMAKE_INSTALL_PREFIX=$PREFIX\
9
+ -DBUILD_TESTS=ON\
10
+ -DCMAKE_BUILD_TYPE=Release\
11
+ -B build
12
+
13
+ cmake --build build --parallel "${CPU_COUNT}"
14
+ cmake --install build --config Release
15
+
16
+ cd build && ctest
@@ -0,0 +1,57 @@
1
+ {% set version = "0.0.3" %}
2
+ package:
3
+ name: hipop-pkgs
4
+ version: {{ version }}
5
+
6
+ source:
7
+ path: ../..
8
+
9
+ build:
10
+ number: 0
11
+ skip: true # [win]
12
+
13
+ outputs:
14
+ - name: hipoplib
15
+ version: {{ version }}
16
+ build:
17
+ script: ${RECIPE_DIR}/build-hipoplib.sh
18
+ requirements:
19
+ build:
20
+ - {{ compiler('cxx') }}
21
+ - make
22
+ - cmake
23
+ - openmp
24
+ test:
25
+ script: ${RECIPE_DIR}/test-hipoplib.sh
26
+
27
+ - name: hipop
28
+ version: {{ version }}
29
+ build:
30
+ script: $PYTHON -m pip install --no-deps ./python
31
+ requirements:
32
+ build:
33
+ - {{ compiler('cxx') }}
34
+ - make
35
+ - cmake
36
+ - python=3.10
37
+ host:
38
+ - python=3.10
39
+ - hipoplib
40
+ - pybind11
41
+ run:
42
+ - python=3.10
43
+ - hipoplib
44
+ - numpy
45
+ - matplotlib
46
+ test:
47
+ imports:
48
+ - hipop.cpp
49
+
50
+ about:
51
+ # license: LGPL 3.0
52
+ # license_file:
53
+ summary: 'HiPOP is a graph implementation for traffic simulation in C++ with python bindings.'
54
+ description: |
55
+ HiPOP is a graph implementation for traffic simulation in C++ with python bindings.
56
+ # doc_url:
57
+ dev_url: https://github.com/licit-lab/HiPOP