Generate-Env-Sample
A simple CLI tool to generate .env.sample files from existing .env files. This tool reads your .env file, preserves comments and empty lines, and creates a sample file with keys but without values.
Features
- Preserves comments and empty lines from the original
.envfile. - Generates a clean
.env.samplewith keys set to empty values. - Handles encoding issues, permissions, and file existence gracefully.
- Built with Python and Typer for a smooth CLI experience.
Installation
You can install using one of the following methods:
- Using pipx:
pipx install generate-env-sample
- Using uv:
uv tool install generate-env-sample
- Run directly with pipx:
pipx run generate-env-sample
- Run directly with uvx:
uvx generate-env-sample
Prerequisites
- Python 3.11 or higher
Build Instructions
This project uses uv for management. To build the project, follow these steps:
-
Install
uvby following the uv documentation. -
Clone the repository:
git clone https://github.com/heshinth/generate-env-sample.git cd generate-env-sample
-
Sync the project dependencies using uv sync:
uv sync
Usage
Run the tool from the command line:
generate-env-sample
Options
--file: Specify the.envfile to read from (default:.env)--sample: Specify the output.env.samplefile (default:.env.sample)
Examples
-
Generate
.env.samplefrom the default.env:generate-env-sample
-
Use a custom
.envfile:generate-env-sample --file myenv.env --sample myenv.sample
-
Get help:
generate-env-sample --help
Example Input/Output
Given a .env file like:
# Database configuration
DB_HOST=localhost
DB_PORT=5432
# API keys
API_KEY=your_secret_key
The generated .env.sample will be:
# Database configuration
DB_HOST=
DB_PORT=
# API keys
API_KEY=
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for generate-env-sample 0.1.2
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 |
|---|---|---|---|---|
| generate_env_sample-0.1.2.tar.gz | 2.9 kB | Without provenance | Details for generate_env_sample-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| generate_env_sample-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for generate_env_sample-0.1.2-py3-none-any.whl |
Total release size: 6.9 kB
Release files / generate_env_sample-0.1.2.tar.gz
| Download URL | generate_env_sample-0.1.2.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
614982ac119790b1749afd18cbb83f4ea4beb09c11ceb3d93afaa8676692822b
|
|
BLAKE2b-256 checksum How to use checksums |
a1bf177145d2688439d6d3cc9d27853627c854786fbeb8642aa6f2f4e2261f3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / generate_env_sample-0.1.2-py3-none-any.whl
| Download URL | generate_env_sample-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d87caf07027d4d02d0ca77a8ca5699f21f486284bd58ec37ef90cf6ff7c3f147
|
|
BLAKE2b-256 checksum How to use checksums |
cf6f56abf3a77ed2d1d50abd9ff0bbcb07bcc03c0ff514eb3cd8868c96be9e63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for generate-env-sample 0.1.2
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.