Metadata-Version: 2.4
Name: wetlands
Version: 2.4.0
Summary: Create isolated Pixi environments and run Python functions or managed commands without dependency conflicts.
Project-URL: Homepage, https://arthursw.github.io/wetlands/latest/
Project-URL: Documentation, https://arthursw.github.io/wetlands/latest/
Project-URL: Repository, https://github.com/arthursw/wetlands
Project-URL: Issues, https://github.com/arthursw/wetlands/issues
Project-URL: Changelog, https://github.com/arthursw/wetlands/blob/main/CHANGELOG.md
Author-email: Arthur Masson <arthur.masson@inria.fr>
License-Expression: MIT
License-File: LICENSE
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.9
Requires-Dist: packaging>=24.2
Requires-Dist: psutil>=6.1.0
Requires-Dist: tomli>=2.0; python_version < '3.11'
Requires-Dist: typing-extensions>=4.0; python_version < '3.11'
Provides-Extra: docs
Requires-Dist: mike>=2.1.3; extra == 'docs'
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == 'docs'
Requires-Dist: mkdocs-include-markdown-plugin>=7.1.5; extra == 'docs'
Requires-Dist: mkdocs-literate-nav>=0.6.2; extra == 'docs'
Requires-Dist: mkdocs-material>=9.6.11; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.29.1; extra == 'docs'
Requires-Dist: pygments<2.20; extra == 'docs'
Provides-Extra: shared-memory
Requires-Dist: numpy>=1.26; (python_version < '3.14') and extra == 'shared-memory'
Requires-Dist: numpy>=2.3.3; (python_version >= '3.14') and extra == 'shared-memory'
Description-Content-Type: text/markdown

![](Wetland.png)

# Wetlands

[![Wetlands tests](https://github.com/arthursw/wetlands/actions/workflows/ci.yml/badge.svg?event=push&branch=main)](https://github.com/arthursw/wetlands/actions/)
[![Wetlands PyPI](https://img.shields.io/pypi/v/wetlands.svg?color=%2334D058)](https://pypi.org/project/wetlands/)
[![Wetlands Python versions](https://img.shields.io/pypi/pyversions/wetlands.svg?color=%2334D058)](https://pypi.org/project/wetlands/)

Wetlands lets a Python application run functions and external commands in separate [Pixi](https://pixi.sh/) environments.

This is useful when one application needs libraries whose dependencies cannot be installed together.
Wetlands creates the environments, keeps worker processes ready for repeated calls, transfers ordinary Python values between the application and workers, and supervises commands and services installed in an environment.

> Wetlands is intended for code you trust.
> Environments prevent dependency conflicts, but they do not restrict what code can access on your computer.

## Install

```sh
pip install wetlands
```

Install the optional NumPy support when arrays cross the worker boundary:

```sh
pip install "wetlands[shared-memory]"
```

## Run a task

```python
from wetlands import EnvironmentManager, EnvironmentSpec

with EnvironmentManager(root="wetlands") as manager:
    environment = manager.provision(
        "first-example",
        EnvironmentSpec(python="3.12.*"),
    ).wait_for()

    with environment.start() as workers:
        result = workers.execute_import(
            "builtins:sum",
            args=([20, 22],),
        )

print(result)  # 42
```

The first run may download Pixi and Python packages and can take several minutes.

Continue with the [first-task tutorial](https://arthursw.github.io/wetlands/latest/getting_started/) or browse the [complete documentation](https://arthursw.github.io/wetlands/latest/).
Existing Wetlands 1 users should read the [migration guide](docs/migration_v2.md).

## Development

Install the development environment:

```sh
uv sync --frozen --group dev --extra shared-memory
```

Run the fast tests and static checks:

```sh
uv run --extra shared-memory pytest -m "not integration and not compat and not manual"
uv run ruff check
uv run ruff format --check
uv run mypy src/wetlands
```

Start with the [contributor setup and validation guide](docs/developer/contributing.md).
The [architecture guide](docs/developer/architecture.md) explains the runtime design.
Maintainers should follow [RELEASING.md](RELEASING.md) when publishing a release.

Wetlands is licensed under the [MIT License](LICENSE).
Read the [security policy](SECURITY.md) before executing third-party worker code, managed commands, or post-install commands.
