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.1.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.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hedgebuddy-0.9.1.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.1.tar.gz
Algorithm Hash digest
SHA256 0b51426087944f15781d9af22fca9f1b3c973b1a316de4ad9edba27ba19ef4a3
MD5 88f607cab446a05d9c2687c3e751137d
BLAKE2b-256 af7c8ef8b5dd577cd1811a8ee243366f01cc5a0e24a2c31dcacde253382a51c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hedgebuddy-0.9.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75bc492971cc6c270cf03caebe9547626c0fe05f70e3bfe2b9d7976edc6fd090
MD5 f7712e7cda7c69c61152e25d28a78de5
BLAKE2b-256 d70ddfe6ff8ca131074e99f4fc50ccd88125a6bfdc4e75d7d05547da4e01c6ab

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