Skip to main content

An LLM-powered CLI tool and Python package for generating repository-level documentation from code.

Project description

Docstra: LLM-Powered Software Documentation Generator & Chatbot

Docstra is an AI-powered tool designed to automatically generate in-depth, contextual documentation for code repositories. Using LangChain and ChromaDB, Docstra can analyze and link together various elements in a codebase, creating searchable, organized, and meaningful documentation that enhances the developer experience.

This project is a component of a master’s thesis at the University of Oslo, exploring the potential of Large Language Models (LLMs) in improving software documentation processes.

Key Features

  • Automated Documentation: Scans and indexes code repositories to generate rich documentation with logical links between files, functions, classes, and modules.
  • Multi-Platform Accessibility: Available as a local CLI and a FastAPI server, allowing integration into other applications.
  • VSCode and IntelliJ Plugin Support: In development to enable seamless access within popular IDEs.
  • Electron-based GUI Companion App: A cross-platform desktop application to view and interact with generated documentation.
  • LLM-Powered Chatbot: Provides an interactive way to query the codebase and explore documentation.

Getting Started

Prerequisites

  • Python 3.8+
  • Poetry for dependency management. Install Poetry
  • OpenAI API Key for access to LLM features (set up as an environment variable)

Installation

Clone this repository and install dependencies via Poetry.

git clone https://github.uio.no/docstra/docstra.git
cd docstra
poetry install

Environment Variables and Project Files

Docstra is designed to integrate smoothly into your existing project environment. When run from within an active repository, Docstra creates a dedicated .docstra folder in the root directory to store all generated embeddings and essential project files, keeping your documentation assets organized and easily accessible. This .docstra folder also houses a .env file for environment variables, including the required OpenAI API key. If the user has not yet added an API key, Docstra will prompt for one when the tool is run; the key can also be provided as a command-line argument. Once entered, the key is securely stored in .docstra/.env, allowing for streamlined future usage without additional prompts.

The .env file in the .docstra folder is automatically loaded when Docstra starts, making it the primary location for environment variables like API keys. This ensures your sensitive credentials are kept separate from your code and configuration.

Running Docstra

Docstra offers both CLI and FastAPI server options.

Command Line Interface (CLI)

Run Docstra directly from the command line:

poetry run docstra --help

Example of generating documentation:

poetry run docstra generate-docs path/to/your/codebase

FastAPI Server

To access Docstra as an API service, start the FastAPI server:

poetry run uvicorn docstra.server:app --reload

Access the API documentation at http://127.0.0.1:8000/docs (Swagger UI).

Usage

Docstra can process entire repositories or selected folders and files. It will extract structured metadata for each code component, allowing cross-referenced links for easy navigation and searchability.

Querying Documentation

The CLI offers a query command, allowing for specific questions about the codebase:

poetry run docstra query "How does authentication work?"

With the FastAPI server, you can send POST requests to /query with your question in the payload for direct querying from other applications.

Plugin and GUI Support

  • VSCode and IntelliJ Plugins (in development): Access Docstra documentation within the editor for a seamless development experience.
  • Electron-based Desktop App (coming soon): A graphical interface for non-technical users to explore codebase documentation.

Roadmap

  • Integrate interactive LLM-based chatbot for conversational documentation
  • Expand plugin support for major IDEs
  • Develop Electron-based desktop application

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For questions or feedback, please reach out to the project team at the University of Oslo. This project is an academic exploration into LLM-based developer tools aimed at improving the efficiency and accessibility of code documentation.

Project Repository: https://github.uio.no/docstra/docstra

This README provides a quick start guide to get up and running with Docstra, along with a look at the upcoming features and development goals of the project. Docstra is continually evolving to meet the needs of developers, researchers, and educators in the field of software engineering.

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

docstra-0.1.0.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docstra-0.1.0-py3-none-any.whl (74.4 kB view details)

Uploaded Python 3

File details

Details for the file docstra-0.1.0.tar.gz.

File metadata

  • Download URL: docstra-0.1.0.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.6 Darwin/24.3.0

File hashes

Hashes for docstra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 760c1755c3755659745988dd9f516db11c4c124dfaa20a658fe647cf95d4309a
MD5 b5b49bec3596edce213ec5abc2a72f78
BLAKE2b-256 1e66ae4ff69d971b4033b92cb726a299e061a29509206d6331fefec11157b83a

See more details on using hashes here.

File details

Details for the file docstra-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: docstra-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 74.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.6 Darwin/24.3.0

File hashes

Hashes for docstra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67f91dcae144faee725f7640a99d9a56ff582e34d4b11b090ba698a0252119ac
MD5 dbc83c943f990a37e46bad9ab6ea4d09
BLAKE2b-256 f93ac393cb8855426c5ed7090bc61e8b51dfe775b791ef03059a9e521942e51d

See more details on using hashes here.

Supported by

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