Metadata-Version: 2.4
Name: ud-resolver
Version: 1.4.1
Summary: Cross-ecosystem dependency resolver — PyPI, npm, Cargo, Conda, Maven, Go, and more
Author: Mohammad Zeeshan
License: MIT
Project-URL: Homepage, https://github.com/code-with-zeeshan/universal-dependency-resolver
Project-URL: Repository, https://github.com/code-with-zeeshan/universal-dependency-resolver
Project-URL: Documentation, https://github.com/code-with-zeeshan/universal-dependency-resolver/blob/main/docs/CLI.md
Project-URL: Changelog, https://github.com/code-with-zeeshan/universal-dependency-resolver/releases
Project-URL: Bug Tracker, https://github.com/code-with-zeeshan/universal-dependency-resolver/issues
Keywords: dependency-resolver,package-manager,cross-ecosystem,python,npm,cargo,conda,maven,cuda,compatibility,lockfile,sat-solver,dev-tools
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Software Distribution
Requires-Python: <4.0,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi<0.142,>=0.115.0
Requires-Dist: uvicorn<0.53,>=0.24
Requires-Dist: pydantic<3,>=2.5.0
Requires-Dist: aiohttp<4,>=3.9
Requires-Dist: beautifulsoup4<5,>=4.12
Requires-Dist: packaging<27,>=23.2
Requires-Dist: pyyaml<7,>=6.0.1
Requires-Dist: networkx<4,>=3.2.1
Requires-Dist: sqlalchemy<3,>=2.0.23
Requires-Dist: alembic<2,>=1.13
Requires-Dist: orjson<4,>=3.10
Requires-Dist: rich<14,>=13.7
Requires-Dist: slowapi<1,>=0.1.9
Requires-Dist: python-multipart<1,>=0.0.6
Requires-Dist: jinja2<4,>=3.1.2
Requires-Dist: structlog<27,>=24.1
Requires-Dist: python-jose[cryptography]<4,>=3.3
Requires-Dist: passlib[bcrypt]<2,>=1.7.4
Requires-Dist: bcrypt<5
Requires-Dist: email-validator<3,>=2.1
Requires-Dist: httpx<1,>=0.25
Requires-Dist: starlette<1,>=0.37
Provides-Extra: pubgrub
Requires-Dist: pubgrub-py<2,>=1.0; extra == "pubgrub"
Provides-Extra: z3
Requires-Dist: z3-solver<5.0.1,>=4.12; extra == "z3"
Provides-Extra: system
Requires-Dist: psutil<6,>=5.9.6; extra == "system"
Requires-Dist: py-cpuinfo<10,>=9.0; extra == "system"
Requires-Dist: distro<2,>=1.8; extra == "system"
Requires-Dist: gputil<2,>=1.4; extra == "system"
Requires-Dist: nvidia-ml-py<13,>=12.535; extra == "system"
Requires-Dist: python-magic<1,>=0.4.27; extra == "system"
Provides-Extra: dev
Requires-Dist: pytest<10,>=7.4; extra == "dev"
Requires-Dist: pytest-asyncio<2,>=0.21; extra == "dev"
Requires-Dist: pytest-cov<6,>=4.1; extra == "dev"
Requires-Dist: pytest-timeout<4,>=2.2; extra == "dev"
Requires-Dist: ruff<1,>=0.11; extra == "dev"
Requires-Dist: mypy<3,>=1.7; extra == "dev"
Requires-Dist: pre-commit<5,>=3.6; extra == "dev"
Requires-Dist: hypothesis<7,>=6.100; extra == "dev"
Provides-Extra: postgres
Requires-Dist: psycopg2-binary<3,>=2.9.9; extra == "postgres"
Requires-Dist: redis<9,>=5.0.1; extra == "postgres"
Requires-Dist: celery<6,>=5.3.4; extra == "postgres"
Requires-Dist: aiocache<1,>=0.12.2; extra == "postgres"
Provides-Extra: monitoring
Requires-Dist: opentelemetry-api<2,>=1.22; extra == "monitoring"
Requires-Dist: opentelemetry-sdk<2,>=1.22; extra == "monitoring"
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.43b0; extra == "monitoring"
Requires-Dist: opentelemetry-instrumentation-httpx>=0.43b0; extra == "monitoring"
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.22; extra == "monitoring"
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc<2,>=1.22; extra == "monitoring"
Requires-Dist: prometheus-fastapi-instrumentator<9,>=6.1; extra == "monitoring"
Requires-Dist: sentry-sdk[fastapi]<3,>=1.39; extra == "monitoring"
Requires-Dist: python-socketio<6,>=5.11; extra == "monitoring"
Requires-Dist: prometheus-client<1,>=0.19; extra == "monitoring"
Provides-Extra: all
Requires-Dist: psutil<6,>=5.9.6; extra == "all"
Requires-Dist: py-cpuinfo<10,>=9.0; extra == "all"
Requires-Dist: distro<2,>=1.8; extra == "all"
Requires-Dist: nvidia-ml-py<13,>=12.535; extra == "all"
Requires-Dist: gputil<2,>=1.4; extra == "all"
Requires-Dist: pubgrub-py<2,>=1.0; extra == "all"
Requires-Dist: z3-solver<5.0.1,>=4.12; extra == "all"
Requires-Dist: wmi<2,>=1.5.1; platform_system == "Windows" and extra == "all"
Requires-Dist: asyncpg<1,>=0.29; extra == "all"
Requires-Dist: psycopg2-binary<3,>=2.9; extra == "all"
Requires-Dist: sqlalchemy[asyncio]<3,>=2.0.23; extra == "all"
Requires-Dist: redis[hiredis]<9,>=5.0; extra == "all"
Requires-Dist: celery[redis]<6,>=5.3; extra == "all"
Requires-Dist: flower<3,>=2.0; extra == "all"
Requires-Dist: opentelemetry-api<2,>=1.22; extra == "all"
Requires-Dist: opentelemetry-sdk<2,>=1.22; extra == "all"
Requires-Dist: opentelemetry-instrumentation<1,>=0.43b0; extra == "all"
Requires-Dist: opentelemetry-instrumentation-fastapi<1,>=0.43b0; extra == "all"
Requires-Dist: opentelemetry-instrumentation-sqlalchemy<1,>=0.43b0; extra == "all"
Requires-Dist: opentelemetry-instrumentation-httpx<1,>=0.43b0; extra == "all"
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.22; extra == "all"
Requires-Dist: sentry-sdk[fastapi]<3,>=1.39; extra == "all"
Requires-Dist: python-socketio<6,>=5.11; extra == "all"
Requires-Dist: prometheus-client<1,>=0.19; extra == "all"
Dynamic: license-file

