useargus
Load environment variables from Argus over local IPC, with .env fallback — similar to python-dotenv, but secrets come from your Argus bucket when the desktop app is running.
v0.2 — returns Argus proxy connection details so you wire any HTTP library yourself.
Requirements
- Python 3.10+
- Argus desktop signed in (IPC socket active)
- Project
.envwithARGUS_BUCKET_IDandARGUS_BUCKET_TOKEN(not the secret values themselves)
Install
pip install useargus
Usage modes
Without Argus Proxy
When proxy is disabled on the bucket, load_env() injects real secret values into os.environ. Use any HTTP client normally:
import os
import httpx
from useargus import load_env
load_env()
with httpx.Client() as client:
client.get("https://api.example.com", headers={"Authorization": f"Bearer {os.environ['API_KEY']}"})
With Argus Proxy enabled
When proxy is enabled, proxy mappings receive argus-proxy-* placeholders — not real keys. Call load_env(), then wire your HTTP client with SDK helpers:
import httpx
from useargus import load_env, argus_httpx_config
load_env()
client = httpx.Client(**argus_httpx_config(), timeout=60)
See docs/usage for per-library guides (requests, httpx, aiohttp, Anthropic SDK, LangChain, …).
Usage
Call load_env() before other modules read os.environ:
from useargus import load_env
load_env()
When the bucket has Argus Proxy enabled, wire your HTTP client after load_env() using the proxy helpers (see docs/usage).
Migration from python-dotenv
# Before
from dotenv import load_dotenv
load_dotenv()
# After
from useargus import load_env
load_env()
Project .env
ARGUS_BUCKET_ID=550e8400-e29b-41d4-a716-446655440000
ARGUS_BUCKET_TOKEN=tok_...
# Optional local overrides (override bucket values for the same key)
# DATABASE_URL=postgresql://localhost/dev
Copy .env.example to get started.
How it works
- Parse
.env(no side effects yet). - If
ARGUS_BUCKET_IDandARGUS_BUCKET_TOKENare set (OS env or.env), connect to Argus over IPC and fetch mapped secrets. - Apply bucket values to
os.environ. - Apply
.env— duplicate keys use the.envvalue (overrides bucket). - If bucket credentials are missing, load
.envonly (standard dotenv behavior).
Argus app lock vs sign-out
| State | IPC |
|---|---|
| Signed in, idle app lock | Works — approval popup may appear for new clients |
| Signed out | Returns locked — use fallback_on_locked=True to load .env only |
Idle app lock does not block IPC. Only sign-out returns IPC locked.
First run
The first time a process connects, Argus shows an access approval dialog (up to ~120s). Later requests use the grant TTL from bucket settings.
API
load_env(...)
from useargus import load_env
result = load_env(
path=".env", # default: .env in cwd
override=False, # dotenv-only mode: don't override existing OS env
timeout_ms=130_000, # IPC timeout
fallback_on_locked=False, # if signed out, load .env instead of raising
)
# result.source == "bucket" | "dotenv"
# result.keys — names set (never values)
Proxy wiring
After load_env(), use per-library config helpers and builders where needed:
from useargus import argus_httpx_config, create_argus_requests_proxy_adapter
client = httpx.Client(**argus_httpx_config(), timeout=60)
| Kind | Functions |
|---|---|
| Config | argus_requests_config(), argus_httpx_config(), argus_aiohttp_config(), argus_urllib_config() |
| Builders | create_argus_requests_proxy_adapter() / create_argus_requests_proxy_adapter_class() |
Per-library copy-paste examples: docs/usage/
Low-level IPC fields remain on require_proxy_config() / get_proxy_config().
fetch_bucket_env(...)
Lower-level IPC call if you only need the bucket map:
import os
from useargus import fetch_bucket_env
env = fetch_bucket_env(
bucket_id=os.environ["ARGUS_BUCKET_ID"],
client_token=os.environ["ARGUS_BUCKET_TOKEN"],
)
Errors
All errors extend ArgusError with .code and optional .request_id. Catch specific types for programmatic handling:
| Error | Argus IPC | When |
|---|---|---|
ArgusConnectionError |
— | Socket/pipe missing, timeout, connection closed |
ArgusLockedError |
status: locked |
Argus signed out |
ArgusApprovalDeniedError |
denied + APPROVAL_DENIED |
User rejected client access |
ArgusApprovalTimeoutError |
denied + APPROVAL_TIMEOUT |
Approval dialog timed out (120s) |
ArgusBucketNotFoundError |
BUCKET_NOT_FOUND |
Wrong ARGUS_BUCKET_ID |
ArgusInvalidTokenError |
INVALID_TOKEN |
Wrong or rotated ARGUS_BUCKET_TOKEN |
ArgusBucketInactiveError |
BUCKET_INACTIVE |
Bucket paused in Argus |
ArgusPeerResolveError |
PEER_RESOLVE |
Argus could not identify this process |
ArgusProxyError |
PROXY_ERROR |
Proxy enabled but misconfigured |
ArgusInvalidRequestError |
INVALID_REQUEST |
Malformed IPC request |
ArgusInvalidResponseError |
— | Unexpected Argus response |
ArgusConfigureError |
— | Proxy unavailable or disabled for bucket |
ArgusError |
other error codes |
DB_ERROR, INTERNAL_ERROR, etc. |
Proxy cookbook
Call load_env() first in every example. Full guides: docs/usage/
requests
import requests
from useargus import load_env, argus_requests_config, create_argus_requests_proxy_adapter
load_env()
cfg = argus_requests_config()
session = requests.Session()
session.proxies.update(cfg["proxies"])
session.verify = cfg["verify"]
session.trust_env = cfg["trust_env"]
adapter = create_argus_requests_proxy_adapter()
session.mount("https://", adapter)
session.mount("http://", adapter)
httpx
import httpx
from useargus import load_env, argus_httpx_config
load_env()
client = httpx.Client(**argus_httpx_config(), timeout=30)
Other libraries
See docs/usage/ for aiohttp, urllib, Anthropic SDK, and LangChain.
Package layout
useargus/env/load.py—load_envuseargus/proxy/config.py—get_proxy_config,require_proxy_config,proxy_urluseargus/proxy/wiring.py— per-library proxy config and buildersuseargus/ipc/client.py— IPC client,ProxyConfiguseargus/errors.py— error types
Development
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
pip install -e ".[dev]"
ruff check .
mypy useargus
pytest
python -m build
Publish
Publishing is manual via GitHub Actions (adding PYPI_TOKEN alone does not publish).
- Add repository secret
PYPI_TOKEN(PyPI API token with publish rights). - Go to Actions → Publish to PyPI → Run workflow.
- Enter the version (e.g.
0.2.0orv0.2.0).
The workflow runs CI, sets pyproject.toml version, publishes to PyPI, tags v<version>, and creates a GitHub release.
License
MIT
Metadata
Release files for useargus 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| useargus-0.3.0.tar.gz | 14.1 kB | Without provenance | Details for useargus-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| useargus-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for useargus-0.3.0-py3-none-any.whl |
Total release size: 30.9 kB
Release files / useargus-0.3.0.tar.gz
| Download URL | useargus-0.3.0.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
166cff505c542d1bf99ff6d7e7446f325a3e248deb15924af4f32838ee047798
|
|
BLAKE2b-256 checksum How to use checksums |
d062c30ef3871e59268b24a6a377e47a85d708123368a74fa28ffdda09862676
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / useargus-0.3.0-py3-none-any.whl
| Download URL | useargus-0.3.0-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3c081de92f1c6019872571ac0ef5e9a9582eba0b8a2f04c0fe7cd9263b6dc55
|
|
BLAKE2b-256 checksum How to use checksums |
a83bdb2d893bc7e3178f9f6ca58579b0b8d33d530e3317c3bc9f344b529b9c7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for useargus 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.