Skip to main content

Directory-based configuration registry — file paths become env var names

Project description

uregistry: Directory-based configuration registry

Your config lives in plain files. File paths become env var names, file content becomes the value. No YAML, no JSON, no .env parsers — just a directory tree. 🌳

env/
  AI/
    DEFAULT_MODEL    → AI_DEFAULT_MODEL = "claude-sonnet-4-20250514"
    API_KEY          → AI_API_KEY = "sk-..."
  DEBUG              → DEBUG = "1"

Features

  • 📁 Files are config: Each file is one variable. The path is the name, the content is the value.
  • 🔀 Smart path resolution: Underscores become directories, or use / for explicit control.
  • 🐚 Shell integration: Generate export statements for bash/zsh/fish — drop it into your rc file.
  • 🧹 Zero dependencies: Pure Python, nothing to install beyond the package itself.
  • 🔄 Read, write, delete: Full CRUD for your config with automatic directory cleanup.

Installation

pip install uregistry

Quick Start

from uregistry import load_env, get_env, set_env, delete_env, list_env, dump_shell

# Load all vars from env/ into os.environ
load_env()
load_env("path/to/env")

# Read a single var (does not modify os.environ)
model = get_env("AI_DEFAULT_MODEL")
model = get_env("AI_DEFAULT_MODEL", default="gpt-4o")

# Write a var (creates dirs as needed, updates os.environ)
set_env("AI/API_KEY", "sk-new-key")
set_env("DEBUG", "1")

# Delete a var (removes file, cleans empty dirs)
delete_env("DEBUG")

# List all vars without modifying os.environ
all_vars = list_env()

# Generate shell export statements
print(dump_shell())                    # bash/zsh format
print(dump_shell(shell="fish"))        # fish format

Path Resolution

Use / in names to set explicit directory boundaries:

set_env("AI/CRON_MODEL", "haiku")   # → env/AI/CRON_MODEL

Without /, underscores become directory separators automatically:

set_env("AI_MODEL", "sonnet")       # → env/AI/MODEL

If a file already exists that matches the full var name, it wins — no ambiguity.

Shell Integration

Drop this into your .bashrc / .zshrc and your env dir becomes the source of truth for your shell:

eval "$(python -m uregistry.registry)"

Or for fish, in config.fish:

python -m uregistry.registry --shell fish | source

Auto-detects your shell when run directly, so python -m uregistry.registry just works. 🐟

Why?

  • dotenv files get messy — merge conflicts, quoting bugs, one giant blob.
  • Directory trees are git-friendly, diffable, and you can manage individual vars with standard Unix tools (cat, echo >, rm).
  • Secret management fits naturally — just gitignore sensitive subtrees.

Contributing

Pull requests and issues are welcome!

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

MIT

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

uregistry-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uregistry-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file uregistry-0.1.0.tar.gz.

File metadata

  • Download URL: uregistry-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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

Hashes for uregistry-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c0d2255b0f35e91f9e6ba19dfbb86ee560542ffa6ac6ee37a0e836023306e3fd
MD5 6649a3860c0742f5d776105c14efc235
BLAKE2b-256 cabd004c2c4191bba4038011e2af1d3e9f7a6e43e9ec4c466219f72352c29067

See more details on using hashes here.

File details

Details for the file uregistry-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: uregistry-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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

Hashes for uregistry-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb2c0abd2afa3b533922ad59cfcc317309f681cb90e43a87a0350644bf876851
MD5 12eabe5e0908d692aa3feaa4ef90e11f
BLAKE2b-256 42ca90fb4cfad321a7a78b70ce65bc44037a5d1317b368d3f484dc8d29f5cbb6

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