# Universal Dependency Resolver

[![PyPI version](https://img.shields.io/pypi/v/ud-resolver?color=blue)](https://pypi.org/project/ud-resolver/)
[![Python versions](https://img.shields.io/pypi/pyversions/ud-resolver)](https://pypi.org/project/ud-resolver/)
[![License](https://img.shields.io/pypi/l/ud-resolver)](https://github.com/code-with-zeeshan/universal-dependency-resolver/blob/main/LICENSE)
[![CI](https://github.com/code-with-zeeshan/universal-dependency-resolver/actions/workflows/ci.yml/badge.svg)](https://github.com/code-with-zeeshan/universal-dependency-resolver/actions/workflows/ci.yml)

Your Python backend needs PyPI. Your React frontend needs npm. Your Rust CLI needs crates.io. Your Go service needs Go modules. **One `udr lock` gives you one lock file for all of them.**

```bash
# Resolve across ecosystems in one command
udr resolve flask>=2.0 torch@pypi react@^18

# Lock your project across all manifests
udr lock

# Check system + CVE + deprecated packages — 18 ecosystems at once
udr check --cve --deprecated
```

---

## Install

```bash
pip install ud-resolver

# For full capacity — Rust-backed PubGrub + Z3 + richer system data:
pip install "ud-resolver[z3,pubgrub,system]"
```

The base install resolves dependencies, detects GPU/OS/CPU, and handles GPU variant selection — no extras needed. The extras add speed (Rust PubGrub on large graphs), conflict detection (Z3 for CUDA XOR rules), and richer telemetry (GPU temperature, per-process memory). All solvers fall back gracefully when an extra is missing.

### Optional extras

| Extra | What it adds |
|---|---|
| `[system]` | Richer system data via Python libs (pynvml → GPU temp/util, psutil → per-process memory, cpuinfo → detailed model). Base `ud-resolver` already detects GPU/OS/CPU via `nvidia-smi`/`lspci`/`platform` — no extra needed for constraint resolution. |
| `[z3]` | Z3 SAT solver (46MB) for CUDA XOR conflict rules + cross-eco constraints. GPU version filtering works without Z3 (pre-filtered before solver). |
| `[pubgrub]` | Rust-backed PubGrub solver (faster CDCL on 100+ package graphs). Falls back to pure-Python automatically if wheel unavailable / build fails. |
| `[postgres]` | PostgreSQL support |
| `[monitoring]` | OpenTelemetry, Sentry, Prometheus instrumentation |
| `[all]` | Everything above |

---

## Features

| Capability | Detail |
|---|---|
| **25 ecosystems** (18 resolvable + 7 query-only) | **Resolvable:** PyPI, Conda, npm, Crates.io, Maven, Go Modules, APT, APK, CocoaPods, Homebrew, NuGet, Packagist, RubyGems, Pub, Gradle, Swift, Hex, Haskell — **Query-only** (version info, manifest parsing, no SAT traversal): Nix, GNU Guix, Docker, Helm, Terraform, Vcpkg, Conan — **Internal:** Docs DB, Custom DB |
| **SAT-solver resolution** | AutoSolver (default, profiles graph → Z3/PubGrub/Hybrid per workload) with per-ecosystem isolation, CUDA-aware conflict detection. |
| **System-aware** | Detects OS, CPU, GPU, CUDA, Python, Node.js, GCC, Java — resolution adapts to your environment. |
| **GPU-aware** | Automatically selects CUDA variants (e.g. `torch 2.1.2+cu121`) when NVIDIA GPU detected. Supports CUDA, ROCm, Intel GPU, and Metal. For PyPI `torch`, consults the [pytorch wheel index](https://download.pytorch.org/whl/) and caps + rewrites to the matching `+cu<ver>` build (e.g. `--cuda 12.1` → `torch 2.5.1+cu121`). |
| **15 export formats** | requirements.txt, package.json, Dockerfile, docker-compose.yml, pyproject.toml, environment.yml, Cargo.toml, build.gradle, pom.xml, CMakeLists.txt, install.sh, install.bat, Gemfile, composer.json, go.mod |
| **24 CLI commands** | serve, check, resolve, lock, graph, verify, list-ecosystems, update, install, init, migrate, completion, scan, why, outdated, diff, search, sbom, export, details, system-info, auth, index, tools |
| **59 REST API endpoints** | Full programmatic API with auto-generated Swagger docs. |
| **Desktop GUI** | Standalone Electron app — no Python or Node.js needed. |
| **Zero config** | SQLite by default, in-memory cache, no Docker required. |
| **Lock file** | Reproducible `udr.lock` with full system snapshot, integrity hashes, and dependency provenance. |

---

## Why UDR?

- **Cross-ecosystem resolution**: A Python package that transitively depends on an npm package gets solved in one pass, not two.
- **SAT-solver engine**: Real Z3/PubGrub CDCL solver, not greedy backtracking. Finds valid solutions dependency graph heuristics miss.
- **System-aware**: GPU type + CUDA version are resolution constraints — `torch 2.1.2+cu121` selected automatically when NVIDIA GPU detected; for PyPI `torch` the pytorch wheel index is consulted to cap and rewrite to the matching `+cu<ver>` build (e.g. `--cuda 12.1` → `torch 2.5.1+cu121`).
- **Supply chain built-in**: CVE scanning, license compliance, deprecation checks, lock-file signing (Ed25519), SBOM export (SPDX/CycloneDX), policy engine.
- **3 solver backends**: AutoSolver profiles your graph and selects Z3, PubGrub, or Hybrid — with fallback chain if the first choice fails.

---

## Quick Start

```bash
# Resolve cross-ecosystem packages
udr resolve numpy pandas scikit-learn
udr resolve react vue -e npm
udr resolve serde tokio -e crates

# Lock a project's dependencies
udr lock
udr lock --manifest requirements.txt --dry-run

# Validate lock file
udr verify

# Show dependency tree
udr graph flask django

# Scan a GitHub repo without cloning
udr scan --github https://github.com/user/repo

# List all supported ecosystems
udr list-ecosystems
```

---

## 🐍 Use as a Python Library

```python
import asyncio
from backend.core.data_aggregator import DataAggregator
from backend.core.system_scanner import SystemScanner
from backend.orchestrator.resolve import create_solver

async def main():
    scanner = SystemScanner()
    system_info = await scanner.scan_all()

    aggregator = DataAggregator()
    info = await aggregator.get_package_info(
        "torch", ecosystem="pypi",
        include_dependencies=True, include_versions=True,
    )

    resolver = create_solver()
    result = resolver.resolve_dependencies(
        packages=[{"name": "flask", "version": ">=2.0"}],
        system_info=system_info,
    )

asyncio.run(main())
```

---

## 🔄 How It Works

```
Your request ──► Fetch metadata from registry APIs
                      │
                      ▼
              Scan target system (OS, GPU, CUDA, runtimes)
                      │
                      ▼
               Resolve conflicts with AutoSolver (Z3 / PubGrub / Hybrid)
                      │
                      ▼
               Export to 15 formats or write lock file
```

---

## Links

- [GitHub](https://github.com/code-with-zeeshan/universal-dependency-resolver) — source, issues, releases
- [Documentation](https://code-with-zeeshan.github.io/universal-dependency-resolver/) — hosted docs site (User Guide, CLI, API, Architecture)
- [CLI Reference](https://github.com/code-with-zeeshan/universal-dependency-resolver/blob/main/docs/CLI.md)
- [Architecture](https://github.com/code-with-zeeshan/universal-dependency-resolver/blob/main/docs/ARCHITECTURE.md)
- [API Docs](https://github.com/code-with-zeeshan/universal-dependency-resolver/blob/main/docs/API.md)
- [Changelog](https://github.com/code-with-zeeshan/universal-dependency-resolver/releases)
- [License: MIT](https://github.com/code-with-zeeshan/universal-dependency-resolver/blob/main/LICENSE)
