Swap Env
swap-env is a simple CLI for swapping between different .env files.
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.
Metadata
Release files for swap-env 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swap_env-2.0.1.tar.gz | 113.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swap_env-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.5 kB
Release files / swap_env-2.0.1.tar.gz
| Download URL | swap_env-2.0.1.tar.gz |
|---|---|
| Size | 113.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a70f0e17a9d375415a2aadb7c344a9fb8c460a35aa397506252e6ec7ccc0b7f5
|
|
BLAKE2b-256 checksum How to use checksums |
eccd73e6808aecb374cbf5d6962318074f7163f3cce108dc1d89eb81992b12e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / swap_env-2.0.1-py3-none-any.whl
| Download URL | swap_env-2.0.1-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7fd21518475520b80da857cc85bf791bae8cae2db4255b530bc717093e2f5d9
|
|
BLAKE2b-256 checksum How to use checksums |
92f33fb3d4324608fb9940d4e807d5f0da7cf24adcbf9f3175f44b2e802122a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|