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

# Initialize local environment configuration (.env file)
codivus config init

# Review a single file (defaults to 'review' subcommand if omitted)
codivus review main.py

# Review a directory recursively
codivus repo src/

# Run a dedicated security audit
codivus security main.py

# Compare and review changes between Git refs (e.g. main and feature branch)
codivus diff main...feature

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.2.tar.gz (73.4 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.2-py3-none-any.whl (90.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codivus-0.1.2.tar.gz
  • Upload date:
  • Size: 73.4 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.2.tar.gz
Algorithm Hash digest
SHA256 234496a24d9772b914fb1f9fca2c9930a843403b34c9ff2aae7fd19eb13c6f5d
MD5 52228abab997e13ca2581dd05dcb04d0
BLAKE2b-256 5cd5fdcf9287fec2841f2a75a3ded1c9c8203596c1f407af5b6b9327c6c034d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for codivus-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: codivus-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 90.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 12705796edc48d48aa784a2ac627697fb5f5b059f61e075e24542dc47e1a6f61
MD5 5b9500a27aa9985eb85d00bb2e5617d4
BLAKE2b-256 d53e08f00131f6321a55923735e1f524d2d0fa3c22e8e53244c56adf1887a468

See more details on using hashes here.

Provenance

The following attestation bundles were made for codivus-0.1.2-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