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:

    Navigate to the directory containing the repository:

    cd <path_to_repo>
    

    To start Repo2Docs with an interactive prompt, execute:

    repo2docs
    

    Alternatively, you can specify options directly via command-line flags:

    repo2docs --dir_path . --output_file README.md --type documentation --llm openai
    
    • dir_path: Specifies the directory of the repo. If omitted, defaults to the current directory.
    • output_file: Sets the name and path of the output file. If omitted, defaults to README.md.
    • type: Determines the type of output generated. Options include:
      • documentation (default)
      • diagram for visual diagrams
      • database for database ERD diagrams
      • Custom prompt: Leave type unspecified and use --prompt "<prompt>" to provide a custom prompt.
    • llm: Selects the language model to use. If omitted, defaults to openai. Options include:
      • openai (default model: gpt-4-turbo)
      • anthropic (default model: claude-3-haiku-20240307)
    • model: Specifies the model to use for generating documentation. If omitted, defaults to the default model for the selected language 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.24.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

repo2docs-0.1.24-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repo2docs-0.1.24.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.1 Darwin/23.5.0

File hashes

Hashes for repo2docs-0.1.24.tar.gz
Algorithm Hash digest
SHA256 842856e449741a154c835095d76baf0a21de59e0ceb9033e62f7eb8da1f3072e
MD5 dd43bb37091243927f7e8cefa9f9c522
BLAKE2b-256 42fd261bbc3b44cafaa24a3d13ab3331f2007e04e0aae70fb19a48cec65c3ea2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repo2docs-0.1.24-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.1 Darwin/23.5.0

File hashes

Hashes for repo2docs-0.1.24-py3-none-any.whl
Algorithm Hash digest
SHA256 f78f686eb0855144dff30c821543d98e3a2085f05725c371d636faf8bf2bd992
MD5 b6c62096966798597618509c85bceec4
BLAKE2b-256 146673a786cdf34a1d4c41ffdb74dd301e1d678a5b9bca5ba7b450a9d31c8876

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