Skip to main content

A README generator for Python projects

Project description

ReadGen

This document was automatically generated by ReadGen as well!

tbi-readgen (0.0.9)

A simple yet powerful Python project README.md generator.

Features

  1. Read project information from pyproject.toml
  2. Read custom content from readgen.toml
    • Support variable substitution from pyproject.toml
    • Configure directory structure display with depth control
    • Toggle directory section display
  3. Scan and filter project structure
    • Support glob patterns for excluding directories and files
    • Flexible depth control for directory display
    • Configurable file visibility
  4. Extract comments from Python files for documentation
    • Read first-line comments for description
    • Support aligned comment display in directory tree
  5. Generate a standardized README.md
    • Consistent formatting
    • Automatic section organization
    • Customizable content blocks

Installation

$ pip install tbi-readgen

# Recommendation, as it can be used globally.
$ pipx install tbi-readgen

Usage

CLI

$ readgen

# Overwrite README.md.
$ readgen -f

Configurable Project Information

Create a readgen.toml file in the project root:

[Title]
title = "Method to overwrite [Title], with support for spaces."
content = "Content of the Title Block"

[Markdown]
content = """
## This is a markdown block
1. Read project information from pyproject.toml
2. Read custom content from readgen.toml
3. Scan the project directory structure
4. Extract docstrings from `__init__.py` files in each folder
5. Generate a standardized README.md

```bash
$ pipx install tbi-readgen
```
"""

[Variables]
content = """
Examples of variables from pyproject.toml:
- Use ${project.version} to get the project version
- Use ${project.name} to get the project name
"""

[License]
content = "This project is licensed under the ${project.license} License."

[directory] # `directory` is a built-in method and will not be listed.
title = "Directory Structure" # Block names are customizable, allowing you to override the default "Directory Structure."
content = "The content displayed below the title."
enable = true # Default is true. Show the directory structure.
exclude_dirs = [".git", "env", "__pycache__", "build", "dist"] # Exclude directories from scanning.
exclude_files = [".env*"] # Exclude files from scanning.
show_files = true # Default is true. Show files in the directory structure.
show_comments = true # Default is true. Show first-line comments in the directory structure.

[env] # `env` is a built-in method and will not be listed.
title = "Environment Variables" # Block names are customizable, allowing you to override the default "Environment Variables."
content = "The content displayed below the title."
enable = false # Default is true. Show the environment with description from the .env file.
env_file = ".env" # Default is ".env". The file to read the environment variables from.

.env file

If .env variables include comments, they will follow this format:

PROJECT_ID=tbi-readgen # Project identification code used for service registration and resource management
APP_ENV=dev # Application runtime environment (dev/stage/prod)
Variable Name Description
PROJECT_ID Project identification code used for service registration and resource management
APP_ENV Application runtime environment (dev/stage/prod)

show_comments

If show_comments is set to true, first-line comments with a # prefix in the directory structure will be displayed.

readgen/
├── LICENSE
└── src/
    └── readgen/         # Comments from the `__init__.py` file will be displayed here.
        ├── cli.py       # Comments with a `#` prefix at the beginning of the line will be displayed here.
        ├── config.py
        ...

Development

Setup

git clone https://github.com/TaiwanBigdata/readgen.git
cd readgen
python -m venv env
source env/bin/activate  # Linux/Mac
pip install -e .

License

This project is licensed under the MIT License.

Directory Structure

readgen/
├── .gitignore
├── LICENSE
├── README.md
├── pyproject.toml
├── readgen.toml
├── requirements.txt
└── src/
    └── readgen/
        ├── cli.py       # Handle command line interface (CLI) logic
        ├── config.py
        ├── generator.py # This is the main module for ReadGen.
        └── utils/       # This folder is primarily used for storing commonly used utilities.
            └── paths.py

This document was automatically generated by ReadGen.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tbi_readgen-0.0.9.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tbi_readgen-0.0.9-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file tbi_readgen-0.0.9.tar.gz.

File metadata

  • Download URL: tbi_readgen-0.0.9.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for tbi_readgen-0.0.9.tar.gz
Algorithm Hash digest
SHA256 b25e45356ab080c3029765d7f38d873cc636489e0fa92f5d012caa73ee8eaaf1
MD5 c286acb217345248aaa01086ea230a99
BLAKE2b-256 3f38acd7967a5d2d19e57eddd9adcab40e344cf4e09bfb21dd0dbe2a433b1b18

See more details on using hashes here.

File details

Details for the file tbi_readgen-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: tbi_readgen-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for tbi_readgen-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a685ddd8642ddeacefae413ecb666d3b3d646e82f255a067c3a73d930b177df9
MD5 5a8d80ace6d96b800c5bad2a31c55903
BLAKE2b-256 445b6968dca8919101873da2ad4ba2a225f5dea4f558946309d9677f3a7225b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page