Skip to main content

Shared Python infrastructure library for isA platform

Project description

isA Common

Shared Python infrastructure library for the isA platform.

Overview

This package provides common infrastructure components used across all isA Python services:

  • gRPC Clients: NATS, MinIO, MQTT, DuckDB, Supabase, etc.
  • Event Framework: Generic event-driven architecture base classes
  • Proto Files: Generated gRPC proto files

Installation

Development Install (Recommended)

pip install -e /Users/xenodennis/Documents/Fun/isA_Cloud/isA_common

From Source

cd /Users/xenodennis/Documents/Fun/isA_Cloud/isA_common
pip install .

Usage

gRPC Clients

from grpc_clients import NATSClient, MinIOClient, get_client

# Option 1: Direct instantiation
nats = NATSClient(host='localhost', port=50056)

# Option 2: Factory pattern
nats = get_client('nats', user_id='my_service')

Event Framework

from grpc_clients.events import BaseEvent, BaseEventPublisher

# Define your event
class MyEvent(BaseEvent):
    event_type: str = "my.event"
    data: str

# Define your publisher
class MyEventPublisher(BaseEventPublisher):
    def service_name(self) -> str:
        return "my_service"

    async def publish_my_event(self, data: str) -> bool:
        event = MyEvent(event_type="my.event", data=data)
        return await self.publish_event(event, subject="my.event")

Projects Using isA_common

  • isA_user - Microservices platform (17 services)
  • isA_Model - AI model inference service
  • isA_Agent - AI agent service
  • isA_MCP - Model Control Protocol service

Components

gRPC Clients (grpc_clients/)

  • NATSClient - NATS message bus client (port 50056)
  • MinIOClient - Object storage client (port 50051)
  • MQTTClient - MQTT broker client (port 50053)
  • DuckDBClient - Analytics database client (port 50052)
  • SupabaseClient - Supabase client (port 50057)

Event Framework (grpc_clients/events/)

  • BaseEvent - Base event model with metadata
  • EventMetadata - Standard event metadata
  • BaseEventPublisher - Base publisher class (abstract)
  • BaseEventSubscriber - Base subscriber class with idempotency
  • EventHandler - Event handler interface (abstract)
  • IdempotencyChecker - Duplicate prevention
  • RetryPolicy - Retry configuration

Development

Generating Proto Files

Proto files are generated from the parent isA_Cloud project:

cd /Users/xenodennis/Documents/Fun/isA_Cloud
./scripts/generate-grpc.sh

This script generates:

  • Go proto files → api/proto/*.pb.go
  • Python proto files → isA_common/grpc_clients/proto/*.py

Running Tests

cd /Users/xenodennis/Documents/Fun/isA_Cloud/isA_common
pytest tests/

Package Structure

isA_Cloud/
├── isA_common/                      # Python package
│   ├── grpc_clients/
│   │   ├── __init__.py
│   │   ├── base_client.py
│   │   ├── nats_client.py
│   │   ├── minio_client.py
│   │   ├── mqtt_client.py
│   │   ├── duckdb_client.py
│   │   ├── supabase_client.py
│   │   ├── events/
│   │   │   ├── __init__.py
│   │   │   ├── base_event_models.py
│   │   │   ├── base_event_publisher.py
│   │   │   └── base_event_subscriber.py
│   │   └── proto/
│   │       ├── __init__.py
│   │       ├── common_pb2.py
│   │       ├── nats_service_pb2.py
│   │       └── ...
│   ├── setup.py
│   ├── pyproject.toml
│   ├── README.md
│   └── requirements.txt
├── scripts/
│   └── generate-grpc.sh             # Generates to isA_common/
└── api/proto/                       # Proto definitions

Version

Current version: 0.1.0

License

Proprietary - isA Platform

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

isa_common-0.1.2.tar.gz (94.1 kB view details)

Uploaded Source

Built Distribution

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

isa_common-0.1.2-py3-none-any.whl (105.2 kB view details)

Uploaded Python 3

File details

Details for the file isa_common-0.1.2.tar.gz.

File metadata

  • Download URL: isa_common-0.1.2.tar.gz
  • Upload date:
  • Size: 94.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for isa_common-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ea7d832e145c1f21b076a43309d4f42d83524bfb140e894ea1efdec4730a75e6
MD5 37280cb41f3e72c47b9da24a1ef42d5a
BLAKE2b-256 f4db6b80ae7d60e9a1d2ee5bed978c35b5d31456226f19f9f4f3c28a665f48e3

See more details on using hashes here.

File details

Details for the file isa_common-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: isa_common-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 105.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for isa_common-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 540c5f883fdb2aa67d1383b7ab3dbe06201f054c76ae479f060f7d9e82837d15
MD5 ecd7f8b70e5d590bca5627e97ddb7266
BLAKE2b-256 7b1df5a3eb4cdfb27b8c3ab51c349ebc9b4a06712a84cbfdd177fe3203ea4d92

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