Metadata-Version: 2.4
Name: matrice_common
Version: 0.1.0
Summary: Common utilities for Matrice.ai services
Author-email: "Matrice.ai" <dipendra@matrice.ai>
License-Expression: MIT
Keywords: matrice,common,utilities,cython
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
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: Typing :: Typed
Requires-Python: <4,>=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: license-file


# matrice\_common

**matrice\_common** is a high-performance, Cython-compiled Python package providing reusable utilities for Matrice.ai services.
It offers ready-to-use authentication classes, error handling helpers, and general-purpose functions with complete type stubs for IDEs.

## Features

* **Cython Compiled** – Optimized performance via C extensions.
* **Authentication Utilities** – Refresh token and access key-based authentication.
* **Error Handling** – Rich error logging with Kafka producer support.
* **Utility Functions** – Helpers for caching, dependency management, and duplicate checks.
* **Type Hints & Stubs** – `.pyi` stubs for full IDE autocomplete and docstring support.
* **Modular Design** – Clear separation of auth, utils, and RPC components.

## Installation

```bash
pip install matrice_common --upgrade
```

## Example Usage

```python
from matrice_common.token_auth import RefreshToken, AuthToken
from matrice_common.utils import log_errors

# Example: Create auth instance
refresh = RefreshToken(access_key="YOUR_ACCESS_KEY", secret_key="YOUR_SECRET_KEY")
auth = AuthToken(access_key="YOUR_ACCESS_KEY", secret_key="YOUR_SECRET_KEY", refresh_token=refresh)

# Example: Use decorator for automatic error logging
@log_errors(default_return="failed")
def risky_function(x):
    return 10 / x

print(risky_function(0))
```
