Skip to main content

Generate-Env-Sample

PyPI version

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:
    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:

  1. Install uv by following the uv documentation.

  2. Clone the repository:

    git clone https://github.com/heshinth/generate-env-sample.git
    cd generate-env-sample
    
  3. Sync the project dependencies using uv sync:

    uv sync
    

Usage

Run the tool from the command line:

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:

    generate-env-sample
    
  2. Use a custom .env file:

    generate-env-sample --file myenv.env --sample myenv.sample
    
  3. 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)

Source distribution for generate-env-sample 0.1.2
File Size Uploaded
generate_env_sample-0.1.2.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for generate-env-sample 0.1.2
File Interpreter ABI Platform
generate_env_sample-0.1.2-py3-none-any.whl Python 3 none any Details

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}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page