Skip to main content

Switch between envrc files

Project description

envrc-switcher

Switch between different .envrc files using an interactive menu.

How it works

Create a envrc file in your home directory for each configuration, named .envrc.<example>. Running envrc-switcher presents an arrow-key menu of available configs. Selecting one copies that file to ~/.envrc and runs direnv allow to activate it.

Installation

Install from PyPi:

pip install -U envrc-switcher

Alternatively you can run directly using uvx:

uvx envrc-switcher

Setup

1. Create config files in ~/:

# ~/.envrc.foo
export foobar=foo
export foo=foo

# ~/.envrc.bar
export foobar=bar
export bar=bar

Config names are derived from the file suffix, so .envrc.foo appears as foo in the menu.

2. Ensure direnv is installed and configured to load ~/.envrc:

brew install direnv
# Add 'eval "$(direnv hook zsh)"' to ~/.zshrc

Usage

envrc-switcher [directory]

The optional directory argument specifies where to look for .envrc.* files. Defaults to the current directory.

? Select config:
> foo
  bar

After selecting, .envrc in the target directory is updated and direnv allow is run. Open a new shell or run direnv reload if the environment does not update immediately.

Requirements

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

envrc_switcher-1.0.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

envrc_switcher-1.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file envrc_switcher-1.0.0.tar.gz.

File metadata

  • Download URL: envrc_switcher-1.0.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for envrc_switcher-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d7204be572ca73db78f4044a51a613e17de9d11b4555e1ef17fd716b696b2992
MD5 29105b15f81788d87a71af39d25da666
BLAKE2b-256 1924f61c426924773d7273ee3ae9a101760a98492fcfe6e4ee94ef6c36fc46c4

See more details on using hashes here.

File details

Details for the file envrc_switcher-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: envrc_switcher-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for envrc_switcher-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb0062bf9bb2e959e7727decfa60e02d1c4846320b23a5029a9dc1d12e62eeb7
MD5 965bf6218dcfdff17673689404f12119
BLAKE2b-256 383a25fa7dfcbb938446363130d19a5bb6058bd8f33c23dc70372249993d77df

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