wrapenvars
Encode and decode base64 strings — a tiny, zero-dependency Python utility for obfuscating configuration values, environment variables, or any string data.
Installation
pip install wrapenvars
Requires Python 3.12.13+ (< 3.14).
Usage
from wrapenvars import get_dict, get_str, set_dict, set_str
# ── Strings ─────────────────────────────────────
encoded = set_str("hello world")
# → "aGVsbG8gd29ybGQ="
decoded = get_str(encoded)
# → "hello world"
# ── Dictionaries ────────────────────────────────
token = set_dict({"api_key": "sk-abc123", "region": "us-east-1"})
# → "eyJhcGlfa2V5IjogInNr..."
config = get_dict(token)
# → {"api_key": "sk-abc123", "region": "us-east-1"}
API
| Function | Input | Output | On failure |
|---|---|---|---|
set_str(stream: str) |
Plain string | Base64-encoded string | "" |
get_str(stream: str) |
Base64 string | Decoded string | "" |
set_dict(stream: dict) |
Dictionary | Base64-encoded JSON | "" |
get_dict(stream: str) |
Base64 string | Decoded dictionary | {} |
All functions handle invalid input gracefully — they return a safe default instead of raising exceptions.
Development
git clone https://github.com/deivguerrero/wrapenvars.git
cd wrapenvars
# Create venv and install dev dependencies
uv sync
# Run tests
uv run pytest
# Lint + type-check
uv run ruff check --fix
uv run mypy --strict wrapenvars tests
# Format
uv run ruff format
Pre-commit hooks
pre-commit install
Runs ruff (lint + format), mypy, and basic file checks on every commit.
License
MIT — see LICENSE.
Release files for wrapenvars 0.2.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 | |
|---|---|---|---|
| wrapenvars-0.2.0.tar.gz | 26.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wrapenvars-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.1 kB
Release files / wrapenvars-0.2.0.tar.gz
| Download URL | wrapenvars-0.2.0.tar.gz |
|---|---|
| Size | 26.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbc5654325fec8e3a8d415d95df52600dee5f4d2e49db449d88f792f7e599933
|
|
BLAKE2b-256 checksum How to use checksums |
76fc3fbce29565fed7167f034ac50d6ccd4dfead7350276b7eaecc85930c0f1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / wrapenvars-0.2.0-py3-none-any.whl
| Download URL | wrapenvars-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a9c276deb50c108e00b46553e3e665bfac0750d1d7ba68a405615c2ea072641
|
|
BLAKE2b-256 checksum How to use checksums |
3641380e45f8df3910708638a46e48a31b0fb69331a07e88e51923416700716a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|