encode/decode base64 strings
Project description
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.
Project details
Release history Release notifications | RSS feed
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 wrapenvars-0.2.0.tar.gz.
File metadata
- Download URL: wrapenvars-0.2.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbc5654325fec8e3a8d415d95df52600dee5f4d2e49db449d88f792f7e599933
|
|
| MD5 |
9201e223902663ccafd24c34aa8503c8
|
|
| BLAKE2b-256 |
76fc3fbce29565fed7167f034ac50d6ccd4dfead7350276b7eaecc85930c0f1e
|
File details
Details for the file wrapenvars-0.2.0-py3-none-any.whl.
File metadata
- Download URL: wrapenvars-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a9c276deb50c108e00b46553e3e665bfac0750d1d7ba68a405615c2ea072641
|
|
| MD5 |
a8ffc313b64c09a7ae2478f515ebdfd8
|
|
| BLAKE2b-256 |
3641380e45f8df3910708638a46e48a31b0fb69331a07e88e51923416700716a
|