# 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 `.env` file.
- Generates a clean `.env.sample` with 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:
```sh
pipx install generate-env-sample
```
- Using uv:
```sh
uv tool install generate-env-sample
```
- Run directly with pipx:
```sh
pipx run generate-env-sample
```
- Run directly with uvx:
```sh
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:
1. Install `uv` by following the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/).
2. Clone the repository:
```bash
git clone https://github.com/heshinth/generate-env-sample.git
cd generate-env-sample
```
3. Sync the project dependencies using uv sync:
```bash
uv sync
```
## Usage
Run the tool from the command line:
```bash
generate-env-sample
```
### Options
- `--file`: Specify the `.env` file to read from (default: `.env`)
- `--sample`: Specify the output `.env.sample` file (default: `.env.sample`)
### Examples
1. Generate `.env.sample` from the default `.env`:
```bash
generate-env-sample
```
2. Use a custom `.env` file:
```bash
generate-env-sample --file myenv.env --sample myenv.sample
```
3. Get help:
```bash
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](https://github.com/heshinth/generate-env-sample).
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "generate-env-sample",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "cli, env, sample, python, typer, environment-variables",
"author": "Heshinth P",
"author_email": "heshinth@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1a/da/ae9050c2f0426937026c62a18cd83f30e42759e2d5a7314f8c839a935038/generate_env_sample-0.1.1.tar.gz",
"platform": null,
"description": "# Generate-Env-Sample\r\n\r\n \r\n\r\n\r\nA 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.\r\n\r\n## Features\r\n\r\n- Preserves comments and empty lines from the original `.env` file.\r\n- Generates a clean `.env.sample` with keys set to empty values.\r\n- Handles encoding issues, permissions, and file existence gracefully.\r\n- Built with Python and Typer for a smooth CLI experience.\r\n\r\n## Installation\r\n\r\nYou can install using one of the following methods:\r\n\r\n- Using pipx:\r\n ```sh\r\n pipx install generate-env-sample\r\n ```\r\n- Using uv:\r\n ```sh\r\n uv tool install generate-env-sample\r\n ```\r\n- Run directly with pipx:\r\n ```sh\r\n pipx run generate-env-sample\r\n ```\r\n- Run directly with uvx:\r\n ```sh\r\n uvx generate-env-sample\r\n ```\r\n\r\n### Prerequisites\r\n- Python 3.11 or higher\r\n\r\n## Build Instructions\r\n\r\nThis project uses `uv` for management. To build the project, follow these steps:\r\n\r\n1. Install `uv` by following the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/).\r\n \r\n2. Clone the repository:\r\n\r\n ```bash\r\n git clone https://github.com/heshinth/generate-env-sample.git\r\n cd generate-env-sample\r\n ```\r\n\r\n3. Sync the project dependencies using uv sync:\r\n ```bash\r\n uv sync\r\n ```\r\n\r\n## Usage\r\n\r\nRun the tool from the command line:\r\n\r\n```bash\r\ngenerate-env-sample\r\n```\r\n\r\n### Options\r\n- `--file`: Specify the `.env` file to read from (default: `.env`)\r\n- `--sample`: Specify the output `.env.sample` file (default: `.env.sample`)\r\n\r\n### Examples\r\n\r\n1. Generate `.env.sample` from the default `.env`:\r\n ```bash\r\n generate-env-sample\r\n ```\r\n\r\n2. Use a custom `.env` file:\r\n ```bash\r\n generate-env-sample --file myenv.env --sample myenv.sample\r\n ```\r\n\r\n3. Get help:\r\n ```bash\r\n generate-env-sample --help\r\n ```\r\n\r\n## Example Input/Output\r\n\r\nGiven a `.env` file like:\r\n```\r\n# Database configuration\r\nDB_HOST=localhost\r\nDB_PORT=5432\r\n\r\n# API keys\r\nAPI_KEY=your_secret_key\r\n```\r\n\r\nThe generated `.env.sample` will be:\r\n```\r\n# Database configuration\r\nDB_HOST=\r\nDB_PORT=\r\n\r\n# API keys\r\nAPI_KEY=\r\n```\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/heshinth/generate-env-sample).\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.",
"bugtrack_url": null,
"license": null,
"summary": "A simple CLI tool to generate .env.sample files from existing .env files, preserving comments and empty lines.",
"version": "0.1.1",
"project_urls": {
"Issues": "https://github.com/heshinth/generate-env-sample/issues",
"Repository": "https://github.com/heshinth/generate-env-sample.git"
},
"split_keywords": [
"cli",
" env",
" sample",
" python",
" typer",
" environment-variables"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c5c1e93f539f9515b44ab4f84c2c2084e19a3a1e4a3df3436987ee60998bcd93",
"md5": "6559151113157763e0fa1dda503af145",
"sha256": "2c3818cac4328b206b4edf9377cbb10523055ad70ebe63af5ca1d46ac67071bc"
},
"downloads": -1,
"filename": "generate_env_sample-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6559151113157763e0fa1dda503af145",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 4055,
"upload_time": "2025-09-07T12:19:50",
"upload_time_iso_8601": "2025-09-07T12:19:50.272456Z",
"url": "https://files.pythonhosted.org/packages/c5/c1/e93f539f9515b44ab4f84c2c2084e19a3a1e4a3df3436987ee60998bcd93/generate_env_sample-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1adaae9050c2f0426937026c62a18cd83f30e42759e2d5a7314f8c839a935038",
"md5": "25c27cabda9f7d0012e8be60fa09b4b4",
"sha256": "8ee696a2db257e43c063fd9126b800a31db66f1c2d79dec61a41795187232f9e"
},
"downloads": -1,
"filename": "generate_env_sample-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "25c27cabda9f7d0012e8be60fa09b4b4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 2858,
"upload_time": "2025-09-07T12:19:51",
"upload_time_iso_8601": "2025-09-07T12:19:51.821496Z",
"url": "https://files.pythonhosted.org/packages/1a/da/ae9050c2f0426937026c62a18cd83f30e42759e2d5a7314f8c839a935038/generate_env_sample-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-07 12:19:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "heshinth",
"github_project": "generate-env-sample",
"github_not_found": true,
"lcname": "generate-env-sample"
}