Skip to main content

Python client for the deo document database

Project description

deo-client

PyPI version Python Versions License

A Python client library for the deo document database.

Installation

pip install deo-client

Quick Start

from deo_client import DeoClient

# Initialize client
client = DeoClient("http://localhost:6741")  # Default host

# Create a database
client.create_database("my_app")

# Create a collection
client.dbs["my_app"].create_collection("users")

# Create a document
user_collection = client.dbs["my_app"].collections["users"]
user_collection.create_document({
    "name": "John Doe",
    "email": "john@example.com",
    "age": 30
})

# List documents
users = user_collection.list_documents()
print(f"Found {len(users.data)} users")

# Query with filters and sorting
from deo_client.types import ListDocumentsOptions

options = ListDocumentsOptions(
    filters={"status": "active"},
    sort_by="name",
    order="asc",
    limit=10
)
active_users = user_collection.list_documents(options)

# Read, update, and delete documents
user = user_collection.read_document("some-uuid")
updated_user = user_collection.update_document("some-uuid", {"name": "Jane Doe"})
user_collection.delete_document("some-uuid")

API Reference

DeoClient

Main client class for interacting with deo databases.

Methods

  • create_database(db_name: str) -> DeoResponse[None]
  • list_databases() -> DeoResponse[List[str]]
  • delete_database(db_name: str) -> DeoResponse[None]
  • dbs[db_name] -> Database - Dynamic database access

Database

Class for database operations and collection management.

Methods

  • create_collection(collection_name: str) -> DeoResponse[None]
  • list_collections() -> DeoResponse[List[str]]
  • delete_collection(collection_name: str) -> DeoResponse[None]
  • collections[collection_name] -> Collection - Dynamic collection access

Collection

Class for document operations within a collection.

Methods

  • create_document(document: Dict[str, Any]) -> DeoResponse[Document]
  • list_documents(options: Optional[ListDocumentsOptions] = None) -> DeoResponse[List[Document]]
  • read_document(document_id: str) -> DeoResponse[Document]
  • update_document(document_id: str, document: Dict[str, Any]) -> DeoResponse[Document]
  • delete_document(document_id: str) -> DeoResponse[None]

ListDocumentsOptions

Options for filtering and sorting document queries.

Attributes

  • filters: Optional[Dict[str, str]] - Key-value filters
  • sort_by: Optional[str] - Field to sort by
  • order: Optional[str] - Sort order ("asc" or "desc")
  • limit: Optional[int] - Maximum number of documents
  • offset: Optional[int] - Number of documents to skip

Error Handling

The client raises DeoError exceptions for API errors. All methods return DeoResponse objects with success, message, and data fields.

from deo_client import DeoClient, DeoError

client = DeoClient()

try:
    response = client.create_database("test")
    if response.success:
        print("Database created!")
    else:
        print(f"Error: {response.message}")
except DeoError as e:
    print(f"API Error: {e}")

Type Safety

This library is fully typed with comprehensive type hints. For the best development experience, use a type checker like mypy:

pip install mypy
mypy your_script.py

Development

# Clone the repository
git clone https://github.com/myferr/deo.git
cd deo/packages/pypi

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run type checking
mypy deo_client/

# Run linting
ruff check .

License

MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please see the main repository for contribution guidelines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deo_client-0.0.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deo_client-0.0.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file deo_client-0.0.1.tar.gz.

File metadata

  • Download URL: deo_client-0.0.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for deo_client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e19b7d7547e1d22c6be1b3aa69f829594f55d13b5b9560abf630b8fac9cdd60f
MD5 985eeca09c21086475c12e14c49e772b
BLAKE2b-256 1fcdaf1e9726d539e32ab164e8c558f03c9fcc8cc1543c3ccf36be30dcff9210

See more details on using hashes here.

File details

Details for the file deo_client-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: deo_client-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for deo_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 feefd020908b1aac9028deb0344c8f14c909fa8e38c498d490cb13b2f76e957c
MD5 6be48706d07ecaddb1bcc79461af9145
BLAKE2b-256 dfc04c1dccd386c0aae6f30f7786efcb88c7f4848d4518603346df22613f57cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page