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.2.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.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: universalinit_env-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 ddff7a3f949dfe969992752331b337979ac2e5539cc2390bd6d0951d35b6cd6c
MD5 ccea2ab91989ee692c16d3b882f9db6d
BLAKE2b-256 a2a4dd5cbad0f3aefb8eb29fc24b440db4b267e72c58fc4751bc8e3ebe9f4349

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for universalinit_env-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6a49dd0676bef4c9d39c756383b24a0c52f18f38bd34da601fe420f73ef275b4
MD5 2e6c544691b2af748d1393c876866cc2
BLAKE2b-256 805b5069a497524590ab5d698fa7fbfc40f3c89ae659fd77fc14d02f2888c2b7

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