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.10.0.tar.gz (13.9 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.10.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hedgebuddy-0.10.0.tar.gz
Algorithm Hash digest
SHA256 bf4e45a2deef204dcdb9a3d025775bb9b0cfcc2843fddc395cb336d52930ad37
MD5 83823dfc9d12ec2a413f7a47a4ef2dd5
BLAKE2b-256 385383cdb91a67439e8929038bf4c9c18364268fd555b1aacfe5b2e8847a1ae6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hedgebuddy-0.10.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.13

File hashes

Hashes for hedgebuddy-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6951043bfe5e35f221aae8ae94e3647bb39f1b15fd35b7e43cec1c22f14c590c
MD5 fa338c3c80ce8a1a5cb108d2ee8d874f
BLAKE2b-256 03f840a5933969b69db4a57033e59328e20d1f177a0d2c25cb695dfb0302f732

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