Skip to main content

EnvProfile - Environment Variable Profile Manager

Python Tests PyPI version License: MIT

EnvProfile is a tool that lets you create and manage different sets of environment variables that you can easily load when needed. This is particularly useful for developers who work with different projects that require different environment configurations.

Features

  • Create multiple named environment profiles
  • Add, remove, and update environment variables in profiles
  • Load environment variables from profiles into your current shell
  • List available profiles and view their contents
  • Easy to use command-line interface

Installation

From PyPI (Recommended)

pip install envprofile

From Source

# Clone the repository
git clone https://github.com/yourusername/envprofile.git
cd envprofile

# Install the package
pip install -e .

Shell Integration

Add a shell function to your .bashrc, .zshrc, or equivalent shell configuration file:

# Add this to your shell configuration file
function use-env() {
    eval "$(envprofile load $1)"
}

Reload your shell configuration:

source ~/.bashrc  # or ~/.zshrc

Usage Examples

Creating Profiles

# Create a new profile for development environment
envprofile create dev

# Add environment variables to the profile
envprofile add dev DB_HOST localhost
envprofile add dev DB_PORT 5432
envprofile add dev API_KEY dev_api_key_123
envprofile add dev DEBUG true

# Create another profile for production
envprofile create prod
envprofile add prod DB_HOST production.example.com
envprofile add prod DB_PORT 5432
envprofile add prod API_KEY prod_api_key_456
envprofile add prod DEBUG false

Managing Profiles

# List all available profiles
envprofile list

# Show details of a specific profile
envprofile show dev

# Remove a variable from a profile
envprofile remove dev DEBUG

# Delete an entire profile
envprofile delete test

Loading Profiles

# Method 1: Using the shell function defined during installation
use-env dev

# Method 2: Direct evaluation
eval $(envprofile load prod)

Checking Active Environment Variables

# After loading a profile, you can verify the environment variables are set
echo $DB_HOST
echo $API_KEY

Configuration

All profiles are stored in a single JSON file at ~/.config/envprofile/profiles.json. The format is:

{
  "dev": {
    "DB_HOST": "localhost",
    "DB_PORT": "5432",
    "API_KEY": "dev_api_key_123"
  },
  "prod": {
    "DB_HOST": "production.example.com",
    "DB_PORT": "5432",
    "API_KEY": "prod_api_key_456"
  }
}

Advanced Usage

Using with Docker

You can use EnvProfile to generate environment files for Docker:

# Generate a .env file for docker-compose
envprofile load dev > .env

Using with Multiple Projects

Create project-specific profiles by using prefixes:

# Create profiles for different projects
envprofile create project1-dev
envprofile create project1-prod
envprofile create project2-dev

Troubleshooting

Common Issues

Issue: Changes to environment variables not appearing in the shell

Solution: Make sure you're using the eval command or the use-env function as described in the installation section.

Issue: Error "command not found: envprofile"

Solution: Ensure that the installation directory is in your PATH or install using pip.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Inspired by various environment management tools like direnv and autoenv
  • Thanks to all contributors

Metadata

Release files for envprofile 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for envprofile 0.1.0
File Size Uploaded Provenance
envprofile-0.1.0.tar.gz 11.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for envprofile 0.1.0
File Interpreter ABI Platform
envprofile-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / envprofile-0.1.0.tar.gz

Download URL envprofile-0.1.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3220388d0bbc7c9db15122e6e8188e17350fa7503148a84839919c3a320a4815
BLAKE2b-256 checksum
How to use checksums
36f55cffc21da75665ec470f98b138efcc36e8984d1838c77da06d2d6fe66945
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / envprofile-0.1.0-py3-none-any.whl

Download URL envprofile-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5dc2384f9eb03c3f3c2d18206f3dcef71054dea94d57ba0a2d92aec942f5b46
BLAKE2b-256 checksum
How to use checksums
fccd4048a6e7b9cb6fd5f06f6f56ee580620388e408964061b6f1b0b10ca91c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for envprofile 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page