Skip to main content

Core backend & SxT client utilities for Irys Cloud

Project description

Irys Core Backend

Folder Structure Overview

irys-core-backend/
│
├── .env                        # Environment variables for SxT, Google, etc.
├── googleSecretManager.json    # Google Cloud service account credentials
├── main.py                     # FastAPI entrypoint, includes SxT router
├── pyproject.toml              # Project metadata and dependencies
├── README.md                   # Project documentation
│
├── src/
│   └── irys_core/
│       ├── __init__.py
│       ├── config.py           # Loads settings from .env using pydantic
│       ├── errors.py           # Custom exception classes for error taxonomy
│       ├── requirement.txt     # Python dependencies
│       ├── utils.py            # Utility functions
│       ├── caching.py          # Caching logic (e.g., Redis)
│       ├── idempotency.py      # Idempotency helpers
│       ├── logging.py          # Logging setup
│       │
│       ├── auth/
│       │   ├── auth0.py        # Auth0 integration
│       │   ├── base.py         # Base authentication logic
│       │   └── sxt_token_refresher.py # SxT token refresh logic
│       │
│       ├── redis/
│       │   └── client.py       # Redis client setup
│       │
│       └── sxt/
│           ├── __init__.py
│           ├── biscuit_gsm.py  # Fetches biscuits from Google Secret Manager
│           ├── sxt_auth.py     # Handles SxT authentication, token retrieval (with retry/timeout)
│           ├── sxt_client.py   # Main SxT SQL query wrapper (retry, timeout, biscuit support)
│           ├── sxt_models.py   # Pydantic models for SxT requests/responses
│           ├── sxt_routes.py   # FastAPI routes for SxT endpoints
│           └── __pycache__/    # Python bytecode cache
│
├── tests/
│   ├── conftest.py             # Pytest fixtures
│   ├── test_auth.py            # Auth module tests
│   ├── test_redis.py           # Redis client tests
│   ├── test_sxt_client.py      # SxT client tests (add more coverage!)
│   └── data/
│       └── sample_payload.json # Example payloads for tests
│
└── .github/
    └── workflows/
        ├── ci.yml              # CI pipeline
        └── release.yml         # Release automation

Key Logic & Loops

  • main.py: Starts FastAPI app, includes SxT router for SQL endpoints.
  • config.py: Loads all environment variables (API keys, URLs, biscuits) for SxT and Google integration.
  • errors.py: Defines custom exceptions for authentication, query, and biscuit errors.
  • sxt_auth.py: Handles SxT authentication. Implements retry and timeout logic using tenacity for robust token fetching.
  • sxt_client.py: Core wrapper for SxT SQL queries. Supports:
    • Biscuit tokens for tenant/schema access.
    • Retry and timeout for stability.
    • Uses environment variables for connection.
  • sxt_models.py: Pydantic models for request/response validation (e.g., SQLRequest, SQLResponse).
  • biscuit_gsm.py: Fetches biscuit tokens from Google Secret Manager for secure access.
  • sxt_routes.py: FastAPI endpoints for SxT operations, connects HTTP requests to backend logic.
  • tests/: Contains unit tests for authentication, Redis, and SxT client. (Expand coverage for error scenarios!)

Important Loops

  • Retry Logic: Both authentication (sxt_auth.py) and query execution (sxt_client.py) use retry loops via tenacity to handle transient errors and timeouts.
  • Biscuit Fetching: biscuit_gsm.py& biscuit_query() loops through BISCUIT_REGISTRY (spacetime table) and then Google Secret Manager to fetch the biscuits for particular category.

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

irys_core-0.5.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

irys_core-0.5.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file irys_core-0.5.0.tar.gz.

File metadata

  • Download URL: irys_core-0.5.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for irys_core-0.5.0.tar.gz
Algorithm Hash digest
SHA256 f05acb6f5d6161eb4bbb601808ab02bfabef3cf847ee3203620c52fe73d05dd0
MD5 93ca6695cd41063052aa352f68a1507f
BLAKE2b-256 e3b5acabe6b39a3981f14ff697512f987da7e3072b65d8b33ba9e0910477790b

See more details on using hashes here.

File details

Details for the file irys_core-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: irys_core-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for irys_core-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b153e289ab74bc951cf69a790c7f1ccac85a5530b63d08dd7dfc56114446fb75
MD5 bd0cc3a0468fdeeed5e52663c6901010
BLAKE2b-256 c513973df712f8c3ce1fca9a290c783116141b426a308e6ebc97cc6eb1c8804c

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