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.3.tar.gz (3.4 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.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: universalinit_env-0.1.3.tar.gz
  • Upload date:
  • Size: 3.4 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.3.tar.gz
Algorithm Hash digest
SHA256 70fb32d1d6d8734baea7e5e2860070e11796181658c2766758c263a4c04b9f05
MD5 9605c7738ac599f508634569cca4844e
BLAKE2b-256 d7bb18ae7922550577fb65991ccd5fd9b8d7fc13b69711097f03d8178c5bfc5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for universalinit_env-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 69e55f6f2321fa0ba5e0bf90678907f6fda73ec8a500144219b890f7398c6f32
MD5 f90bb0237cdc7443403275acb6c41021
BLAKE2b-256 9e566b424799871c454753513758987610076acb19a4243748a62905c69d9c4f

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