pygmsh
Python frontend for Gmsh
What it is and what it does
pygmsh is a Python wrapper around Gmsh, a widely-used open-source mesh generator. It abstracts Gmsh's native Python API to make it easier to programmatically define 2D and 3D geometries and generate unstructured meshes. The package supports both simple geometric primitives (polygons, circles, splines) and more complex CAD-style operations via OpenCASCADE (boolean operations, extrusions, revolutions). Generated meshes are returned as meshio objects, which can be written to standard formats like VTK or MSH.
Typical workflows involve defining a geometry within a context manager, optionally configuring mesh refinement or boundary layers, calling generate_mesh(), and then writing or analyzing the result. The package depends on gmsh (the underlying solver), meshio (mesh I/O and representation), and numpy (numerical arrays). It supports Python 3.7 and later and is classified as Production/Stable, though releases have been infrequent since early 2022.
Use it for:
- Generate finite element meshes for computational fluid dynamics or structural analysis simulations.
- Create unstructured meshes for complex 2D or 3D geometries defined programmatically in Python.
- Automate mesh generation in parametric design workflows where geometry varies with input parameters.
- Refine meshes locally near boundaries or regions of interest using boundary layer and callback functions.
- Export geometries to standard mesh formats (VTK, MSH) for visualization or downstream analysis tools.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pygmsh provides a Python interface to Gmsh, a mesh generation tool, allowing you to define 2D and 3D geometries and generate unstructured meshes from them.
Yes, with conditions. pygmsh is stable and well-established for mesh generation tasks in scientific computing. Install friction is low and there are no known vulnerabilities. However, maintenance is dormant—the last release was 2022-01-28. Choose this if you need a mature, proven mesh generation interface and can tolerate infrequent updates. The GPLv3+ license requires any derivative work to remain open-source. Verify compatibility with your Gmsh version before committing to production use.
Install
pygmsh on PyPI
pip
pip install pygmshuv
uv add pygmshpoetry
poetry add pygmshInstalling pygmsh
Before you install
Low install friction: pure Python wheel with three runtime dependencies (gmsh, meshio, numpy). Maintenance is dormant—last release was 2022-01-28, though the repository remains active with 968 stars and is not archived.
License in practice
Licensed under GPLv3+, a copyleft license. Any derivative work or distribution must also be open-source under a compatible license; proprietary projects cannot use this package without legal review.
Quickstart
pip install pygmsh
import pygmsh
with pygmsh.geo.Geometry() as geom:
geom.add_circle([0.0, 0.0], 1.0, mesh_size=0.2)
mesh = geom.generate_mesh()
mesh.write("output.vtk")
Gmsh itself must be installed separately (e.g., apt install python3-gmsh on Debian/Ubuntu or via other system package managers).
Verify before relying
- Current maintenance status and likelihood of future updates or bug fixes beyond the 2022 release.
- Compatibility with Gmsh versions released after the package's last update in 2022.
- Whether dormant status indicates the package is stable and feature-complete or at risk of bitrot.
Package facts
| License | not declared (copyleft) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — gmsh, meshio, numpy |
| Maintenance | dormant — 1,659 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 83,378/month — #14,078 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygmsh-7.1.17-py3-none-any.whl
Keywords: mesh, gmsh, mesh generation, mathematics, engineering
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
gmshGmsh is a three-dimensional finite element mesh…
copyleft · top 15,000 on PyPI
meshioReads and writes mesh files in dozens of…
permissive · top 5,000 on PyPI
pysplashsurfpySplashsurf provides Python bindings for…
permissive · top 15,000 on PyPI
meshioplusplusmeshioplusplus reads and writes mesh files in…
permissive · top 15,000 on PyPI
fast-simplificationSimplifies 3D meshes by reducing the number of…
permissive · top 15,000 on PyPI
scikit-femTransforms bilinear and linear forms into…
permissive · top 15,000 on PyPI
build123dbuild123d is a Python CAD framework for…
permissive · top 15,000 on PyPI
euclid3Provides 2D and 3D vector, matrix, quaternion,…
unclear · top 15,000 on PyPI
pymeshlabPyMeshLab provides Python bindings to MeshLab,…
copyleft · top 15,000 on PyPI
manifold3dManifold3d creates and operates on manifold…
permissive · top 5,000 on PyPI