Skip to main content

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.

Using Repo2Docs

To run Repo2Docs on your local machine, follow these steps:

  1. Install Repo2Docs:

    pip install repo2docs
    
  2. Set Up Environment Variables: Export your OpenAI and Anthropic API keys as environment variables:

    export OPENAI_API_KEY=your_openai_api_key_here
    export ANTHROPIC_API_KEY=your_anthropic_api_key_here
    
  3. Run the Tool:

    cd into the directory where the repo is located

    cd <path_to_repo>
    

    Run the following command to generate documentation:

    repo2docs --dir_path . --output_file documentation.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. To use a custom prompt, use --prompt <prompt>.

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


Download files

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

Source Distribution

repo2docs-0.1.7.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

repo2docs-0.1.7-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file repo2docs-0.1.7.tar.gz.

File metadata

  • Download URL: repo2docs-0.1.7.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.1 Darwin/23.4.0

File hashes

Hashes for repo2docs-0.1.7.tar.gz
Algorithm Hash digest
SHA256 f3dbe0063147d6cf1f87e2897df2f776f8c7159c9608987d9cc077f5a711e631
MD5 f66b83263941988b69a8e2b991036c86
BLAKE2b-256 4dd02b375b39bfc41b487426295a5e0139a79293ef3c09fcdb425975b0044f21

See more details on using hashes here.

File details

Details for the file repo2docs-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: repo2docs-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.3 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

Hashes for repo2docs-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3842c46850144a8682716eccf33758372d8916cc14626d20b35e384aa0d220d1
MD5 f4cb99900902144f9fe69f8461cf5657
BLAKE2b-256 e6e2b576dcd690af243d68ceba82f3385ba0a3e099e5d61d737329345a296dd8

See more details on using hashes here.

Supported by

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