SAGE Core Common Utilities
Project description
SAGE Common
Core utilities and shared components for the SAGE framework
๐ Overview
SAGE Common provides essential shared utilities and components used across all SAGE packages. This is the foundation layer that provides:
- Configuration management for YAML/TOML files
- Logging framework with custom formatters and handlers
- Network utilities for TCP/UDP communication
- Serialization tools with dill and pickle support
- System utilities for environment and process management
- Embedding services (sage_embedding, sage_llm)
This package ensures consistency and reduces code duplication across the SAGE ecosystem.
โจ Key Features
- Unified Configuration: YAML/TOML configuration loading and validation
- Advanced Logging: Colored output, structured logging, and custom formatters
- Network Utilities: TCP client/server, network helpers
- Flexible Serialization: Multiple backends (dill, pickle, JSON)
- System Management: Environment detection, process control
- LLM Integration: Embedding and VLLM services
Core Modules
- utils.config: Configuration management utilities
- utils.logging: Logging framework and formatters
- utils.network: Network utilities and TCP clients/servers
- utils.serialization: Serialization utilities including dill support
- utils.system: System utilities for environment and process management
- _version: Version management
๐ฆ Package Structure
sage-common/
โโโ src/
โ โโโ sage/
โ โโโ common/
โ โโโ __init__.py
โ โโโ _version.py
โ โโโ utils/ # Core utilities
โ โ โโโ config/ # Configuration management
โ โ โโโ logging/ # Logging framework
โ โ โโโ network/ # Network utilities
โ โ โโโ serialization/ # Serialization tools
โ โ โโโ system/ # System utilities
โ โโโ components/ # Shared components
โ โโโ sage_embedding/ # Embedding service
โ โโโ sage_llm/ # VLLM service
โโโ tests/
โโโ pyproject.toml
โโโ README.md
๐ Installation
Basic Installation
pip install sage-common
Development Installation
cd packages/sage-common
pip install -e .
With Optional Dependencies
# With embedding support
pip install sage-common[embedding]
# With VLLM support
pip install sage-common[vllm]
# Full installation
pip install sage-common[all]
๐ Quick Start
Configuration Management
from sage.common.utils.config.loader import ConfigLoader
# Load configuration
config = ConfigLoader("config.yaml")
# Access configuration
model_name = config.get("model.name", default="default-model")
Logging
from sage.common.utils.logging.custom_logger import get_logger
# Get logger
logger = get_logger(__name__)
# Use logger
logger.info("Application started")
logger.debug("Debug information")
logger.error("Error occurred", exc_info=True)
Network Utilities
from sage.common.utils.network import TCPClient, TCPServer
# Create TCP server
server = TCPServer(host="localhost", port=8080)
server.start()
# Create TCP client
client = TCPClient(host="localhost", port=8080)
client.connect()
client.send(b"Hello, Server!")
Serialization
from sage.common.utils.serialization import serialize, deserialize
# Serialize data
data = {"key": "value", "numbers": [1, 2, 3]}
serialized = serialize(data, format="dill")
# Deserialize data
restored = deserialize(serialized, format="dill")
๐ง Configuration
Configuration files are typically in YAML or TOML format:
# config.yaml
logging:
level: INFO
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
network:
host: localhost
port: 8080
timeout: 30
embedding:
model: sentence-transformers/all-MiniLM-L6-v2
device: cuda
๐งช Testing
# Run unit tests
pytest tests/unit
# Run integration tests
pytest tests/integration
# Run with coverage
pytest --cov=sage.common --cov-report=html
๐ Documentation
- User Guide: See docs-public
- API Reference: See package docstrings and type hints
- Examples: See
examples/directory in each module
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Related Packages
- sage-kernel: Uses common utilities for runtime management
- sage-libs: Builds on common components for libraries
- sage-middleware: Uses network and serialization utilities
- sage-tools: Uses configuration and logging utilities
๐ฎ Support
- Documentation: https://intellistream.github.io/SAGE-Pub/
- Issues: https://github.com/intellistream/SAGE/issues
- Discussions: https://github.com/intellistream/SAGE/discussions
Part of the SAGE Framework | Main Repository
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file isage_common-0.2.0-py3-none-any.whl.
File metadata
- Download URL: isage_common-0.2.0-py3-none-any.whl
- Upload date:
- Size: 1.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a458025c157deca7b4f8861fcf39a25c4e8ca9e82429849ad8314aad37f8c699
|
|
| MD5 |
61b4b8ed8514381b4e4bb2a078cd2f1b
|
|
| BLAKE2b-256 |
2559e47c7f8c2d866da81db2f301f475a4ea1b233cbca83295d0f9b50f179b40
|