Skip to content

Installation

Stable release

Add gmshparser to a uv-managed project:

uv add gmshparser

Install it into the active Python environment with pip:

pip install gmshparser

The package requires Python 3.12 or newer.

Typing support

gmshparser ships inline PEP 561 type information and a py.typed marker. Type checkers such as mypy and pyright therefore use the annotations from the installed package without a separate stubs distribution.

Development version

Install the current master branch directly from GitHub:

uv add "gmshparser @ git+https://github.com/ahojukka5/gmshparser.git"

or with pip:

pip install git+https://github.com/ahojukka5/gmshparser.git

Verify the installation

python -c "import gmshparser; print(gmshparser.__version__)"
gmshparser --version

In a uv-managed project, prefix commands with uv run when needed:

uv run python -c "import gmshparser; print(gmshparser.__version__)"
uv run gmshparser --version

NumPy dependency

The core package does not depend on NumPy. Install the optional extra for array interoperability:

uv add "gmshparser[numpy]"

or with pip:

pip install "gmshparser[numpy]"

The optional API is then available as gmshparser.numpy.

Visualization dependency

The core package does not depend on matplotlib. Add it only for visualization:

uv add matplotlib

For a repository checkout, use the predefined dependency group:

uv sync --group visualization

Development environment

Clone the repository and let uv create the local environment:

git clone https://github.com/ahojukka5/gmshparser.git
cd gmshparser
uv sync

The default dev group includes the test, lint, and typing groups. Install other groups explicitly:

uv sync --group docs
uv sync --group benchmark
uv sync --group visualization
uv sync --all-groups

Run project commands through uv:

uv run pytest
uv run ruff format --check gmshparser tests examples benchmarks
uv run ruff check gmshparser tests examples benchmarks
uv run mypy gmshparser
uv run mypy --strict tests/typing/public_api.py

Dependency lock files are intentionally not committed. A locally generated uv.lock is ignored by Git.

Upgrade

In a uv project:

uv add gmshparser --upgrade-package gmshparser

With pip:

pip install --upgrade gmshparser

Uninstall

Remove the dependency from a uv project:

uv remove gmshparser

With pip:

pip uninstall gmshparser