Metadata-Version: 2.4
Name: bailo
Version: 3.7.1
Summary: Simplifies interacting with Bailo programmatically
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3 :: Only
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-Dist: requests==2.33.1
Requires-Dist: semantic-version==2.10.0
Requires-Dist: tqdm==4.67.3
Requires-Dist: mlflow-skinny[mlserver]==3.10.1 ; extra == "mlflow"
Requires-Dist: black==26.3.1 ; extra == "test"
Requires-Dist: check-manifest==0.51 ; extra == "test"
Requires-Dist: pre-commit==4.5.1 ; extra == "test"
Requires-Dist: pylint==4.0.5 ; extra == "test"
Requires-Dist: pylint_junit==0.3.5 ; extra == "test"
Requires-Dist: pytest-cov==7.1.0 ; extra == "test"
Requires-Dist: pytest-mock==3.15.1 ; extra == "test"
Requires-Dist: pytest-runner==6.0.1 ; extra == "test"
Requires-Dist: pytest==9.0.3 ; extra == "test"
Requires-Dist: pytest-github-actions-annotate-failures==0.4.0 ; extra == "test"
Requires-Dist: requests_mock==1.12.1 ; extra == "test"
Requires-Dist: shellcheck-py==0.11.0.1 ; extra == "test"
Requires-Dist: bailo[mlflow] ; extra == "test"
Project-URL: Changelog, https://github.com/gchq/Bailo/blob/main/lib/python/CHANGELOG.md
Project-URL: Documentation, https://github.com/gchq/bailo/tree/main#readme
Project-URL: Source, https://github.com/gchq/bailo
Project-URL: Tracker, https://github.com/gchq/bailo/issues
Provides-Extra: mlflow
Provides-Extra: test

# Bailo Python Client

[![PyPI - Python Version][pypi-python-version-shield]][pypi-url] [![PyPI - Version][pypi-version-shield]][pypi-url]
[![License][license-shield]][license-url] [![Contributor Covenant][code-of-conduct-shield]][code-of-conduct-url]

A lightweight, Python API wrapper for Bailo, providing streamlined programmatic access to its core functionality - designed for Data Scientists, ML Engineers, and Developers who need to integrate Bailo capabilities directly into their workflows.

<br />

<!-- TABLE OF CONTENTS -->
<details>
    <summary>Table of Contents</summary>
    <ol>
        <li>
            <a href="#quickstart">Quickstart</a>
            <ul>
                <li><a href="#installation">Installation</a></li>
                <li><a href="#basic-usage">Basic Usage</a></li>
                <li><a href="#core-features">Core Features</a></li>
            </ul>
        </li>
        <li>
            <a href="#documentation">Documentation</a>
            <ul>
                <li><a href="#building-locally">Building Locally</a></li>
            </ul>
        </li>
        <li>
            <a href="#development">Development</a>
            <ul>
                <li><a href="#python-setup">Python Setup</a></li>
                <li><a href="#running-tests">Running Tests</a></li>
            </ul>
        </li>
    </ol>
</details>

<br />

## Quickstart

> **Requires:** Python 3.10 to 3.14

### Installation

```bash
pip install bailo
```

Optional: enable integration with [MLFlow](https://mlflow.org/) for advanced model tracking:

```bash
pip install bailo[mlflow]
```

### Basic Usage

```python
from bailo import Client, Model

# Connect to Bailo server
client = Client("http://localhost:8080")

# Create a model
yolo = Model.create(
    client=client,
    name="YoloV4",
    description="You only look once!"
)

# Populate datacard using a predefined schema
yolo.card_from_schema("minimal-general-v10")

# Create a new release
my_release = yolo.create_release(
    version="0.1.0",
    notes="Beta"
)

# Upload a binary file to the release
with open("yolo.onnx") as f:
    my_release.upload("yolo", f)
```

### Core Features

- Upload and download model binaries
- Manage Models & Releases
- Handle Datacards & Schemas
- Manage Schemas
- Process Access Requests

> **Note:** Certain collaborative actions (approvals, review threads, etc.) are best handled via the Bailo web interface.

## Documentation

Full Python client documentation: [Bailo Python Docs](https://gchq.github.io/Bailo/docs/python/index.html).

### Building locally

Refer to [backend/docs/README.md](https://github.com/gchq/Bailo/blob/main/backend/docs/README.md) for local build steps.

## Development

The following steps are only required for users who wish to extend or develop the Bailo Python client locally.

### Python Setup

From within the `lib/python` directory:

```bash
python3 -m venv libpythonvenv
source libpythonvenv/bin/activate
pip install -e .[test]
```

### Running Tests

To run the unit tests:

```bash
pytest
```

To run the integration tests (requires Bailo running on `https://localhost:8080`):

```bash
pytest -m integration
```

To run the mlflow integration tests (requires Bailo running on `https://localhost:8080` and mlflow running on `https://localhost:5050` e.g. via docker):

```bash
docker run -p 5050:5000 \
    "ghcr.io/mlflow/mlflow:v$(python -m pip show mlflow | awk '/Version:/ {print $2}')" \
    mlflow server --host 0.0.0.0 --port 5000

pytest -m mlflow
```

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->

[pypi-url]: https://pypi.org/project/bailo/
[pypi-version-shield]: https://img.shields.io/pypi/v/bailo?style=for-the-badge
[pypi-python-version-shield]: https://img.shields.io/pypi/pyversions/bailo?style=for-the-badge
[license-shield]: https://img.shields.io/github/license/gchq/bailo.svg?style=for-the-badge
[license-url]: https://github.com/gchq/Bailo/blob/main/LICENSE.txt
[code-of-conduct-shield]: https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg?style=for-the-badge
[code-of-conduct-url]: https://github.com/gchq/Bailo/blob/main/CODE_OF_CONDUCT.md

