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
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
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 hedgebuddy-0.8.7.tar.gz.
File metadata
- Download URL: hedgebuddy-0.8.7.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a54195c42b561f9aa9aeeb2613253b6e6322e36839e783d3021d00f785c4f51e
|
|
| MD5 |
176ad289bba98595a226bda182d9537e
|
|
| BLAKE2b-256 |
8fd218ced983328b7e3112650cfe95dc28023cb182582fe36cb10d93c5cf137d
|
File details
Details for the file hedgebuddy-0.8.7-py3-none-any.whl.
File metadata
- Download URL: hedgebuddy-0.8.7-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b9148a9f399b79867a14ac9952304d7689b41425123ebf1bf6419f717701504
|
|
| MD5 |
2f63418acd5be4cfb8fb23ca87d0b471
|
|
| BLAKE2b-256 |
460f22a05832c546a3ade9d3675a3de03d8d553a16ffff1b41ba436e45cc8c9b
|