skillfed

pygmsh

Python frontend for Gmsh

pygmsh v7.1.17 83.4K downloads/30d#14,078 on PyPI968
Copyleft license DORMANT released

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 pygmsh

uv

uv add pygmsh

poetry

poetry add pygmsh

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchLicense :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: MathematicsTopic :: Utilities

Tags

mesh generation pythongmsh python wrapper2d 3d mesh creationfinite element mesh generatorgeometry to mesh conversionunstructured mesh pythoncad geometry meshing
mesh-generationcad-geometryscientific-computing

More Scientific/Engineering packages