pyenvedit
A CLI tool for editing .env files with an intuitive interface. Edit environment variables from the command line or through an interactive TUI.
Installation
Install from PyPI:
pip install pyenvedit
Usage
Command Line Interface
Display .env file contents
pyenvedit .env
Add a new environment variable
pyenvedit .env --add API_KEY=your_api_key_here
pyenvedit .env --add DATABASE_URL=postgresql://localhost/mydb
Edit an existing environment variable
pyenvedit .env --edit API_KEY=new_api_key_value
pyenvedit .env --edit DEBUG=true
Remove an environment variable
pyenvedit .env --remove API_KEY
pyenvedit .env --remove UNUSED_VAR
Interactive TUI Mode
Launch the interactive TUI by running pyenvedit without any flags on a non-existent file:
pyenvedit myproject.env
The TUI provides:
- View: Browse all environment variables in a table
- Add: Add new variables through a modal dialog
- Edit: Edit existing variables by selecting them and clicking "Edit Selected"
- Delete: Remove variables by selecting them and clicking "Delete Selected"
- Navigation: Use arrow keys to navigate, Enter to select
Key Features
- Safe editing: Preserves comments and formatting
- Validation: Ensures variable names follow proper conventions
- Error handling: Clear error messages for invalid operations
- Cross-platform: Works on Windows, macOS, and Linux
- UTF-8 support: Handles international characters in values
Examples
Basic Usage
# Display current .env file
pyenvedit
# Add a database URL
pyenvedit --add DATABASE_URL=sqlite:///app.db
# Update an API key
pyenvedit --edit API_KEY=sk-new-key-12345
# Remove an old variable
pyenvedit --remove OLD_API_KEY
# Edit a different env file
pyenvedit config/staging.env --add REDIS_URL=redis://localhost:6379
Interactive Mode
# Launch TUI for current directory's .env
pyenvedit
# Launch TUI for specific file
pyenvedit config/production.env
File Format Support
pyenvedit works with standard .env file format:
# Comments are preserved
API_KEY=your_key_here
DATABASE_URL=postgresql://user:pass@localhost/db
DEBUG=true
# Quoted values are supported
MESSAGE="Hello, World!"
PATH='/usr/local/bin:/usr/bin'
Requirements
- Python 3.8 or higher
- textual >= 0.40.0
- click >= 8.0.0
Development
To set up for development:
git clone https://github.com/marcokotrotsos/envedit
cd envedit
pip install -e .
License
MIT License
Metadata
Release files for pyenvedit 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyenvedit-0.2.0.tar.gz | 7.6 kB | Without provenance | Details for pyenvedit-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyenvedit-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pyenvedit-0.2.0-py3-none-any.whl |
Total release size: 16.1 kB
Release files / pyenvedit-0.2.0.tar.gz
| Download URL | pyenvedit-0.2.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94d8bd0330212712330d51f73c471f278a289c4102b17ed14a9b06e76de83534
|
|
BLAKE2b-256 checksum How to use checksums |
884e2f7a48259b18b93c9a68a22d72723460b52cbadf8da4d619db1550b0de94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / pyenvedit-0.2.0-py3-none-any.whl
| Download URL | pyenvedit-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
337132f26a315bbaa15ae97c21fba2df6249d4722fe1007436f326456c065a4a
|
|
BLAKE2b-256 checksum How to use checksums |
6d23a13b165a4d25aa2795b90376f659c7473e18d1cdf880ae42eb34355a3618
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for pyenvedit 0.2.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.