Metadata-Version: 2.4
Name: fluidgrids-common
Version: 0.3.0
Summary: Common utilities for Fluidgrids backend nodes
Author-email: Fluidgrids Team <info@algoshred.com>
License: MIT
Project-URL: Homepage, https://github.com/algoshred/fluidgrids-common
Project-URL: Bug Tracker, https://github.com/algoshred/fluidgrids-common/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ariadne==0.26.2
Requires-Dist: nats-py==2.10.0
Requires-Dist: websockets==15.0.1
Requires-Dist: opentelemetry-api==1.33.0
Requires-Dist: opentelemetry-sdk==1.33.0
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc==1.33.0
Requires-Dist: opentelemetry-exporter-otlp-proto-http==1.33.0
Requires-Dist: opentelemetry-instrumentation-fastapi==0.54b0
Requires-Dist: opentelemetry-instrumentation-httpx==0.54b0
Requires-Dist: opentelemetry-instrumentation-requests==0.54b0
Requires-Dist: opentelemetry-instrumentation-logging==0.54b0
Requires-Dist: python-dotenv==1.1.0
Requires-Dist: fastapi==0.115.12
Requires-Dist: uvicorn==0.34.2
Requires-Dist: pydantic-core==2.33.2
Requires-Dist: pydantic-settings==2.9.1
Requires-Dist: watchfiles==1.0.5
Requires-Dist: httpx==0.27.0
Dynamic: license-file

# Fluidgrids Common

A shared package for common utilities used across Fluidgrids backend nodes.

## Features

- NATS client management and messaging utilities
- OpenTelemetry configuration for observability
- Base server implementation
- Credential management utilities
- Adapter utilities

## Installation

```bash
pip install fluidgrids-common
```

## Usage

### Server Setup

```python
from fluidgrids_common.server import create_app
from fluidgrids_common.utils.otel_config import setup_opentelemetry_for_node

# Setup OpenTelemetry
setup_opentelemetry_for_node()

# Create FastAPI app with standard configuration
app = create_app(
    title="My Node",
    description="Node description",
    version="1.0.0"
)

# Add your routes and mount GraphQL
from my_node.gql import graphql_app
app.mount("/graphql/", graphql_app)

if __name__ == "__main__":
    from fluidgrids_common.server import run_server
    run_server(app)
```

### NATS Utilities

```python
from fluidgrids_common.utils.main import init_nats, publish_log_to_nats, publish_event_to_nats

# Initialize NATS
await init_nats()

# Publish logs and events
await publish_log_to_nats(run_id, node_id, "INFO", "Operation started")
await publish_event_to_nats(run_id, node_id, "STATUS_CHANGE", {"status": "RUNNING"})
```

## Development

```bash
# Clone the repository
git clone https://github.com/algoshred/fluidgrids-common.git
cd fluidgrids-common

# Install in development mode
pip install -e .
```

## License

MIT 
