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.0.tar.gz (2.6 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.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: universalinit_env-0.1.0.tar.gz
  • Upload date:
  • Size: 2.6 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.0.tar.gz
Algorithm Hash digest
SHA256 0a91d5d3dcf197d3ed90b5eb97007677c2e905f53a08250cea1b0e70c41e1042
MD5 b43d8e09d6aad73c865c9fe96da1f1cf
BLAKE2b-256 3f8fdfae599fad744894e218344b7bd304242cbbad51e8c813459ac28d030de3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for universalinit_env-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df712782383af159849d303477f411a684d5805ee22fb8830b706287aec42ddf
MD5 e664eca19a73eb6c68ffd127704eb5ba
BLAKE2b-256 9f0e99ea125269a326715f176d600048bc3dd800e7b7fe1da0c322ec9fc17106

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