Documentation from your codebase using LLMs
Project description
Repo2Docs: Convert GitHub Repositories to Documentation
Inspired by github2file
Repo2Docs is a Python-based tool designed to convert the contents of a GitHub repository into comprehensive documentation or diagrams. This tool leverages language model APIs such as OpenAI or Anthropic to process and generate documentation, making it easier for developers to create documentation for their projects.
How It Works
sequenceDiagram
participant U as User
participant Main as Main Script
participant RP as RepoProcessor
participant TD as TextToDocs
participant LLM as LLMClient
U->>Main: Execute with parameters
Main->>RP: Process repository
RP->>Main: Return processed text
Main->>TD: Request documentation type
TD->>LLM: Request LLM generation
LLM->>TD: Return generated content
TD->>Main: Return documentation
Main->>U: Save documentation to file
Caption: This sequence diagram illustrates the flow of interactions from the user executing the script to the generation and saving of documentation.
Running Repo2Docs Locally
To run Repo2Docs on your local machine, follow these steps:
-
Clone the Repository:
git clone https://github.com/earlybird-labs/repo2docs.git cd repo2docs
-
Create and Activate Virtual Environment:
First, ensure you have Python installed on your system. Then, create a virtual environment and activate it:
For macOS/Linux:
python3 -m venv venv source venv/bin/activate
For Windows:
python -m venv venv .\venv\Scripts\activate
Install Dependencies:
After activating the virtual environment, install the required dependencies by running:
pip install -r requirements.txt
-
Set Up Environment Variables: Create a
.env
file in the root directory and add your language model API keys:OPENAI_API_KEY=your_openai_api_key_here ANTHROPIC_API_KEY=your_anthropic_api_key_here
-
Run the Tool: Use the following command to convert a repository to documentation. Replace
path_to_repo.zip
andoutput_file.md
with your repository's.zip
file path and your desired output file path, respectively.cd src python repo2docs.py input/path_to_repo.zip output/output_file.md --type documentation --llm openai
To generate mobile documentation, use
--type mobile
. To generate diagrams instead of documentation, use--type diagram
. To generate database erd diagrams, use--type database
.
Supported File Types
Repo2Docs currently supports processing files with the following extensions: .py
, .js
, .jsx
, .ts
, .tsx
, .c
, .cpp
, .h
, .hpp
. It filters out files from directories like docs
, examples
, tests
, and others that are unlikely to contain useful information for documentation.
Contributing
Contributions to Repo2Docs are welcome! Whether it's adding new features, improving documentation, or reporting issues, feel free to open an issue or submit a pull request.
License
Repo2Docs is released under the MIT License. See the LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file repo2docs-0.1.0.tar.gz
.
File metadata
- Download URL: repo2docs-0.1.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.1 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3153b2d110072ccc059dd7f8285d3b983e3c79a80f0e8257db380e4ca9c2d00 |
|
MD5 | 455030832853c12c6a2400b77bb2b434 |
|
BLAKE2b-256 | b51adaa711cb5a114608b9e98049621b4cb31f94baeee2c188838157c2ff0900 |
File details
Details for the file repo2docs-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: repo2docs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.1 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e098887329c4916ab7987629ecccc94d4a38be5c378a353ab16b33623a945ca9 |
|
MD5 | f7304a526d1e4f24c86e756e2d6c9047 |
|
BLAKE2b-256 | dfb5ac56ec5a694390bcca37c5da34710843113db2a7739bea5e9f2244a45c4e |