Skip to main content

Environment variable mapping utilities for UniversalInit framework

Project description

UniversalInit Environment Package

A Python package for mapping environment variables between different frameworks and a common format.

Features

  • Map environment variables from framework-specific formats to a common format
  • Map environment variables from common format to framework-specific formats
  • Support for multiple frameworks through template files
  • Easy extensibility for new frameworks

Installation

pip install universalinit-env

Usage

Basic Usage

from universalinit_env import map_framework_to_common, map_common_to_framework

# Map React-specific env vars to common format
react_env = {
    "REACT_APP_SUPABASE_URL": "https://example.supabase.co",
    "REACT_APP_API_KEY": "your-api-key",
    "REACT_APP_DATABASE_URL": "postgresql://..."
}

common_env = map_framework_to_common("react", react_env)
# Result: {"SUPABASE_URL": "https://example.supabase.co", ...}

# Map common env vars to React format
framework_env = map_common_to_framework("react", common_env)
# Result: {"REACT_APP_SUPABASE_URL": "https://example.supabase.co", ...}

Available Functions

  • get_template_path(framework): Get the path to the environment template file for a given framework
  • parse_template_file(template_path): Parse a template file and extract the mapping
  • map_common_to_framework(framework, common_env): Map common environment variables to framework-specific ones
  • map_framework_to_common(framework, framework_env): Map framework-specific environment variables to common ones
  • get_supported_frameworks(): Get a list of supported frameworks

Supported Frameworks

Currently supports:

  • React (via react/env.template)

Adding New Frameworks

To add support for a new framework:

  1. Create a new directory under src/universalinit_env/ with your framework name
  2. Add an env.template file with mappings in the format:
    FRAMEWORK_VAR = COMMON_VAR
    
  3. The framework will automatically be detected and available

Development

# Install dependencies
poetry install

# Run tests
pytest

License

Same license as the main UniversalInit project.

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

universalinit_env-0.1.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

universalinit_env-0.1.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file universalinit_env-0.1.1.tar.gz.

File metadata

  • Download URL: universalinit_env-0.1.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for universalinit_env-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7d420ba60e78aee8b6e886132f5b1ee477f85c526753add47bd5c66fd085ecbf
MD5 5ee5760220b43bbc7deb089396184575
BLAKE2b-256 cdb73eabef906840ab6158ba1b99644f83133ade46cd48145aac18d70bf9a87a

See more details on using hashes here.

File details

Details for the file universalinit_env-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for universalinit_env-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fdb63329089353828a1a00d79a96191e27f25ed3dbbac8a50e80106d385d5d86
MD5 ac8e688ed62dea3ef757df172651537f
BLAKE2b-256 9b2ac2a92ffef396973894b91fccb4059e0ac639cade4f9012359bd1f3bb2da6

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