Metadata-Version: 2.4
Name: mimir-client
Version: 5.0.0
Summary: Official Python client for the Mímir Knowledge Graph API
Project-URL: Homepage, https://github.com/dawsonlp/mimir
Project-URL: Documentation, https://github.com/dawsonlp/mimir/tree/main/clients/python
Project-URL: Repository, https://github.com/dawsonlp/mimir
Project-URL: Issues, https://github.com/dawsonlp/mimir/issues
Author: Development Team
License: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic-settings>=2.0
Requires-Dist: pydantic>=2.0
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: respx; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# mimir-client

Official Python client for the [Mímir Knowledge Graph API](https://github.com/dawsonlp/mimir).

## Installation

```bash
pip install mimir-client
```

## Quick Start

```python
import asyncio
from mimir_client import MimirClient

async def main():
    async with MimirClient(base_url="http://localhost:38000", tenant_id=1) as client:
        # Check API health
        health = await client.health()
        print(health["version"])

        # Create an artifact
        artifact = await client.create_artifact(
            artifact_type="document",
            title="Meeting Notes",
            content="Discussion about Q1 goals...",
        )
        print(artifact["id"])

        # Search
        results = await client.search(query="Q1 goals")
        for r in results["results"]:
            print(r["title"], r["score"])

asyncio.run(main())
```

## Configuration

### From environment variables

```python
client = MimirClient.from_env()
```

| Variable | Description | Default |
|----------|-------------|---------|
| `MIMIR_API_URL` | Base URL for Mímir API | `http://localhost:38000` |
| `MIMIR_TENANT_ID` | Default tenant ID | (none) |
| `MIMIR_TIMEOUT` | Request timeout in seconds | `30.0` |

### Explicit

```python
client = MimirClient(
    base_url="https://mimir.example.com",
    tenant_id=42,
    timeout=60.0,
)
```

## Error Handling

```python
from mimir_client.exceptions import MimirNotFoundError, MimirValidationError

try:
    artifact = await client.get_artifact("nonexistent-id")
except MimirNotFoundError:
    print("Artifact not found")
except MimirValidationError as e:
    print(f"Validation errors: {e.errors}")
```

## API Coverage

All Mímir API endpoints have corresponding client methods. See [docs/design.md](docs/design.md) for the full coverage matrix.

## Development

```bash
cd clients/python
uv venv .venv
source .venv/bin/activate
uv pip install -e ".[dev]"
pytest -v
```

## License

MIT