Shared utilities for CGC Studio applications
Project description
Cindergrace Common
Status: Final
Internal Use Only - This repository is public solely for integration with free-tier code analysis tools (Codacy). It is not intended for external use, contribution, or distribution. No support is provided.
Shared utilities for Cindergrace applications.
Installation
pip install cindergrace-common
With optional dependencies:
pip install cindergrace-common[gradio] # Gradio theme support
pip install cindergrace-common[secrets] # OS Keyring support
pip install cindergrace-common[dev] # Development tools
Features
- Configuration: Type-safe environment variable helpers
- Security: Localhost-by-default server binding, feature flags
- Branding: Centralized logo and CSS loading
- i18n: YAML-based translations
- State: XDG-compliant JSON persistence
- Logging: Unified logging setup with colored output
- Paths: Path traversal protection utilities
- Secrets: OS Keyring integration for API keys (v0.3.0)
- Gradio: Consistent theming for Gradio apps
Quick Start
from cindergrace_common import (
BaseConfig, SecurityMixin, BrandingMixin,
env_int, env_bool, setup_logging
)
logger = setup_logging("myapp")
class Config(BaseConfig, SecurityMixin, BrandingMixin):
APP_PREFIX = "MYAPP"
PORT = env_int("MYAPP_PORT", 7865)
# Server binds to localhost by default
# Set MYAPP_ALLOW_REMOTE=1 for network access
server_name = Config.get_server_bind()
Secure API Key Storage (v0.3.0)
from cindergrace_common import SecretStore
secrets = SecretStore("myapp")
secrets.set("API_TOKEN", "secret123") # Stores in OS Keyring
token = secrets.get("API_TOKEN") # Retrieves from Keyring
Environment Variables
| Variable | Description |
|---|---|
{PREFIX}_PORT |
Server port |
{PREFIX}_ALLOW_REMOTE |
Set to 1 for network access |
{PREFIX}_ENABLE_{FEATURE} |
Enable specific features |
CINDERGRACE_BRANDING_PATH |
Path to branding assets |
{SERVICE}__{KEY} |
Fallback for secrets when keyring unavailable |
License
MIT
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 Distribution
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 cgc_common-0.6.0.tar.gz.
File metadata
- Download URL: cgc_common-0.6.0.tar.gz
- Upload date:
- Size: 43.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb7a997dd886888525484b1dd3df7c63c75d2263625e783f456ac656adf73d01
|
|
| MD5 |
3ac4fff7645ee300dfb4cb4b5015351f
|
|
| BLAKE2b-256 |
1f7d49c94443be22a28e9b8d5adb61c0cd55c6ede8e414f22dcae73f2ab56706
|
File details
Details for the file cgc_common-0.6.0-py3-none-any.whl.
File metadata
- Download URL: cgc_common-0.6.0-py3-none-any.whl
- Upload date:
- Size: 40.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1074e860816dee974ca1c46551879ec2e05d1bc5955e117de67cab178a6d8ccf
|
|
| MD5 |
3d345546b9242824c587f9ed9f25c7a0
|
|
| BLAKE2b-256 |
2aa7616b962e2d9e07725a6eaa72fe60f2979c7c959cfbb8c40855a5eb6834db
|