Β Β Β Β Empowering Documentation with AI Brilliance
Β Β
Table of Contents
README-AI is an open-source project that automates README generation for software repositories. It enhances developer productivity by creating structured documentation, including summaries, badges, and directory trees. Ideal for developers seeking efficient project onboarding and documentation maintenance.
|
Feature |
Summary |
βοΈ |
Architecture |
- Modular design for scalability
- Microservices architecture
- Utilizes containerization with Docker
|
π© |
Code Quality |
- Extensive testing with pytest and coverage reports
- Linting and formatting with pre-commit hooks
- Type checking with mypy
|
π |
Documentation |
- Rich documentation in various formats (YAML, TOML, Markdown)
- Includes detailed installation commands for different package managers
- Utilizes MkDocs for generating documentation
|
π |
Integrations |
- Integration with GitHub Actions for CI/CD
- Uses various third-party libraries like OpenAI and requests
- Includes shields.io badges for status indicators
|
𧩠|
Modularity |
- Well-structured codebase with clear separation of concerns
- Encourages code reusability and maintainability
- Utilizes dependency management with Poetry
|
π§ͺ |
Testing |
- Comprehensive test suite with pytest and asyncio support
- Includes coverage reports for test effectiveness
- Randomized testing with pytest-randomly
|
β‘οΈ |
Performance |
- Optimized code for efficiency
- Utilizes asynchronous programming with aiohttp
- Scalable architecture for handling high loads
|
π‘οΈ |
Security |
- Security measures with GitPython for version control
- Utilizes secure communication with requests library
- Includes security configurations in Dockerfile
|
π¦ |
Dependencies |
- Manages dependencies with Poetry and dependency lock files
- Includes a variety of libraries for different functionalities
- Dependency management with conda for environment setup
|
βββ readme-ai/
βββ .github
βββ CHANGELOG.md
βββ CODE_OF_CONDUCT.md
βββ CONTRIBUTING.md
βββ Dockerfile
βββ LICENSE
βββ Makefile
βββ README.md
βββ docs
βββ examples
βββ mkdocs.yml
βββ noxfile.py
βββ poetry.lock
βββ pyproject.toml
βββ readmeai
βββ scripts
βββ setup
βββ tests
README-AI/
__root__
mkdocs.yml |
- Configure README-AI MkDocs site settings for documentation navigation, styling, and functionality - Organize content, integrate with plugins, and apply custom CSS and JavaScript for enhanced user experience. |
Dockerfile |
- Facilitates the setup and configuration of a Docker container for the project, installing dependencies and setting up the necessary environment variables - The Dockerfile defines the base image, sets up the working directory, installs required packages, creates a user, and configures the entry point and default command for running the application. |
Makefile |
Facilitates various project tasks such as cleaning build artifacts, creating Conda recipes, building Docker images, displaying git logs, managing dependencies with Poetry, formatting codebase with Ruff, running MkDocs server, conducting word searches in the codebase, and running unit tests using pytest and multiple Python versions with nox. |
pyproject.toml |
- Generates README files using large language model APIs, facilitating developer documentation - The code defines project metadata, dependencies, and scripts for the README file generator tool - This file is crucial for managing project information and dependencies effectively. |
noxfile.py |
- Configures and executes tests across multiple Python versions using Nox - Installs dependencies and runs the test suite with coverage reports for versions 3.9 to 3.12. |
setup
setup.sh |
- Facilitates environment setup by checking dependencies, creating a new conda environment, and installing required packages - Ensures Python version compatibility and enhances user experience with informative messages - Streamlines project onboarding by automating setup tasks. |
requirements.txt |
Define project dependencies and versions using the requirements.txt file to ensure compatibility and manage package installations seamlessly across the codebase architecture. |
environment.yaml |
Defines project dependencies and environment setup through a YAML file, specifying required Python version, package channels, and dependencies listed in a separate requirements file. |
scripts
run_batch.sh |
Generates markdown files with badges and images for various repositories based on predefined styles and settings. |
pypi.sh |
- Automates the PyPI deployment process by cleaning, building, and uploading distribution files for a specified package - The script ensures seamless deployment to PyPI, enhancing the project's release workflow. |
clean.sh |
- The clean.sh script removes various artifacts like build files, Python file artifacts, test and coverage files, backup files, and cache files - It helps maintain a clean project directory by removing unnecessary files and directories - This script is essential for ensuring a tidy and organized codebase. |
docker.sh |
- Automates Docker image building, pushing, and multi-platform support - Sets up Docker Buildx, builds and publishes the image, and completes the process by displaying the published image name. |
.github
release-drafter.yml |
Define release drafter conventions and categorize changes based on labels for streamlined project versioning and changelog generation. |
workflows
coverage.yml |
- Automate Codecov coverage reporting for Python codebase using GitHub Actions - Run tests, generate coverage reports, and upload to Codecov on push and pull requests - Dependencies managed with Poetry. |
mkdocs.yml |
- Automates deployment of MkDocs to GitHub Pages upon push or pull request - Sets up Python, installs Poetry, dependencies, and builds the MkDocs site - Utilizes the peaceiris/actions-gh-pages action for deployment, ensuring updates are published to the designated directory. |
release-pipeline.yml |
- Automates deployment to PyPI and Docker Hub upon main branch push/release - Sets up Python environment, installs dependencies, builds and publishes to PyPI - Builds and pushes Docker image, supporting multiple platforms - Ensures smooth integration with PyPI and Docker Hub for efficient package and image deployment. |
release-drafter.yml |
- Automates release notes drafting based on pull request events - Supports PRs from forks and creates GitHub releases - Configurable to disable autolabeler and specify custom config - Uses GitHub token for authentication. |
readmeai
_exceptions.py |
Define custom exceptions for readme-ai package, handling errors during README generation, CLI input, file system operations, and unsupported LLM services. |
__main__.py |
- Generates README files by processing a repository and configuring settings for the README file generator agent - Handles exceptions during the generation process and updates API and model settings accordingly - Retrieves dependencies, analyzes files, and uses a model to generate the README content - Saves the generated README.md file and provides completion notifications. |
parsers
properties.py |
Parse .properties configuration files to extract jdbc connection strings and package names. |
factory.py |
- Define an abstract factory module for all project file parsers, providing a dictionary of callable file parser methods for various file types such as Python, C/C++, JavaScript/Node.js, Kotlin, Go, Java, Rust, Swift, and Docker - This module facilitates the parsing of different file formats within the project architecture. |
docker.py |
Parse Docker configuration files to extract package names and services, contributing to the project's architecture by enabling efficient handling of dependencies and services specified in Dockerfiles and docker-compose.yaml files. |
npm.py |
Parse npm and yarn.lock files to extract dependency names for the project's architecture. |
cpp.py |
- Parse C/C++ project dependency files using parsers for CMakeLists.txt, configure.ac, and Makefile.am - Extract dependencies, libs, and software names from these files to facilitate project configuration and build processes - The parsers help streamline the handling of different dependency file formats commonly found in C/C++ projects. |
gradle.py |
- Parse Gradle and Gradle.kts dependency files to extract package names for the project's build configuration - The code achieves this by implementing parsers for both types of dependency files, enabling seamless extraction of package names from the respective files. |
yarn.py |
Extracts package names from a yarn.lock dependency file for the project's architecture. |
swift.py |
Parse Swift Package.swift files to extract package names for dependencies. |
python.py |
- The provided code file contains parsers for extracting package names from various Python dependency files like requirements.txt, TOML, and YAML - These parsers play a crucial role in analyzing and understanding the dependencies of the project, enabling efficient management and tracking of software dependencies across different build systems and environments. |
go.py |
Parse go.mod files to extract package names for dependency management in the project architecture. |
maven.py |
Parse Maven pom.xml files to extract package names, adding 'spring' if dependencies contain it. |
rust.py |
Parse Rust cargo.toml dependency files to extract package names, handling errors gracefully. |
core
models.py |
- The code file in readmeai/core/models.py orchestrates interactions with a Large Language Model API, handling requests and responses - It abstracts the model settings, payload construction, and HTTP client management - Additionally, it facilitates batch processing of prompts and code summaries generation for project files. |
preprocess.py |
Pre-processes repository files, extracts metadata, and generates file contexts for the project architecture. |
parsers.py |
Defines an abstract base class for dependency file parsers, providing a standardized error handling mechanism and logging functionality for parsing exceptions. |
logger.py |
- Implements a custom logger with color and emoji support for the readme-ai package - Allows logging messages at different levels with specified formatting and output to the console - Manages multiple logger instances with configurable log levels. |
utils.py |
- Facilitates configuration of LLM API environments by setting variables based on specified LLM service - Handles scenarios where necessary environment keys are missing, ensuring smooth operation or switching to offline mode - Key functionality for seamless integration with LLM services in the project architecture. |
config
settings.py |
- The code file `settings.py` defines Pydantic models and settings for the `readme-ai` package - It encapsulates configurations for API settings, file paths, Git repositories, Markdown templates, and LLM model parameters - Additionally, it includes logic to validate and set Git repository attributes, generate file URLs, and load configuration settings for the package. |
settings
prompts.toml |
- **Summarize:**
Illustrate the key generative prompt templates for large language models in the project - These templates offer a structured approach to analyze the project's technical capabilities and characteristics, aiding in the creation of a Markdown table - The prompts cover essential aspects like architecture, code quality, documentation, integrations, modularity, testing, performance, security, dependencies, and scalability. |
parsers.toml |
Parse and analyze project configuration and dependency files with the provided parsers.toml file. |
quickstart.toml |
- The provided code file, located at readmeai/config/settings/quickstart.toml, plays a crucial role in defining default configurations and settings for the project - It specifies essential information such as the default tool, installation instructions, run commands, test instructions, shields for badges, and related website links - This file serves as a central reference point for setting up and running the project, providing clarity on the tools and processes involved without delving into technical intricacies. |
languages.toml |
Define programming language extensions and their corresponding names for the project's configuration settings. |
config.toml |
- The code file provides default settings and configurations for various aspects of the project, such as API settings, file resources, Git repository settings, and more - It serves as a central configuration hub for defining key parameters that influence the behavior and functionality of the entire codebase architecture. |
markdown.toml |
Generate a Markdown template for constructing a README.md file, including header, badges, and directory structure. |
ignore_list.toml |
Define exclusion criteria for preprocessing by specifying directories, file extensions, and file names to be ignored. |
commands.toml |
- Facilitates defining language-specific commands for installation, running, and testing in the project - Supports various programming languages like Java, Python, and Go, ensuring streamlined development processes - Enables easy execution of tasks across different languages, enhancing project efficiency and maintainability. |
utils
file_handler.py |
Enables reading and writing various file formats using a unified interface, enhancing file I/O operations across the project. |
text_cleaner.py |
- The code file in `text_cleaner.py` serves the purpose of post-processing responses from the LLM API in the open-source project - It includes functions to clean and format text, such as removing specific patterns, correcting markdown table formatting, and ensuring consistent text structure - This utility enhances the overall quality and readability of the generated text output. |
file_resources.py |
- Retrieve the absolute path to a resource file within the package, prioritizing `importlib.resources` and falling back to `pkg_resources` for compatibility - Handle errors with a custom exception to ensure successful resource file access. |
models
offline.py |
Handles offline mode for CLI operations when no LLM API service is available, setting default values and returning placeholder text in lieu of LLM API responses. |
gemini.py |
- Handles Google Cloud's Gemini API requests by initializing the API settings, building payloads, and processing responses - Utilizes Google's generative AI library for text generation - Implements retry logic for robustness and logs response details. |
tokens.py |
- Facilitates tokenizing and truncating text based on a specified maximum count, enhancing the language model's handling of prompts - The code optimizes token count for prompts, ensuring they meet the defined context window while maintaining text integrity. |
dalle.py |
- Generates and downloads images using OpenAI's DALL-E model, based on project configuration data - Handles API sessions, formats prompt strings, generates images, and downloads them from provided URLs. |
factory.py |
- Selects appropriate LLM API service based on CLI input to return the corresponding handler - The ModelRegistry class contains a mapping of CLI options to handler classes for different LLM API services, ensuring the correct handler is returned based on the input provided. |
prompts.py |
- Generates and formats prompts for the LLM API based on provided context such as features, overview, and slogan - Additionally, creates additional prompts like features, overview, and slogan for LLM using specific configurations and dependencies. |
openai.py |
- Implements an OpenAI API LLM handler with Ollama support, managing configuration settings and building payloads for requests - Handles API calls, processes responses, and logs generated text - Ensures robustness through retry logic for error handling. |
cli
options.py |
- Facilitates configuring command-line options for the readme-ai package, enabling users to customize image settings, API services, badges, and more for generating README.md files - The options cover aspects like image selection, API backend, badge appearance, output file naming, and text generation parameters - This module enhances user control over the content and styling of README files. |
main.py |
- Entrypoint function for the readme-ai CLI application, orchestrating the interaction between user input and the readme_agent function - Handles CLI arguments for various options like alignment, API, and model configuration, facilitating the generation of README files using the readme-ai package. |
vcs
ingestor.py |
- The code file facilitates cloning, copying, and handling Git repositories within the project architecture - It includes functions for cloning repositories, copying directories, removing temporary directories, and handling hidden files - This code plays a crucial role in managing repository operations seamlessly within the project structure. |
metadata.py |
- Retrieves metadata of a git repository from the host provider's API - The code fetches GitHub repository details such as name, owner, statistics, URLs, languages, and license information - It converts raw repository data into a structured data class, providing essential insights into the repository's characteristics and settings. |
url_builder.py |
- Implements Git repository URL validation, parsing, and API endpoint retrieval based on the provided URL - Parses the URL to extract host, name, and full name attributes - Supports creation of GitURL objects from string URLs and generates file URLs for remote repositories. |
providers.py |
- Defines GitHost Enum with supported services and URLs - Parses Git repository URL to extract host, full name, and project name - Generates the URL for a file in a remote repository based on the host and file path provided. |
errors.py |
- Define custom exceptions for Git repository validation: GitValidationError, GitCloneError, GitURLError, and UnsupportedGitHostError - These exceptions handle errors related to cloning repositories, invalid URLs, and unsupported Git hosts within the utilities package. |
templates
toc.py |
- Generates Table of Contents based on style and data, rendering a structured outline for README.md - The code includes templates for different styles and items, allowing customization of the ToC appearance. |
header.py |
Defines header styles and renders README.md headers based on the chosen style, allowing customization through data input. |
base_template.py |
Defines a base template class with a method to render templates using provided data and a static method to sanitize input strings, mitigating XSS attacks. |
generators
tree.py |
- Generates a directory tree structure for a code repository by formatting and organizing the project's file hierarchy - The code classifies directories and files, presenting them in a structured tree format with specified depth levels. |
builder.py |
- Generates various sections of the README Markdown file, including header, Table of Contents, code summaries, directory tree structure, Getting Started, and Contributing - Integrates data from the project configuration to create a comprehensive README layout. |
utils.py |
- Improve markdown content by removing emojis and splitting headings into sections for better readability and organization - Update heading names by removing special characters for cleaner representation. |
badges.py |
- Generates and formats SVG badges for the README file, using shields.io icons and skill icons from a specific repository - Provides methods to build metadata badges for project dependencies and align them based on specified styles. |
tables.py |
- Generates Markdown tables to store LLM text responses in README files by constructing formatted tables based on provided data - This code facilitates organizing and displaying code summaries in a structured manner within project sub-directories, enhancing readability and accessibility for users navigating the project documentation. |
quickstart.py |
- Generate dynamic 'Quickstart' guides for the README file based on the top language in the project - Determine setup commands and prerequisites for the most prominent language, ensuring users have a smooth onboarding experience. |
svg
skill_icons.json |
- Generates a JSON file mapping skill icons to their names and a base URL for accessing them - This file serves as a central repository for all available skill icons, facilitating easy access and retrieval within the project architecture. |
shieldsio_icons.json |
- The code file `shieldsio_icons.json` in the `readmeai/generators/svg` directory serves the purpose of defining badge URLs and colors for various technologies used in the project - It enables the generation of dynamic SVG badges for technologies like `.ENV` and `.NET` with customizable styles and logos, enhancing the visual representation of project documentation and status indicators. |
Before getting started with readme-ai, ensure your runtime environment meets the following requirements:
- Programming Language: Python
- Package Manager: Poetry, Pip, Conda
- Container Runtime: Docker
Install readme-ai using one of the following methods:
Build from source:
- Clone the readme-ai repository:
β― git clone https://github.com/eli64s/readme-ai
- Navigate to the project directory:
- Install the project dependencies:
Using poetry
Β
Using pip
Β
β― pip install -r setup/requirements.txt
Using conda
Β
β― conda env create -f setup/environment.yaml
Using docker
Β
β― docker build -t eli64s/readme-ai .
Run readme-ai using the following command:
Using poetry
Β
β― poetry run python {entrypoint}
Using pip
Β
Using conda
Β
β― conda activate {venv}
β― python {entrypoint}
Using docker
Β
β― docker run -it {image_name}
Run the test suite using the following command:
Using poetry
Β
Using pip
Β
Using conda
Β
β― conda activate {venv}
β― pytest
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/eli64s/readme-ai
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to github: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph
This project is protected under the SELECT-A-LICENSE License. For more details, refer to the LICENSE file.
- List any resources, contributors, inspiration, etc. here.