Skip to main content

Dependency version checker that analyzes pyproject.toml files and get upgrade recommendations

Project description

depchk

Python PyPI version Poetry License Ruff Type Checked Tests

Python dependency version checker for Poetry projects. Analyzes pyproject.toml and provides upgrade recommendations with risk assessment and Python compatibility checks.

What It Does

  • Checks PyPI for the latest most compatible versions of your dependencies
  • Risk-scores each update (HIGH/MEDIUM/LOW) based on version jumps and Python compatibility
  • Respects constraints from local path dependencies (monorepos, git submodules)
  • Validates recommended versions and their support for your target Python version
  • Creates a backup before modifying your pyproject.toml
  • JSON output for automation and CI/CD

Quick Start

Install Depchk

Install Depchk with pipx to run it as a standalone tool without affecting your system Python:

pipx install depchk

Or with pip in a virtual environment:

pip install depchk

Tip: pipx is recommended for global CLI tools as it provides isolated environments.

Or with Poetry (for development):

git clone https://github.com/bulletinmybeard/depchk.git
cd depchk
poetry install
# Analyze your project
depchk /path/to/pyproject.toml

# Preview what will change (creates pyproject.toml.updated.toml)
depchk

# Apply updates directly (creates backup first)
depchk --update-source-file

CLI Commands

Command Description
depchk Analyze current directory's pyproject.toml
depchk PATH Analyze specific pyproject.toml
depchk --update-source-file Apply updates directly (creates backup)
depchk --target-python "^3.13" Override Python version for testing
depchk --allow-prerelease Include pre-release versions
depchk --ignore-local-deps Skip local dependency constraints
depchk --json JSON output for automation
depchk --verbose Show debug information

Note: --json and --verbose are mutually exclusive. Using both will exit with a JSON error.

Automation

depchk supports JSON output for scripting and CI/CD. All JSON responses use a standardized envelope:

# Check response status
depchk --json | jq '.status'
# Output: "success"

# Get update recommendations
depchk --json | jq '.data.updates'

# Check summary programmatically
depchk --json | jq '.data.summary'

# Test against a different Python version
depchk --target-python "^3.13" --json

JSON Response Structure:

{
  "status": "success",
  "data": {
    "updates": {"httpx": "^0.28.1", ...},
    "summary": {"analyzed": 15, "updated": 8, ...},
    "report": [...]
  }
}

Error responses use the same envelope:

{
  "status": "error",
  "error": {"code": "incompatible_flags", "message": "..."}
}

Configuration

depchk uses a ~/.depchk/config.yaml file for persistent settings:

analysis:
  cache_ttl_hours: 24
  allow_prerelease: false

Config file locations (checked in order):

  1. Project directory: ./config.yaml
  2. User home: ~/.depchk/config.yaml

Override with environment variables: DEPCHK_CACHE_TTL, DEPCHK_ALLOW_PRERELEASE.

Priority: CLI flags > Environment variables > Config file > Defaults

Example Output

+------------------------------------------+
| Dependency Analysis Report               |
| Python Version: ^3.12                    |
+------------------------------------------+

Summary

  * Analyzed: 15
  * Updates available: 8
  * Skipped: 2

Recommended Updates

| Package   | Current | ->  | Recommended | Python    | Risk |
|-----------|---------|-----|-------------|-----------|------|
| httpx     | ^0.25.0 | ->  | ^0.28.1     | 3.8->3.13 | MED  |
| fastapi   | ^0.115  | ->  | ^0.118.3    | 3.8->3.13 | LOW  |

! Risk Factors:
  * httpx:
    - Minor version jump (^0.25.0 -> ^0.28.1)
Local Path Dependency Support

How It Works

depchk handles local path dependencies (monorepos, git submodules) by enforcing their version constraints as "ceilings":

  1. Detects local path dependencies in your pyproject.toml
  2. Reads their Python and package requirements
  3. Ensures recommendations stay compatible with all local deps

Example: If your local dependency requires httpx: ^0.25, depchk will NOT recommend httpx: ^0.28 even if it's available.

Monorepo Example

my-company/
+-- api/pyproject.toml           # python = "^3.12", httpx = "^0.27.0"
+-- shared-utils/pyproject.toml  # python = "^3.12", httpx = "^0.25.0" <- ceiling

When analyzing api/, depchk respects the ^0.25.0 constraint from shared-utils.

Use --ignore-local-deps to analyze independently without constraint enforcement.

Shell Integration (Development Only)

Note: This section is only relevant if you run depchk from the cloned repo via poetry run.

This optional wrapper function provides a convenient depchk shortcut when running from a cloned repo.

Linux/macOS (ZSH/Bash)

Create ~/depchk_shell.sh:

depchk() {
    local project_dir="$HOME/path/to/depchk"
    local original_dir="$PWD"

    if [[ ! -d "$project_dir" ]]; then
        echo "Error: depchk project not found at $project_dir"
        return 1
    fi

    if [[ $# -eq 0 ]] || [[ "$1" == -* ]]; then
        (cd "$project_dir" && poetry run depchk "$original_dir/pyproject.toml" "$@")
    else
        (cd "$project_dir" && poetry run depchk "$@")
    fi
}

Then add to ~/.zshrc or ~/.bashrc:

[ -f "$HOME/depchk_shell.sh" ] && source "$HOME/depchk_shell.sh"

Reload: source ~/.zshrc

Risk Assessment

Each update is scored based on:

  • Version jump impact: Major > Minor > Patch
  • Python compatibility: Checks requires_python metadata from PyPI
  • Classifier data: Extracts tested Python versions

Confidence levels:

  • LOW: Patch/minor updates with full Python compatibility
  • MEDIUM: Minor version jumps or limited compatibility data
  • HIGH: Major updates with potential compatibility issues

Requirements

  • Python 3.12+
  • Poetry for dependency management
  • A Poetry project (pyproject.toml with [tool.poetry] section)

Links

License

MIT License - see the LICENSE file for 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

depchk-0.8.0.tar.gz (38.4 kB view details)

Uploaded Source

Built Distribution

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

depchk-0.8.0-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file depchk-0.8.0.tar.gz.

File metadata

  • Download URL: depchk-0.8.0.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for depchk-0.8.0.tar.gz
Algorithm Hash digest
SHA256 2740a10de04cc9ee97429548b7bc77269cc60f00fecfb80363e6c2d315dfbc4c
MD5 8a29867b2f23f29c31608f76f56b4ba8
BLAKE2b-256 f0ab0919806b9ab7d752f78c8e12f0165f871db60bb8bebbd087f21e650c9792

See more details on using hashes here.

File details

Details for the file depchk-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: depchk-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for depchk-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cc2f74b48bd6b1753fb01f8bfa45e4895fcc7844802c8bb89e52b1bb4e9e2e0
MD5 b9f7fade06e3cd8eb5e15f01ce160d6f
BLAKE2b-256 a9a81d1614215cf850e6b5ada56f0edb907da03c7ecfbee6d0631bce01a55a39

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