Skip to main content

No project description provided

Project description

CAC Core

An API client library providing essential functionality for command-line applications.

Overview

CAC Core (cac_core) is a Python library that provides common utilities for building robust command-line applications. It includes modules for configuration management, standardized logging, data modeling, and formatted output display.

Features

  • Configuration Management: Load/save configs from YAML files with environment variable support
  • Standardized Logging: Consistent, configurable logging across applications
  • Data Modeling: Dynamic attribute creation and manipulation with dictionary-like access
  • Output Formatting: Display data as tables or JSON with customization options

Installation

# Install from PyPI
pip install cac-core

# Or install with Poetry
poetry add cac-core

Usage

Configuration

import cac_core as cac

# Load configuration
config = cac.config.Config("myapp")
server_url = config.get("server", "default-value")

# Update configuration
config.set("api_key", "my-secret-key")
config.save()

Logging

import cac_core as cac

# Create a logger
logger = cac.logger.new(__name__)
logger.info("Application started")
logger.debug("Debug information")

Data Models

import cac_core as cac

# Create data model
data = {
    "name": "Project X",
    "status": "active",
    "metadata": {
        "created": "2025-01-01",
        "version": "1.0"
    }
}

model = cac.model.Model(data)
print(model.name)  # "Project X"
print(model.metadata.version)  # "1.0"

Output Formatting

import cac_core as cac

# Create output handler
output = cac.output.Output({"output": "table"})

# Display data as table
models = [model1, model2, model3]
output.print_models(models)

# Display as JSON
output = cac.output.Output({"output": "json"})
output.print_models(models)

Development

# Clone the repository
git clone https://github.com/rpunt/cac_core.git
cd cac_core

# Install dependencies
poetry install

# Run tests
poetry run pytest

Project Structure

  • config.py - Configuration management
  • logger.py - Standardized logging
  • model.py - Data modeling utilities
  • output.py - Output formatting

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

cac_core-0.2.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

cac_core-0.2.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file cac_core-0.2.0.tar.gz.

File metadata

  • Download URL: cac_core-0.2.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/24.4.0

File hashes

Hashes for cac_core-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2cf2603c56ecd971d7ba8d5efbda6bcf4db39b2c36511911efef1cba32e27090
MD5 73e00ae589c42aef9c1be5f0bc845bde
BLAKE2b-256 8df9f22566cb49178dccc390a271781252e08f9cb5a7fc6f63cf0c0f97756f2b

See more details on using hashes here.

File details

Details for the file cac_core-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cac_core-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/24.4.0

File hashes

Hashes for cac_core-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 215d6e7f48fba0011f18749deee47ed7671cd6107acbf836ae980fa7a40ae4ab
MD5 2a88c60bdedc6e85e410849bf1150187
BLAKE2b-256 d5d6dcd1f91ebba83501c8c1306db1245cac34b6c88eb6eacd84a65b500a2ebc

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