Skip to main content

A simple CLI for swapping between .env files

Project description

Swap Env

PyPI - Version PyPI - License PyPI - Python Version

swap-env is a simple CLI for swapping between different .env files.

swap-env demo

Installation

  • with pip:
pip install swap-env
  • with uv (recommended):
uv tool install swap-env

Usage

Save any .env files you regularly use to a directory called .swap-env/. This can be in any parent directory of where you want to use it, or in your home directory. Name them .env.<name> and you'll access them via <name> in swap-env.

If you have a local .env file (not a symlink), you will be prompted whether to save it first.

$ ls -A1 ~/.swap-env
.env.dev
.env.test

Then simply run swap-env and select the file you want to use. A symlink will be created at ./.env to that file.

$ swap-env
? Select a .env file:
❯ dev
  test

? Select a .env file: dev

$ ls -l .env
... .env@ -> ~/.swap-env/.env.dev

swap-env will search upwards from the directory you run it in and use the first .swap-env/ directory it finds. If you're not under the home directory, or a .swap-env/ directory isn't found, ~/.swap-env/ will be used (and created if it doesn't exist).

If you create a .swap-env/ directory in a git repo, remember to add it to your .gitignore.

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

swap_env-2.0.0.tar.gz (113.8 kB view details)

Uploaded Source

Built Distribution

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

swap_env-2.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file swap_env-2.0.0.tar.gz.

File metadata

  • Download URL: swap_env-2.0.0.tar.gz
  • Upload date:
  • Size: 113.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Archcraft","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for swap_env-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f201ea62de0d85d23335c96de7fb193452d346cd72475385b1289f6c4bdaf63b
MD5 38c437425d9c667ca58a0ee69f4d4f25
BLAKE2b-256 cea749734d0f5e047d06a0aaad3ef7d6f9f807ff0d5434e66092c67436c7eb8c

See more details on using hashes here.

File details

Details for the file swap_env-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: swap_env-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Archcraft","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for swap_env-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dff09492dd6fb648167ea8863f0f108ec891a2f190d9a4f6086ac8134e82be35
MD5 81bcfabd75172d0c3082744a90779c1e
BLAKE2b-256 48d4b368e6b77b35e44ccfbf5f29dcc8e89a8be1efcb320aa96263c8eb1ecec6

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