meshkernel 2.0.1__tar.gz → 2.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.
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: meshkernel
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: `meshkernel` is a library which can be used to manipulate meshes.
5
5
  Home-page: https://github.com/Deltares/MeshKernelPy
6
- Author: Julian Hofer, Prisca van der Sluis
7
- Author-email: julian.hofer@deltares.nl, prisca.vandersluis@deltares.nl
6
+ Author: Julian Hofer, Prisca van der Sluis, Luca Carniato
7
+ Author-email: julian.hofer@deltares.nl, prisca.vandersluis@deltares.nl, luca.carniato@deltares.nl
8
8
  License: MIT
9
9
  Platform: Windows
10
10
  Platform: Linux
@@ -83,3 +83,26 @@ Then add a compiled `MeshKernelApi.dll` into your `src` folder.
83
83
 
84
84
  Also make sure that your editor is configured to format the code with [`black`](https://black.readthedocs.io/en/stable/) and [`isort`](https://pycqa.github.io/isort/).
85
85
  When modifying `Jupyter` notebooks, the [`jupyterlab-code-formatter`](https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html) can be used.
86
+
87
+ # Building linux wheels
88
+
89
+ To deploy Linux wheels to PyPI, we provide a Docker image that is based on manylinux2014_x86_64.
90
+ This image includes cmake and boost, which are necessary for compiling the native MeshKernel library (written in C++).
91
+ To build the Docker image, please follow these steps:
92
+
93
+ ```powershell
94
+ cd scripts
95
+ docker build --progress=plain ./scripts -t build_linux_library
96
+ cd ..
97
+ ```
98
+
99
+ Once the Docker image has been built, build the linux wheels using the following command:
100
+
101
+ ```powershell
102
+ docker run -v %cd%:/root --rm build_linux_library
103
+ ```
104
+
105
+ The deployable linux wheels will be located in dist/wheelhouse
106
+
107
+
108
+
@@ -65,3 +65,24 @@ Then add a compiled `MeshKernelApi.dll` into your `src` folder.
65
65
 
66
66
  Also make sure that your editor is configured to format the code with [`black`](https://black.readthedocs.io/en/stable/) and [`isort`](https://pycqa.github.io/isort/).
67
67
  When modifying `Jupyter` notebooks, the [`jupyterlab-code-formatter`](https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html) can be used.
68
+
69
+ # Building linux wheels
70
+
71
+ To deploy Linux wheels to PyPI, we provide a Docker image that is based on manylinux2014_x86_64.
72
+ This image includes cmake and boost, which are necessary for compiling the native MeshKernel library (written in C++).
73
+ To build the Docker image, please follow these steps:
74
+
75
+ ```powershell
76
+ cd scripts
77
+ docker build --progress=plain ./scripts -t build_linux_library
78
+ cd ..
79
+ ```
80
+
81
+ Once the Docker image has been built, build the linux wheels using the following command:
82
+
83
+ ```powershell
84
+ docker run -v %cd%:/root --rm build_linux_library
85
+ ```
86
+
87
+ The deployable linux wheels will be located in dist/wheelhouse
88
+
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ import os
2
3
  import platform
3
4
  from ctypes import CDLL, byref, c_char_p, c_double, c_int, c_size_t
4
5
  from enum import IntEnum, unique
@@ -66,13 +67,15 @@ class MeshKernel:
66
67
 
67
68
  # Determine OS
68
69
  system = platform.system()
70
+
71
+ file_path = Path(__file__).parent
69
72
  if system == "Windows":
70
- lib_path = Path(__file__).parent / "MeshKernelApi.dll"
73
+ lib_path = os.path.join(file_path, "MeshKernelApi.dll")
71
74
  elif system == "Linux":
72
- lib_path = Path(__file__).parent / "libMeshKernelApi.so"
73
- elif system == "Darwin":
74
- lib_path = Path(__file__).parent / "libMeshKernelApi.dylib"
75
+ lib_path = os.path.join(file_path, "libMeshKernelApi.so")
75
76
  else:
77
+ if not str:
78
+ system = "Unknown OS"
76
79
  raise OSError(f"Unsupported operating system: {system}")
77
80
 
78
81
  self.lib = CDLL(str(lib_path))
@@ -1421,8 +1424,8 @@ class MeshKernel:
1421
1424
  self._execute_function(
1422
1425
  self.lib.mkernel_curvilinear_make_uniform,
1423
1426
  self._meshkernelid,
1424
- c_make_grid_parameters,
1425
- c_geometry_list,
1427
+ byref(c_make_grid_parameters),
1428
+ byref(c_geometry_list),
1426
1429
  )
1427
1430
 
1428
1431
  def curvilinear_refine(
@@ -1504,7 +1507,7 @@ class MeshKernel:
1504
1507
  self._execute_function(
1505
1508
  self.lib.mkernel_curvilinear_compute_transfinite_from_polygon,
1506
1509
  self._meshkernelid,
1507
- c_geometry_list,
1510
+ byref(c_geometry_list),
1508
1511
  c_int(first_node),
1509
1512
  c_int(second_node),
1510
1513
  c_int(third_node),
@@ -1532,7 +1535,7 @@ class MeshKernel:
1532
1535
  self._execute_function(
1533
1536
  self.lib.mkernel_curvilinear_compute_transfinite_from_polygon,
1534
1537
  self._meshkernelid,
1535
- c_geometry_list,
1538
+ byref(c_geometry_list),
1536
1539
  c_int(first_node),
1537
1540
  c_int(second_node),
1538
1541
  c_int(third_node),
@@ -1556,7 +1559,7 @@ class MeshKernel:
1556
1559
  self._execute_function(
1557
1560
  self.lib.mkernel_curvilinear_initialize_orthogonalize,
1558
1561
  self._meshkernelid,
1559
- c_orthogonalization_parameters,
1562
+ byref(c_orthogonalization_parameters),
1560
1563
  )
1561
1564
 
1562
1565
  def curvilinear_set_block_orthogonalize(
@@ -0,0 +1 @@
1
+ __version__ = "2.0.2"
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: meshkernel
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: `meshkernel` is a library which can be used to manipulate meshes.
5
5
  Home-page: https://github.com/Deltares/MeshKernelPy
6
- Author: Julian Hofer, Prisca van der Sluis
7
- Author-email: julian.hofer@deltares.nl, prisca.vandersluis@deltares.nl
6
+ Author: Julian Hofer, Prisca van der Sluis, Luca Carniato
7
+ Author-email: julian.hofer@deltares.nl, prisca.vandersluis@deltares.nl, luca.carniato@deltares.nl
8
8
  License: MIT
9
9
  Platform: Windows
10
10
  Platform: Linux
@@ -83,3 +83,26 @@ Then add a compiled `MeshKernelApi.dll` into your `src` folder.
83
83
 
84
84
  Also make sure that your editor is configured to format the code with [`black`](https://black.readthedocs.io/en/stable/) and [`isort`](https://pycqa.github.io/isort/).
85
85
  When modifying `Jupyter` notebooks, the [`jupyterlab-code-formatter`](https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html) can be used.
86
+
87
+ # Building linux wheels
88
+
89
+ To deploy Linux wheels to PyPI, we provide a Docker image that is based on manylinux2014_x86_64.
90
+ This image includes cmake and boost, which are necessary for compiling the native MeshKernel library (written in C++).
91
+ To build the Docker image, please follow these steps:
92
+
93
+ ```powershell
94
+ cd scripts
95
+ docker build --progress=plain ./scripts -t build_linux_library
96
+ cd ..
97
+ ```
98
+
99
+ Once the Docker image has been built, build the linux wheels using the following command:
100
+
101
+ ```powershell
102
+ docker run -v %cd%:/root --rm build_linux_library
103
+ ```
104
+
105
+ The deployable linux wheels will be located in dist/wheelhouse
106
+
107
+
108
+
@@ -1 +1,2 @@
1
+ MeshKernel
1
2
  meshkernel
@@ -0,0 +1,228 @@
1
+ import codecs
2
+ import os
3
+ import pathlib
4
+ import platform
5
+ import shutil
6
+
7
+ from setuptools import Extension, find_packages, setup
8
+ from setuptools.command.build_ext import build_ext as build_ext_orig
9
+
10
+ author_dict = {
11
+ "Julian Hofer": "julian.hofer@deltares.nl",
12
+ "Prisca van der Sluis": "prisca.vandersluis@deltares.nl",
13
+ "Luca Carniato": "luca.carniato@deltares.nl",
14
+ }
15
+ __author__ = ", ".join(author_dict.keys())
16
+ __author_email__ = ", ".join(s for _, s in author_dict.items())
17
+
18
+
19
+ def read(rel_path: str) -> str:
20
+ """Used to read a text file
21
+
22
+ Args:
23
+ rel_path (str): Relative path to the file
24
+
25
+ Returns:
26
+ str: File content
27
+ """
28
+ here = os.path.abspath(os.path.dirname(__file__))
29
+ with codecs.open(os.path.join(here, rel_path), "r") as fp:
30
+ return fp.read()
31
+
32
+
33
+ def get_version(rel_path: str) -> str:
34
+ """Get the version string
35
+
36
+ Args:
37
+ rel_path (str): Relative path to the file
38
+
39
+ Raises:
40
+ RuntimeError: Raised if the version string could not be found
41
+
42
+ Returns:
43
+ str: The version string
44
+ """
45
+ for line in read(rel_path).splitlines():
46
+ if line.startswith("__version__"):
47
+ delim = '"' if '"' in line else "'"
48
+ return line.split(delim)[1]
49
+
50
+ raise RuntimeError("Unable to find version string.")
51
+
52
+
53
+ def get_library_name() -> str:
54
+ """Get the filename of the MeshKernel library
55
+
56
+ Raises:
57
+ OSError: If the operating system is not supported
58
+
59
+ Returns:
60
+ str: Filename of the MeshKernel library
61
+ """
62
+ system = platform.system()
63
+ if system == "Windows":
64
+ return "MeshKernelApi.dll"
65
+ elif system == "Linux":
66
+ return "libMeshKernelApi.so"
67
+ else:
68
+ if not str:
69
+ system = "Unknown OS"
70
+ raise OSError(f"Unsupported operating system: {system}")
71
+
72
+
73
+ try:
74
+ from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
75
+
76
+ class bdist_wheel(_bdist_wheel):
77
+ """Class describing our wheel.
78
+ Basically it says that it is not a pure Python package,
79
+ but it also does not contain any Python source and
80
+ therefore works for all Python versions
81
+ """
82
+
83
+ def finalize_options(self):
84
+ _bdist_wheel.finalize_options(self)
85
+ # Mark us as not a pure python package
86
+ self.root_is_pure = False
87
+
88
+ def get_tag(self):
89
+ # We don't contain any python source
90
+ return "py3", "none", _bdist_wheel.get_tag(self)[2]
91
+
92
+ except ImportError:
93
+ bdist_wheel = None
94
+
95
+
96
+ class CMakeExtension(Extension):
97
+ """Class for building a native cmake extension (C++)"""
98
+
99
+ def __init__(self, repository):
100
+ """Constructor of CMakeExtension class
101
+
102
+ Args:
103
+ repository (str): The git repository of the extension to build
104
+ """
105
+
106
+ name = repository.split("/")[-1]
107
+ super().__init__(name, sources=[])
108
+ self.repository = repository
109
+
110
+
111
+ class build_ext(build_ext_orig):
112
+ """Class for building an extension using cmake"""
113
+
114
+ def run(self):
115
+ for ext in self.extensions:
116
+ self.build_cmake(ext)
117
+ super().run()
118
+
119
+ def build_cmake(self, ext):
120
+ cwd = str(pathlib.Path().absolute())
121
+ build_temp = pathlib.Path(self.build_temp)
122
+
123
+ build_temp.mkdir(parents=True, exist_ok=True)
124
+ extdir = pathlib.Path(self.get_ext_fullpath(ext.name))
125
+ extdir.mkdir(parents=True, exist_ok=True)
126
+
127
+ os.chdir(str(build_temp))
128
+ if not os.path.isdir(ext.name):
129
+ self.spawn(["git", "clone", ext.repository])
130
+
131
+ os.chdir(ext.name)
132
+
133
+ if not self.dry_run:
134
+ library_name = get_library_name()
135
+ system = platform.system()
136
+ if system == "Linux":
137
+ self.spawn(
138
+ [
139
+ "cmake",
140
+ "-S",
141
+ ".",
142
+ "-B",
143
+ "build",
144
+ "-DCMAKE_BUILD_TYPE=Release",
145
+ "-DADD_UNIT_TESTS_PROJECTS=OFF",
146
+ ]
147
+ )
148
+ self.spawn(["cmake", "--build", "build", "--config", "Release", "-j4"])
149
+ meshkernel_path = str(
150
+ os.path.join(
151
+ *[
152
+ pathlib.Path().absolute(),
153
+ "build",
154
+ "src",
155
+ "MeshKernelApi",
156
+ library_name,
157
+ ]
158
+ )
159
+ )
160
+ self.spawn(["strip", "--strip-unneeded", meshkernel_path])
161
+ elif system == "Windows":
162
+ self.spawn(
163
+ [
164
+ "cmake",
165
+ "-S",
166
+ ".",
167
+ "-B",
168
+ "build",
169
+ "-G",
170
+ "Visual Studio 16 2019",
171
+ "-DCMAKE_BUILD_TYPE=Release",
172
+ "-DADD_UNIT_TESTS_PROJECTS=OFF",
173
+ ]
174
+ )
175
+ self.spawn(["cmake", "--build", "build", "--config", "Release", "-j4"])
176
+ meshkernel_path = str(
177
+ os.path.join(
178
+ *[
179
+ pathlib.Path().absolute(),
180
+ "build",
181
+ "src",
182
+ "MeshKernelApi",
183
+ "Release",
184
+ library_name,
185
+ ]
186
+ )
187
+ )
188
+ else:
189
+ if not str:
190
+ system = "Unknown OS"
191
+ raise OSError(f"Unsupported operating system: {system}")
192
+
193
+ destination = os.path.join(*[cwd, "meshkernel", library_name])
194
+ shutil.copyfile(meshkernel_path, destination)
195
+
196
+ os.chdir(cwd)
197
+
198
+
199
+ long_description = read("README.md")
200
+
201
+ setup(
202
+ name="meshkernel",
203
+ description="`meshkernel` is a library which can be used to manipulate meshes.",
204
+ long_description=long_description,
205
+ long_description_content_type="text/markdown",
206
+ author=__author__,
207
+ author_email=__author_email__,
208
+ url="https://github.com/Deltares/MeshKernelPy",
209
+ license="MIT",
210
+ platforms="Windows, Linux",
211
+ install_requires=["numpy"],
212
+ extras_require={
213
+ "tests": ["pytest", "pytest-cov", "nbval", "matplotlib"],
214
+ "lint": [
215
+ "flake8",
216
+ "black",
217
+ "isort",
218
+ ],
219
+ "docs": ["sphinx", "sphinx_book_theme", "myst_nb"],
220
+ },
221
+ python_requires=">=3.8",
222
+ package_data={"meshkernel": [get_library_name()]},
223
+ packages=find_packages(),
224
+ ext_modules=[CMakeExtension("https://github.com/Deltares/MeshKernel")],
225
+ cmdclass={"build_ext": build_ext, "bdist_wheel": bdist_wheel},
226
+ version=get_version("meshkernel/version.py"),
227
+ classifiers=["Topic :: Scientific/Engineering :: Mathematics"],
228
+ )
@@ -1 +0,0 @@
1
- __version__ = "2.0.1"
meshkernel-2.0.1/setup.py DELETED
@@ -1,124 +0,0 @@
1
- import codecs
2
- import os.path
3
- import platform
4
-
5
- from setuptools import setup
6
-
7
- author_dict = {
8
- "Julian Hofer": "julian.hofer@deltares.nl",
9
- "Prisca van der Sluis": "prisca.vandersluis@deltares.nl",
10
- }
11
- __author__ = ", ".join(author_dict.keys())
12
- __author_email__ = ", ".join(s for _, s in author_dict.items())
13
-
14
-
15
- def read(rel_path: str) -> str:
16
- """Used to read a text file
17
-
18
- Args:
19
- rel_path (str): Relative path to the file
20
-
21
- Returns:
22
- str: File content
23
- """
24
- here = os.path.abspath(os.path.dirname(__file__))
25
- with codecs.open(os.path.join(here, rel_path), "r") as fp:
26
- return fp.read()
27
-
28
-
29
- def get_version(rel_path: str) -> str:
30
- """Get the version string
31
-
32
- Args:
33
- rel_path (str): Relative path to the file
34
-
35
- Raises:
36
- RuntimeError: Raised if the version string could not be found
37
-
38
- Returns:
39
- str: The version string
40
- """
41
- for line in read(rel_path).splitlines():
42
- if line.startswith("__version__"):
43
- delim = '"' if '"' in line else "'"
44
- return line.split(delim)[1]
45
-
46
- raise RuntimeError("Unable to find version string.")
47
-
48
-
49
- def get_meshkernel_name() -> str:
50
- """Get the filename of the MeshKernel library
51
-
52
- Raises:
53
- OSError: If the operating system is not supported
54
-
55
- Returns:
56
- str: Filename of the MeshKernel library
57
- """
58
- system = platform.system()
59
- if system == "Windows":
60
- return "MeshKernelApi.dll"
61
- elif system == "Linux":
62
- return "libMeshKernelApi.so"
63
- elif system == "Darwin":
64
- return "libMeshKernelApi.dylib"
65
- else:
66
- raise OSError(f"Unsupported operating system: {system}")
67
-
68
-
69
- try:
70
- from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
71
-
72
- class bdist_wheel(_bdist_wheel):
73
- """Class describing our wheel.
74
- Basically it says that it is not a pure Python package,
75
- but it also does not contain any Python source and
76
- therefore works for all Python versions
77
- """
78
-
79
- def finalize_options(self):
80
- _bdist_wheel.finalize_options(self)
81
- # Mark us as not a pure python package
82
- self.root_is_pure = False
83
-
84
- def get_tag(self):
85
- python, abi, plat = _bdist_wheel.get_tag(self)
86
- # We don't contain any python source
87
- python, abi = "py3", "none"
88
- return python, abi, plat
89
-
90
- except ImportError:
91
- bdist_wheel = None
92
-
93
-
94
- long_description = read("README.md")
95
-
96
- setup(
97
- name="meshkernel",
98
- description="`meshkernel` is a library which can be used to manipulate meshes.",
99
- long_description=long_description,
100
- long_description_content_type="text/markdown",
101
- author=__author__,
102
- author_email=__author_email__,
103
- url="https://github.com/Deltares/MeshKernelPy",
104
- license="MIT",
105
- platforms="Windows, Linux",
106
- install_requires=["numpy"],
107
- extras_require={
108
- "tests": ["pytest", "pytest-cov", "nbval", "matplotlib"],
109
- "lint": [
110
- "flake8",
111
- "black",
112
- "isort",
113
- ],
114
- "docs": ["sphinx", "sphinx_book_theme", "myst_nb"],
115
- },
116
- python_requires=">=3.8",
117
- packages=["meshkernel"],
118
- package_data={
119
- "meshkernel": [get_meshkernel_name()],
120
- },
121
- cmdclass={"bdist_wheel": bdist_wheel},
122
- version=get_version("meshkernel/version.py"),
123
- classifiers=["Topic :: Scientific/Engineering :: Mathematics"],
124
- )
File without changes
File without changes
File without changes