Metadata-Version: 2.4
Name: antfly-sdk
Version: 0.0.2.dev2
Summary: Python SDK for Antfly distributed key-value store and search engine
Project-URL: Homepage, https://github.com/antflydb/antfly-py
Project-URL: Documentation, https://antfly-sdk-python.readthedocs.io
Project-URL: Repository, https://github.com/antflydb/antfly-py
Project-URL: Issues, https://github.com/antflydb/antfly-py/issues
Author-email: "Antfly, Inc." <ajroetker@antfly.io>
License: Apache-2.0
Keywords: antfly,database,distributed,key-value,search
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
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
Requires-Python: >=3.9
Requires-Dist: attrs>=22.2.0
Requires-Dist: httpx<0.29.0,>=0.23.0
Requires-Dist: python-dateutil<3.0.0,>=2.8.0
Description-Content-Type: text/markdown

# Antfly Python SDK

[![PyPI version](https://badge.fury.io/py/antfly.svg)](https://badge.fury.io/py/antfly)
[![Python](https://img.shields.io/pypi/pyversions/antfly.svg)](https://pypi.org/project/antfly/)

Python SDK for [Antfly](https://github.com/antflydb/antfly) - a distributed key-value store and search engine.

For the nightly version, visit the [TestPyPI page](https://test.pypi.org/project/antfly-sdk/).

## Installation

```bash
pip install antfly-sdk
```

## Quick Start

```python
from antfly import AntflyClient

# Initialize client
client = AntflyClient(
    base_url="http://localhost:8080",
    username="admin",
    password="password"
)

# Create a table
client.create_table(
    name="users",
    num_shards=4,
    schema={
        "key": "user_id",
        "document_types": {
            "user": {
                "fields": {
                    "name": {"type": "string"},
                    "email": {"type": "keyword"},
                    "age": {"type": "int"},
                    "created_at": {"type": "time"}
                }
            }
        }
    }
)

# Insert data
client.batch(
    table="users",
    inserts={
        "user:1": {
            "name": "John Doe",
            "email": "john@example.com",
            "age": 30
        },
        "user:2": {
            "name": "Jane Smith",
            "email": "jane@example.com",
            "age": 25
        }
    }
)

# Query data
results = client.query(
    table="users",
    full_text_search={"query": "John"},
    limit=10
)

# Get specific record
user = client.get(table="users", key="user:1")
```

## Features

- **Simple API**: Intuitive interface for all Antfly operations
- **Type Safety**: Full type hints for better IDE support
- **Authentication**: Built-in support for basic authentication
- **Error Handling**: Comprehensive error handling with custom exceptions
- **Auto-generated Client**: Based on OpenAPI specification for accuracy

## Development

### Setup

1. Clone the repository
2. Install development dependencies:

```bash
uv sync
```


### Generate Client

The SDK uses an auto-generated client based on the Antfly OpenAPI specification:

```bash
make generate
```

### Run Tests

```bash
make test
```

### Build Package

```bash
make build
```

## Documentation

`make docs` will generate the documentation in the `docs/` folder.

Full documentation is available at [https://antfly-sdk-python.readthedocs.io](https://antfly-sdk-python.readthedocs.io)

## License

Apache License 2.0

## Warning

[Some models cannot be autogenerated from the spec](https://github.com/openapi-generators/openapi-python-client/issues/1123)
