Metadata-Version: 2.5
Name: malloy-publisher-sdk
Version: 0.11.1
Summary: Auto-generated Python client for the Malloy Publisher REST API
Project-URL: Bug Reports, https://github.com/malloydata/publisher/issues
Project-URL: Source, https://github.com/malloydata/publisher
Project-URL: Documentation, https://malloydata.github.io/malloy/
Author: malloydata-publisher
Maintainer: malloydata-publisher
License: MIT
License-File: LICENSE
Keywords: api,client,malloy,openapi,rest,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: attrs>=23.1.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.6.0
Provides-Extra: dev
Requires-Dist: black>=24.4.0; extra == 'dev'
Requires-Dist: openapi-python-client==0.29.0; extra == 'dev'
Requires-Dist: openapi-spec-validator==0.9.0; extra == 'dev'
Requires-Dist: pyright>=1.1.360; extra == 'dev'
Requires-Dist: ruff>=0.4.1; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.2.0; extra == 'docs'
Requires-Dist: mkdocs>=1.5.0; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.22.0; extra == 'docs'
Provides-Extra: test
Requires-Dist: hypothesis>=6.82.0; extra == 'test'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'test'
Requires-Dist: pytest-cov>=4.1.0; extra == 'test'
Requires-Dist: pytest>=7.4.0; extra == 'test'
Requires-Dist: respx>=0.20.1; extra == 'test'
Description-Content-Type: text/markdown

<!--
Copyright (c) Credible Data Inc.
SPDX-License-Identifier: MIT
-->

# Malloy Publisher Python SDK

Auto-generated, fully typed Python client for the Malloy Publisher REST API.

---

## Installation

```bash
pip install malloy-publisher-sdk  # once published on PyPI
```

For local development against the monorepo:

```bash
cd packages/python-client
uv venv .venv        # create virtual env (requires `uv`)
source .venv/bin/activate
uv pip install -e ".[test]"  # editable install with test extras
```

---

## Quick-start

```python
from malloy_publisher_sdk import Client, errors
from malloy_publisher_sdk.api.environments import list_environments

client = Client(base_url="http://localhost:4000/api/v0")

try:
    environments = list_environments.sync(client=client)
    for env in environments:
        print(env.name, env.resource)
except errors.ApiError as exc:
    print(exc.status_code, exc.body)
```

### Async usage

```python
import asyncio
from malloy_publisher_sdk import Client
from malloy_publisher_sdk.api.environments import list_environments

async def main():
    async with Client(base_url="http://localhost:4000/api/v0") as client:
        environments = await list_environments.asyncio(client=client)
        print([e.name for e in environments])

asyncio.run(main())
```

---

## Development

### Regenerating the SDK

When the OpenAPI spec (`api-doc.yaml`) changes, run the helper script and commit the diff:

```bash
cd packages/python-client
scripts/build-python-sdk.sh
```

The script performs:
1. Spec validation
2. Code generation via **openapi-python-client**
3. Version synchronization
4. Formatting, linting, type-checking
5. Test execution

### Building the Package

To build the Python package for distribution:

```bash
# Build only (for testing)
./scripts/build-package.sh

# Or build as part of SDK generation
BUILD_PACKAGE=true ./scripts/build-python-sdk.sh
```

This creates wheel and source distributions in the `dist/` directory.


#### Version Management

The package version is managed in `pyproject.toml`. Update the version there and run the build script to synchronize it across all files.

---

## Contributing

Pull requests welcome! Make sure `./scripts/build-python-sdk.sh` passes before opening a PR.

For packaging changes, also verify:
```bash
./scripts/build-package.sh  # Test package building
pip install dist/*.whl      # Test local installation
```

---

## License

MIT © Malloy Data
