Skip to main content

envlit

CI codecov Python Versions PyPI

A simple CLI tool to organize, load, and switch between your project's environment variable contexts.

Installation

pip install envlit

Quick Start

Initialize envlit in your shell (add to .bashrc or .zshrc):

eval "$(envlit init)"

Create a config file at .envlit/default.yaml:

dotenv:
  - "./.env"
  - "./.env.local"

env:
  PROJECT_MODE: "Development"
  DEBUG: "true"

Dotenv paths are relative to the YAML file. Later dotenv files override earlier ones with a warning, and env: overrides dotenv values last. Declared files are required; envlit never auto-discovers .env files.

Load and unload environment variables:

el                       # Load default profile
echo $PROJECT_MODE       # Output: Development (variable set by envlit)
echo $DEBUG              # Output: true (variable set by envlit)

eul                      # Unload environment variables
echo $PROJECT_MODE       # Output: (empty - variable restored to original state)
echo $DEBUG              # Output: (empty - variable restored to original state)

Features

  • Smart state tracking - Detects manual changes and preserves them
  • Dynamic flags - YAML-defined flags become CLI options
  • Path operations - Prepend, append, remove path entries
  • Lifecycle hooks - Run scripts before/after load/unload
  • Config inheritance - Extend base configurations
  • Explicit dotenv imports - Load one or more .env files with deterministic precedence

Comparison with Similar Tools

Feature envlit direnv dotenv
Auto-activation on cd
Manual load/unload
State restoration ✅ Full restore ⚠️ Basic ❌ No
Config format YAML Shell/direnvrc .env
Dynamic CLI flags
PATH operations
Lifecycle hooks ✅ 4 stages ⚠️ Limited
Config inheritance
Manual change detection

Key Differences:

  • envlit: Manual control with explicit load/unload. Full state tracking with restoration. Better for variable contexts that you want to toggle on demand.
  • direnv: Automatically activates on directory change. Great for per-directory isolation but less control over when environments load. Basic restoration.
  • dotenv: Simple .env file loading, no restoration or advanced features. Good for 12-factor apps but lacks state management.

When to use envlit:

  • You want CLI flags that map to environment variables (especially useful for long names and values)
  • You want explicit control over when environments load/unload
  • You need to preserve user modifications and restore clean state
  • You need complex PATH operations or lifecycle hooks

AI Agent Skill

[!TIP] Install the envlit skill to let your AI assistant manage envlit profiles directly.

Claude Code — install via marketplace:

/plugin marketplace add luocfprime/envlit
/plugin install envlit-skill@envlit

Or copy skills/envlit/SKILL.md to ~/.claude/skills/envlit/SKILL.md

Documentation

Visit luocfprime.github.io/envlit for full documentation.

Development

# Install dependencies
make install

# Run tests
pytest

License

MIT License - see LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envlit-0.0.8.tar.gz (34.5 kB view details)

Uploaded Source

Built Distribution

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

envlit-0.0.8-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file envlit-0.0.8.tar.gz.

File metadata

  • Download URL: envlit-0.0.8.tar.gz
  • Upload date:
  • Size: 34.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for envlit-0.0.8.tar.gz
Algorithm Hash digest
SHA256 fcce3639a3d0e3d69c15d7e560f6c801255ab6e49ae47e6be11a38b68c5f30d1
MD5 b29b2fef151156c0095f8bd1f894287c
BLAKE2b-256 35cd4f7c374cac71a2eb3e690f824ded5e65be4e74e7b1ad8bdc660e9efc703c

See more details on using hashes here.

Provenance

The following attestation bundles were made for envlit-0.0.8.tar.gz:

Publisher: release.yml on luocfprime/envlit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file envlit-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: envlit-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for envlit-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 43b459b3ff6a74728d849560366057dcb7b104c296ca85e3233f92266294ce49
MD5 b27d8ce36aa6e773b02b1d796ed84e21
BLAKE2b-256 8b3eee2e9093c17a6fde3ddc17a024f3eb72d9bedf51fd57a79560f0f6d66367

See more details on using hashes here.

Provenance

The following attestation bundles were made for envlit-0.0.8-py3-none-any.whl:

Publisher: release.yml on luocfprime/envlit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

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