Skip to main content

MeshKernelPy

PyPI version Quality Gate Status Coverage Downloads

MeshKernelPy is a library for creating and editing meshes. It supports 1D and 2D unstructured meshes. The underlying C++ library MeshKernel can be found here.

Installation

The library can be installed from PyPI by executing

pip install meshkernel

Under Windows, If you encounter any issues importing the pip wheels, you may need to install the Visual C++ Redistributable for Visual Studio 2019.

Examples

Creating a triangular mesh inside a polygon

In this example a mesh is created by discretizing the polygon perimeter with the desired edge length.

Mesh orthogonalization

Finite volume staggered flow solvers require the mesh to be as orthogonal as possible. MeshKernel provides an algorithm to adapt the mesh and achieve a good balance between mesh orthogonality and smoothness.

Mesh refinement

A mesh can be refined in areas based on samples or polygon selections.

Contributing

In order to install MeshKernelPy locally, please execute the following line inside your virtual environment

pip install -e ".[tests, lint, docs]"

Then add a compiled MeshKernelApi.dll into your src folder.

Also make sure that your editor is configured to format the code with black and isort. When modifying Jupyter notebooks, the jupyterlab-code-formatter can be used.

Building and installing the wheel

Platform-specific build

A setup script is provided for building the wheel. The script is known to work under Windows, Linux and macOS.

To install the dependencies, use

python -m pip install --upgrade pip
python -m pip install wheel numpy matplotlib pytest

The environment variable BACK_END_BRANCH must be set prior to building the wheel. It specifies which MeshKernel branch should be built during the generation of the wheel. If one is on the main branch of MeshKernelPy, BACK_END_BRANCH must be either set to master. If one is an a release branch, BACK_END_BRANCH should be set to release. The version of the MeshKernel release branch is hardcoded in meshkernel/version.py.

While in the project's root directory, to build the wheel use

python setup.py build_ext
python setup.py sdist bdist_wheel

To install use: The wheel is installed

python -m pip install <meshkernel_wheel_name>

where <meshkernel_wheel_name> is the name of the generated wheel.

To test, simply run pytest.

Manylinux Docker image

To deploy Linux wheels to PyPI, we provide a Docker image that is based on manylinux_2_28_x86_64. This image includes cmake and boost, which are necessary for compiling the native MeshKernel library (written in C++). To build the Docker image, use:

docker build --progress=plain ./scripts -t build_linux_library

Once the Docker image has been built, build the manylinux wheel using the following command:

docker run -e BACK_END_BRANCH=<meshkernel_back_end_branch_name> -v $(pwd):/root --rm build_linux_library

where <meshkernel_back_end_branch_name> is either master or release, as described in Platform-specific build.

The deployable manylinux wheels will be located in dist/wheelhouse.

License

MeshKernelPy uses the MIT license. However, the wheels on PyPI bundle the LGPL licensed MeshKernel. Please make sure that this fits your needs before depending on it.

Metadata

Release files for meshkernel 8.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for meshkernel 8.4.0
File Actions
meshkernel-8.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for meshkernel-8.4.0-py3-none-win_amd64.whl
meshkernel-8.4.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for meshkernel-8.4.0-py3-none-manylinux_2_28_x86_64.whl
meshkernel-8.4.0-py3-none-macosx_26_0_arm64.whl Python 3 none macOS 26.0+ ARM64 Details for meshkernel-8.4.0-py3-none-macosx_26_0_arm64.whl
meshkernel-8.4.0-py3-none-macosx_15_0_x86_64.whl Python 3 none macOS 15.0+ x86-64 Details for meshkernel-8.4.0-py3-none-macosx_15_0_x86_64.whl
meshkernel-8.4.0-py3-none-macosx_15_0_arm64.whl Python 3 none macOS 15.0+ ARM64 Details for meshkernel-8.4.0-py3-none-macosx_15_0_arm64.whl
meshkernel-8.4.0-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details for meshkernel-8.4.0-py3-none-macosx_14_0_arm64.whl

Total release size: 7.3 MB

Release files / meshkernel-8.4.0-py3-none-win_amd64.whl

Download URL meshkernel-8.4.0-py3-none-win_amd64.whl
Size 1.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
014a47bdfd908d7226840a74e0d3d1ce7ef766d320dcfdfa7a5b4d80c85561ba
BLAKE2b-256 checksum
How to use checksums
baedf377aa1179bed8f7f3d7b9440d8f3643e5b8a01c9eb25063c8791f649ddc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / meshkernel-8.4.0-py3-none-manylinux_2_28_x86_64.whl

Download URL meshkernel-8.4.0-py3-none-manylinux_2_28_x86_64.whl
Size 1.5 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
982961bb3aa53bac0f531ec855a7ff7a8f04397611a1c787ae287b30a0bd4f17
BLAKE2b-256 checksum
How to use checksums
b931f2c6cc3c975029ad08bcbef5bd57daf4609e06b26fb141dec9818638de6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / meshkernel-8.4.0-py3-none-macosx_26_0_arm64.whl

Download URL meshkernel-8.4.0-py3-none-macosx_26_0_arm64.whl
Size 1.2 MB
Tags Python 3 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
a166ddc5e5bfc72e178dc86bc19df708e854677311642fe06c843f9d0188b049
BLAKE2b-256 checksum
How to use checksums
1ce54c3e61d695c731cee2b8052482d3c0b8a92149a19a840a23a53bce663836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / meshkernel-8.4.0-py3-none-macosx_15_0_x86_64.whl

Download URL meshkernel-8.4.0-py3-none-macosx_15_0_x86_64.whl
Size 1.2 MB
Tags Python 3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
bfe1bce0265ca3ff498ee00658088cbc8cf2fb9183239e2dd48082c50618fe96
BLAKE2b-256 checksum
How to use checksums
5433b0a813e74d4a5946aef236cd554e4241647407510ba5d6f71f1b477906ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / meshkernel-8.4.0-py3-none-macosx_15_0_arm64.whl

Download URL meshkernel-8.4.0-py3-none-macosx_15_0_arm64.whl
Size 1.1 MB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
312340590987f714c5e879798b2efed03e909dda4b31a652acf5c03433dc728f
BLAKE2b-256 checksum
How to use checksums
5ad00dfecc91ec9b9f0e7343801c72c903ee9220c0d5435eb137b70168009986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / meshkernel-8.4.0-py3-none-macosx_14_0_arm64.whl

Download URL meshkernel-8.4.0-py3-none-macosx_14_0_arm64.whl
Size 1.1 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
ffd80e97be134dbe38c715cf373bfbedbaf4539b58605bb956a94dd825ab4a88
BLAKE2b-256 checksum
How to use checksums
aa655c9ee1bc5679b003a91855b79be3e37497c2c698d9a31c894fc29e3fc687
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for meshkernel 8.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page