Metadata-Version: 2.4
Name: xarray-sweep
Version: 0.1.6
Summary: Simple grid search utility that returns xarray outputs.
Project-URL: Homepage, https://github.com/your-username/xarray-sweep
Project-URL: Repository, https://github.com/your-username/xarray-sweep
Project-URL: Issues, https://github.com/your-username/xarray-sweep/issues
Author: Your Name
License: MIT
License-File: LICENSE
Keywords: grid-search,parameter-sweep,science,xarray
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: dask>=2024.1.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: tqdm>=4.66.0
Requires-Dist: xarray>=2024.1.0
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: twine>=5.1.1; extra == 'dev'
Description-Content-Type: text/markdown

# xarray-sweep

Small utility to run a function over a Cartesian product of parameters and return results as an unstacked `xarray` object.

## Install

```bash
pip install xarray-sweep
```

For local development:

```bash
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
```

## Usage

```python
import xarray as xr
from xarray_sweep import xarray_sweep


def model(a: float, b: float):
    return a + b

out = xarray_sweep(model, a=[0.1, 0.2], b=[1.0, 2.0])
print(out)
```

`xarray_sweep` runs sequentially by default. To execute combinations with Dask:

```python
out = xarray_sweep(model, use_dask=True, a=[0.1, 0.2], b=[1.0, 2.0])
```

To build a delayed computation (for distributed workflows), use `compute=False`:

```python
delayed_out = xarray_sweep(model, use_dask=True, compute=False, a=[0.1, 0.2], b=[1.0, 2.0])
```

Then you can compute this later with

```python
out = delayed_out.compute()
```
 or if you like you can use a progress bar with:

 ```python
from dask.diagnostics import ProgressBar
with ProgressBar():
    out = delayed_out.compute()
```


## Run tests

```bash
pytest
```

## Build distribution artifacts

```bash
python -m build
```

## Publish to PyPI

1. Create a PyPI account and API token.
2. Build artifacts (`python -m build`).
3. Upload with Twine:

```bash
twine upload dist/*
```

For TestPyPI first:

```bash
twine upload --repository testpypi dist/*
```

## GitHub Actions CI

A workflow is included at `.github/workflows/ci.yml` that runs tests on pull requests and pushes to `main`.
