Skip to main content

Cross-platform environment variable management for Python scripts without system pollution

Project description

HedgeBuddy Python Library

Cross-platform environment variable management without system pollution.

Installation

pip install --user hedgebuddy

Quick Start

import hedgebuddy

# Required variable (raises error if missing)
api_key = hedgebuddy.var("API_KEY")

# Optional with fallback
api_url = hedgebuddy.var("API_URL", "https://api.example.com")

# Optional (None if missing)
email = hedgebuddy.var("REPORT_EMAIL", None)

API

Core Functions

hedgebuddy.var(name, default=...)  # Get variable
hedgebuddy.exists(name)            # Check if exists
hedgebuddy.all_vars()              # Get all as dict
hedgebuddy.inject_env()            # Inject into os.environ

Logging (for headless scripts)

hedgebuddy.enable_logging()        # Enable daily log files
print("This is logged!")           # Captured automatically

hedgebuddy.log("Message")          # Log directly
hedgebuddy.log_error("Error")
hedgebuddy.log_warning("Warning")

Log Location: %APPDATA%\hedgebuddy\logs\ (Windows) · ~/Library/Application Support/hedgebuddy/logs/ (macOS)

Exceptions

hedgebuddy.VariableNotFoundError   # Variable missing (no default)
hedgebuddy.StorageNotFoundError    # active profile vars.json not found
hedgebuddy.StorageCorruptedError   # Invalid JSON

Storage

  • Windows: %APPDATA%\HedgeBuddy\profiles\<active>\vars.json
  • macOS: ~/Library/Application Support/HedgeBuddy/profiles/<active>/vars.json

The library resolves the active profile from profiles.json automatically.

Desktop App

Download from Releases to manage variables with a GUI.

Links

GitHub · Issues · PyPI

MIT License

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

hedgebuddy-0.9.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

hedgebuddy-0.9.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file hedgebuddy-0.9.0.tar.gz.

File metadata

  • Download URL: hedgebuddy-0.9.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for hedgebuddy-0.9.0.tar.gz
Algorithm Hash digest
SHA256 17f916ab22d314986ba2b549cb13d99bb93100d90c5f6c615fa30535d8cad2eb
MD5 801c555b6846adbf96a8c3bf9a6cf8ba
BLAKE2b-256 97d994dfffc0461d7610d4da676f2ad9e095afd6c1bce21f418f2681ebe60028

See more details on using hashes here.

File details

Details for the file hedgebuddy-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: hedgebuddy-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for hedgebuddy-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0153f310d0ae8a159545aeebb00a8434af0516dcaf76eaa1be81eea03434b8d0
MD5 e1cda1893d51a0d077ff5c1ee5928d45
BLAKE2b-256 e5425e792ada5415a038f18bca2e6b2b37abe138685058277ac7d2796b17c6d2

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