Skip to main content

Documentation from your codebase using LLMs

Project description

Repo2Docs: Convert Repositories to Documentation

Inspired by github2file

Repo2Docs is a Python-based tool designed to convert the contents of a 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.

Usage

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
    

    or Input your OpenAI or Anthropic API keys when prompted

  3. Run the Tool:

    cd into the directory where the repo is located

    cd <path_to_repo>
    

    Run the main command for an interactive prompt

    repo2docs
    

    or, run the main command with the following flags

    repo2docs --dir_path <path_to_repo> --output_file <output_file> --type <type> --llm <llm>
    
    • Leaving dir_path empty will default to the current directory.
    • Leaving output_file empty will default to output.md.
    • Leaving type empty will default to documentation.
      • 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,leave type empty and use --prompt "<prompt>".
    • Leaving llm empty will default to openai.
      • To use Anthropic, use --llm anthropic.
        • Defaults to claude-3-haiku-20240307.
        • To use a specific model, use --llm anthropic:<model>.
      • To use OpenAI, use --llm openai.
        • Defaults to gpt-4-turbo.
        • To use a specific model, use --llm openai:<model>.

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.19.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

repo2docs-0.1.19-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repo2docs-0.1.19.tar.gz
  • Upload date:
  • Size: 10.7 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.19.tar.gz
Algorithm Hash digest
SHA256 502db0d1986212e947c9dfce06ca9c08b962d3b1be8bd174e16d5e04b9312bcc
MD5 f68e9e67639c9f4c5f9830f8bf5f9d27
BLAKE2b-256 66a1aaedff2ec395bb2324a04fbb7ac2152a3e6ad459bae6023bd10ffd65654d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repo2docs-0.1.19-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

Hashes for repo2docs-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 55eeea0ba72b7a55f88543ae99f6ff8017146383806ad30c7e2c418506950307
MD5 a1f21aa9e64a8c98f5df45223ac33a8e
BLAKE2b-256 1ad54b30f643e4638b6743762d482b4dbf79d8b2024d4b93d3b9733a4ecd4879

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