Skip to main content

AI-powered Python library for automated code reviews

Project description

Codivus

Python Version License

Codivus is an AI-assisted automated code review engine designed for Python codebases. It operates by combining deterministic Abstract Syntax Tree (AST) static analysis with Large Language Models (LLMs) to perform thorough, context-aware code audits, security scanning, and style checking.


Key Features

  • Hybrid Review Engine: Merges traditional parsing-based static rules with advanced LLM reasoning to ensure zero false positives on basic rules while gaining deep semantic feedback.
  • Provider Abstraction: Out-of-the-box integrations for OpenAI, Anthropic Claude, Google Gemini, Ollama, OpenRouter, and Azure OpenAI.
  • Execution Caching: Smart local SHA-256 caching saves execution runtimes and limits API cost by ignoring unchanged files.
  • Extensible Plugins: Programmatic hooks support custom prompt modifiers, pre-/post-review lifecycle callbacks, and custom static analysers.
  • Git Diffs Integration: Compare branches, commit ranges, or analyze unstaged/staged git files.
  • Multiple Report Formats: Export findings as Markdown, HTML, JSON, or SARIF schemas.
  • CLI Commands: Interactive terminal command suite to run reviews, query settings, and explain code issues.

Installation

Install directly from PyPI:

pip install codivus

LLM Client Extras

To install specific provider client SDK packages:

# OpenAI support (default)
pip install codivus

# Anthropic Claude support
pip install codivus[anthropic]

# Google Gemini support
pip install codivus[google]

# Install all SDK libraries
pip install codivus[all-providers]

Quickstart

Programmatic Usage

Create a script run_review.py to review a python file:

import os
from codereview.config import Config
from codereview.reviewer import Reviewer

# Load configuration (uses defaults or environment settings)
config = Config()

# Instantiate the reviewer
reviewer = Reviewer(config)

# Execute the review on a file
result = reviewer.review_file("src/main.py")

# Output metrics
print(f"Overall Quality Score: {result.score.overall_score}/100")
print(f"Total Issues Found: {result.summary.total_issues}")

for issue in result.issues:
    print(f"[{issue.severity.upper()}] Line {issue.line_number}: {issue.title}")
    if issue.suggestion:
        print(f"  Proposed Code:\n{issue.suggestion.proposed_code}")

CLI Command Suite

# Review a single file
codivus review main.py

# Review a directory recursively
codivus repo review src/

# Run a dedicated security audit
codivus security scan main.py

# Explain a code snippet using AI
codivus explain "def hello(): pass"

Configuration

Set environment variables in your terminal or a local .env file:

# Select default provider client (openai, anthropic, google, ollama, openrouter, azure)
export CODIVUS_PROVIDER="openai"

# Configure the target model
export CODIVUS_MODEL="gpt-4o"

# Disable review caching (default is enabled)
export CODIVUS_NO_CACHE=0

# Configure logger level (DEBUG, INFO, WARNING, ERROR)
export CODIVUS_LOG_LEVEL="WARNING"

Documentation

Full tutorials, design architectures, and API references are available in the docs/ directory or can be hosted via MkDocs:

# Install mkdocs and theme
pip install mkdocs-material

# Start the local docs server
mkdocs serve

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

codivus-0.1.0.tar.gz (71.5 kB view details)

Uploaded Source

Built Distribution

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

codivus-0.1.0-py3-none-any.whl (88.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codivus-0.1.0.tar.gz
  • Upload date:
  • Size: 71.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codivus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fca4d66980b76a2d6fb16e839b002914fc1c4e575f05aa06485431d8669ab062
MD5 b46f0fd254b9f6677ad81b3f4876a9d4
BLAKE2b-256 ad3c9f64cf0176efa4ef77079274a89d7637b6377571666dffadb9219c0d7a60

See more details on using hashes here.

Provenance

The following attestation bundles were made for codivus-0.1.0.tar.gz:

Publisher: publish.yml on Ash7540/Codivus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: codivus-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 88.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codivus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76b6b073b7ee1f14b180232abb8a6001578fd52fd10f045e054f86fe20dc5cba
MD5 f9403fb1195c8177343cb2a00ecce33d
BLAKE2b-256 0463cf22545efcc7305e89beb1dad87f080019f1c547b859b6bb3d95de1573f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for codivus-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Ash7540/Codivus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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