ud-resolver 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ud_resolver-1.1.0/LICENSE +21 -0
- ud_resolver-1.1.0/PKG-INFO +346 -0
- ud_resolver-1.1.0/README.md +269 -0
- ud_resolver-1.1.0/backend/__init__.py +20 -0
- ud_resolver-1.1.0/backend/api/__init__.py +110 -0
- ud_resolver-1.1.0/backend/api/auth.py +433 -0
- ud_resolver-1.1.0/backend/api/dependencies.py +40 -0
- ud_resolver-1.1.0/backend/api/exceptions.py +80 -0
- ud_resolver-1.1.0/backend/api/main.py +434 -0
- ud_resolver-1.1.0/backend/api/middleware.py +597 -0
- ud_resolver-1.1.0/backend/api/routes/__init__.py +45 -0
- ud_resolver-1.1.0/backend/api/routes/auth.py +297 -0
- ud_resolver-1.1.0/backend/api/routes/packages.py +1145 -0
- ud_resolver-1.1.0/backend/api/routes/scan.py +184 -0
- ud_resolver-1.1.0/backend/api/routes/system.py +1692 -0
- ud_resolver-1.1.0/backend/api/schemas.py +37 -0
- ud_resolver-1.1.0/backend/cli.py +657 -0
- ud_resolver-1.1.0/backend/core/__init__.py +5 -0
- ud_resolver-1.1.0/backend/core/cache.py +385 -0
- ud_resolver-1.1.0/backend/core/conflict_resolver.py +1185 -0
- ud_resolver-1.1.0/backend/core/data_aggregator.py +1221 -0
- ud_resolver-1.1.0/backend/core/export_generator.py +510 -0
- ud_resolver-1.1.0/backend/core/system_scanner.py +2641 -0
- ud_resolver-1.1.0/backend/core/utils.py +162 -0
- ud_resolver-1.1.0/backend/data_sources/__init__.py +35 -0
- ud_resolver-1.1.0/backend/data_sources/apk_client.py +354 -0
- ud_resolver-1.1.0/backend/data_sources/apt_client.py +338 -0
- ud_resolver-1.1.0/backend/data_sources/base_client.py +212 -0
- ud_resolver-1.1.0/backend/data_sources/cocoapods_client.py +263 -0
- ud_resolver-1.1.0/backend/data_sources/conda_client.py +627 -0
- ud_resolver-1.1.0/backend/data_sources/crates_client.py +752 -0
- ud_resolver-1.1.0/backend/data_sources/documentation_scraper.py +1044 -0
- ud_resolver-1.1.0/backend/data_sources/gomodules_client.py +297 -0
- ud_resolver-1.1.0/backend/data_sources/homebrew_client.py +532 -0
- ud_resolver-1.1.0/backend/data_sources/maven_client.py +1561 -0
- ud_resolver-1.1.0/backend/data_sources/npm_client.py +1099 -0
- ud_resolver-1.1.0/backend/data_sources/nuget_client.py +666 -0
- ud_resolver-1.1.0/backend/data_sources/packagist_client.py +534 -0
- ud_resolver-1.1.0/backend/data_sources/pypi_client.py +877 -0
- ud_resolver-1.1.0/backend/data_sources/rubygems_client.py +527 -0
- ud_resolver-1.1.0/backend/data_sources/utils.py +14 -0
- ud_resolver-1.1.0/backend/database/__init__.py +28 -0
- ud_resolver-1.1.0/backend/database/compatibility_db.py +874 -0
- ud_resolver-1.1.0/backend/database/models.py +440 -0
- ud_resolver-1.1.0/backend/logging_config.py +60 -0
- ud_resolver-1.1.0/backend/manifest_detector.py +401 -0
- ud_resolver-1.1.0/backend/settings.py +831 -0
- ud_resolver-1.1.0/backend/tracing_config.py +192 -0
- ud_resolver-1.1.0/backend/utils/errors.py +173 -0
- ud_resolver-1.1.0/pyproject.toml +107 -0
- ud_resolver-1.1.0/setup.cfg +4 -0
- ud_resolver-1.1.0/ud_resolver.egg-info/PKG-INFO +346 -0
- ud_resolver-1.1.0/ud_resolver.egg-info/SOURCES.txt +55 -0
- ud_resolver-1.1.0/ud_resolver.egg-info/dependency_links.txt +1 -0
- ud_resolver-1.1.0/ud_resolver.egg-info/entry_points.txt +2 -0
- ud_resolver-1.1.0/ud_resolver.egg-info/requires.txt +61 -0
- ud_resolver-1.1.0/ud_resolver.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mohammad Zeeshsan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ud-resolver
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: A universal dependency resolver supporting multiple package ecosystems
|
|
5
|
+
Author-email: Universal Dependency Resolver Team <team@udr.example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/code-with-zeeshan/universal-dependency-resolver
|
|
8
|
+
Project-URL: Repository, https://github.com/code-with-zeeshan/universal-dependency-resolver
|
|
9
|
+
Project-URL: Documentation, https://github.com/code-with-zeeshan/universal-dependency-resolver
|
|
10
|
+
Keywords: dependency,resolver,package-manager,compatibility
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: fastapi<0.116,>=0.115.0
|
|
22
|
+
Requires-Dist: uvicorn<0.25,>=0.24
|
|
23
|
+
Requires-Dist: pydantic<3,>=2.5.0
|
|
24
|
+
Requires-Dist: aiohttp<4,>=3.9
|
|
25
|
+
Requires-Dist: requests<3,>=2.31
|
|
26
|
+
Requires-Dist: beautifulsoup4<5,>=4.12
|
|
27
|
+
Requires-Dist: packaging<24,>=23.2
|
|
28
|
+
Requires-Dist: tomli-w<2,>=1.0
|
|
29
|
+
Requires-Dist: toml<1,>=0.10
|
|
30
|
+
Requires-Dist: pyyaml<7,>=6.0.1
|
|
31
|
+
Requires-Dist: networkx<4,>=3.2.1
|
|
32
|
+
Requires-Dist: z3-solver<5,>=4.12
|
|
33
|
+
Requires-Dist: sqlalchemy<3,>=2.0.23
|
|
34
|
+
Requires-Dist: alembic<2,>=1.12
|
|
35
|
+
Requires-Dist: slowapi<1,>=0.1.9
|
|
36
|
+
Requires-Dist: email-validator<3,>=2.1
|
|
37
|
+
Requires-Dist: python-multipart<1,>=0.0.6
|
|
38
|
+
Requires-Dist: jinja2<4,>=3.1.2
|
|
39
|
+
Requires-Dist: structlog<25,>=24.1
|
|
40
|
+
Requires-Dist: prometheus-fastapi-instrumentator<7,>=6.1
|
|
41
|
+
Provides-Extra: system
|
|
42
|
+
Requires-Dist: psutil<6,>=5.9.6; extra == "system"
|
|
43
|
+
Requires-Dist: py-cpuinfo<10,>=9.0; extra == "system"
|
|
44
|
+
Requires-Dist: distro<2,>=1.8; extra == "system"
|
|
45
|
+
Requires-Dist: gputil<2,>=1.4; extra == "system"
|
|
46
|
+
Requires-Dist: nvidia-ml-py<13,>=12.535; extra == "system"
|
|
47
|
+
Provides-Extra: security
|
|
48
|
+
Requires-Dist: python-jose[cryptography]<4,>=3.3; extra == "security"
|
|
49
|
+
Requires-Dist: passlib[bcrypt]<2,>=1.7.4; extra == "security"
|
|
50
|
+
Requires-Dist: bcrypt<5; extra == "security"
|
|
51
|
+
Provides-Extra: dev
|
|
52
|
+
Requires-Dist: pytest<8,>=7.4; extra == "dev"
|
|
53
|
+
Requires-Dist: pytest-asyncio<1,>=0.21; extra == "dev"
|
|
54
|
+
Requires-Dist: pytest-cov<6,>=4.1; extra == "dev"
|
|
55
|
+
Requires-Dist: httpx<1,>=0.25; extra == "dev"
|
|
56
|
+
Requires-Dist: black<24,>=23.11; extra == "dev"
|
|
57
|
+
Requires-Dist: flake8<7,>=6.1; extra == "dev"
|
|
58
|
+
Requires-Dist: mypy<2,>=1.7; extra == "dev"
|
|
59
|
+
Requires-Dist: bandit<2,>=1.7; extra == "dev"
|
|
60
|
+
Provides-Extra: postgres
|
|
61
|
+
Requires-Dist: psycopg2-binary<3,>=2.9.9; extra == "postgres"
|
|
62
|
+
Requires-Dist: redis<6,>=5.0.1; extra == "postgres"
|
|
63
|
+
Requires-Dist: celery<6,>=5.3.4; extra == "postgres"
|
|
64
|
+
Requires-Dist: aiocache<1,>=0.12.2; extra == "postgres"
|
|
65
|
+
Provides-Extra: monitoring
|
|
66
|
+
Requires-Dist: opentelemetry-api<2,>=1.22; extra == "monitoring"
|
|
67
|
+
Requires-Dist: opentelemetry-sdk<2,>=1.22; extra == "monitoring"
|
|
68
|
+
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.43b0; extra == "monitoring"
|
|
69
|
+
Requires-Dist: opentelemetry-instrumentation-httpx>=0.43b0; extra == "monitoring"
|
|
70
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.22; extra == "monitoring"
|
|
71
|
+
Requires-Dist: sentry-sdk[fastapi]<2,>=1.39; extra == "monitoring"
|
|
72
|
+
Requires-Dist: python-socketio<6,>=5.11; extra == "monitoring"
|
|
73
|
+
Requires-Dist: prometheus-client<1,>=0.19; extra == "monitoring"
|
|
74
|
+
Provides-Extra: all
|
|
75
|
+
Requires-Dist: ud-resolver[monitoring,postgres,security,system]; extra == "all"
|
|
76
|
+
Dynamic: license-file
|
|
77
|
+
|
|
78
|
+
# Universal Dependency Resolver
|
|
79
|
+
|
|
80
|
+
Resolve dependencies across **PyPI (pip)**, **npm**, **Cargo**, **Go**, and more — detect conflicts, check system compatibility, and export to any format.
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
udr resolve numpy@pypi torch@pypi
|
|
84
|
+
→ numpy 1.26.2, torch 2.1.2+cu121 (CUDA 12.1)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Package availability
|
|
88
|
+
|
|
89
|
+
| Source | Install | Published via |
|
|
90
|
+
|--------|---------|---------------|
|
|
91
|
+
| **PyPI** | `pip install ud-resolver` | GitHub Actions on release |
|
|
92
|
+
| **GitHub Packages** | `pip install ud-resolver --index-url https://pypi.pkg.github.com/code-with-zeeshan/` | GitHub Actions on release |
|
|
93
|
+
| **GHCR (Docker)** | `docker pull ghcr.io/code-with-zeeshan/universal-dependency-resolver-backend:latest` | CI on every push |
|
|
94
|
+
| **GitHub Releases** | Binary downloads from [Releases](https://github.com/code-with-zeeshan/universal-dependency-resolver/releases) | Manual / CI tag |
|
|
95
|
+
|
|
96
|
+
> **PyPI note**: The package is published on PyPI as **`ud-resolver`** — install with `pip install ud-resolver`, *not* `universal-dependency-resolver`.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## The Problem
|
|
101
|
+
|
|
102
|
+
You have a project that depends on packages from multiple ecosystems. A Python script calls a Node service. A Docker image needs both `pip` and `apt` packages. A CI pipeline must pin every transitive dependency across all of them.
|
|
103
|
+
|
|
104
|
+
Existing tools only work within one ecosystem (`pip-compile`, `npm ls`, `bundler`). Cross-ecosystem conflicts go undetected until runtime. System compatibility (GPU, CUDA, OS version) is never checked.
|
|
105
|
+
|
|
106
|
+
This tool solves that.
|
|
107
|
+
|
|
108
|
+
## What It Does
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Input: ["requests>=2.25", "torch==2.0", "express@^4.18"]
|
|
112
|
+
↓
|
|
113
|
+
Fetch metadata from PyPI / npm / Conda / ...
|
|
114
|
+
Detect target system (OS, GPU, Python, CUDA)
|
|
115
|
+
Resolve conflicts with SAT solver
|
|
116
|
+
↓
|
|
117
|
+
Output: Locked dependency tree + export (Dockerfile, requirements.txt, ...)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Quick Example
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
curl -X POST http://localhost:8000/api/v1/packages/resolve \
|
|
124
|
+
-H "Content-Type: application/json" \
|
|
125
|
+
-d '{
|
|
126
|
+
"packages": [
|
|
127
|
+
{"name": "requests", "ecosystem": "pypi"},
|
|
128
|
+
{"name": "express", "ecosystem": "npm"}
|
|
129
|
+
],
|
|
130
|
+
"auto_detect_system": true
|
|
131
|
+
}'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Returns a resolved dependency tree with all transitive deps, conflict status, and system compatibility notes.
|
|
135
|
+
|
|
136
|
+
| Feature | What it does |
|
|
137
|
+
|---------|--------------|
|
|
138
|
+
| **Multi-ecosystem** | PyPI (pip), npm, Cargo, Go, Conda, Maven, NuGet, RubyGems, Linux packages, Homebrew |
|
|
139
|
+
| **GPU-aware resolution** | Scans CUDA, cuDNN, GPU memory — resolves CUDA variants automatically |
|
|
140
|
+
| **System scan** | Detects OS, CPU, GPU, Python, Node.js, GCC, Java |
|
|
141
|
+
| **12 export formats** | Dockerfile, requirements.txt, package.json, docker-compose.yml, install.sh, CMakeLists.txt, pyproject.toml, environment.yml, Cargo.toml, build.gradle, pom.xml, Gemfile |
|
|
142
|
+
| **CI/CD ready** | CLI for pipelines, health check endpoint, structured logging |
|
|
143
|
+
| **Desktop app** | Cross-platform Electron app with integrated Python backend |
|
|
144
|
+
|
|
145
|
+
## Quick Start
|
|
146
|
+
|
|
147
|
+
### PyPI (recommended)
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
pip install ud-resolver
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Install with extras for additional features:
|
|
154
|
+
```bash
|
|
155
|
+
pip install "ud-resolver[system]" # GPU & system scanning
|
|
156
|
+
pip install "ud-resolver[monitoring]" # OpenTelemetry & Sentry
|
|
157
|
+
pip install "ud-resolver[security]" # Auth & JWT support
|
|
158
|
+
pip install "ud-resolver[postgres]" # PostgreSQL + Redis + Celery
|
|
159
|
+
pip install "ud-resolver[all]" # Everything
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### GitHub Packages
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pip install ud-resolver --index-url https://pypi.pkg.github.com/code-with-zeeshan/
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
This requires GitHub authentication. Create a [PAT](https://github.com/settings/tokens) with `read:packages` scope and use it in `~/.netrc` or `PIP_EXTRA_INDEX_URL`:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
echo "machine pypi.pkg.github.com login $GITHUB_USER password $GITHUB_TOKEN" > ~/.netrc
|
|
172
|
+
pip install ud-resolver
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### From source
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
git clone https://github.com/code-with-zeeshan/universal-dependency-resolver.git
|
|
179
|
+
cd universal-dependency-resolver
|
|
180
|
+
pip install -e .
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Use as CLI
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Start the API server
|
|
187
|
+
udr serve --port 8000
|
|
188
|
+
|
|
189
|
+
# Check system compatibility
|
|
190
|
+
udr check
|
|
191
|
+
|
|
192
|
+
# Resolve dependencies
|
|
193
|
+
udr resolve numpy pandas scikit-learn
|
|
194
|
+
|
|
195
|
+
# Resolve from other ecosystems
|
|
196
|
+
udr resolve react vue -e npm
|
|
197
|
+
udr resolve serde tokio -e crates
|
|
198
|
+
|
|
199
|
+
# Show system info
|
|
200
|
+
udr info
|
|
201
|
+
|
|
202
|
+
# Auto-detect manifests in project dir and lock all deps
|
|
203
|
+
udr lock
|
|
204
|
+
|
|
205
|
+
# Lock with explicit manifest
|
|
206
|
+
udr lock --manifest requirements.txt --manifest package.json
|
|
207
|
+
|
|
208
|
+
# Dry-run lock (no files written)
|
|
209
|
+
udr lock --dry-run
|
|
210
|
+
|
|
211
|
+
# Resolve with JSON output
|
|
212
|
+
udr resolve torch torchvision --format json
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Desktop app
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
cd desktop
|
|
219
|
+
npm install
|
|
220
|
+
npm start
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
The Electron app spawns the Python backend automatically and opens the Vue.js UI. Binary downloads are available from GitHub Releases.
|
|
224
|
+
|
|
225
|
+
### Web UI
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
cd frontend && npm install && npm run serve
|
|
229
|
+
# → http://localhost:8080
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
The frontend connects to the backend at `http://localhost:8000` (configurable via `VUE_APP_API_URL`).
|
|
233
|
+
|
|
234
|
+
### Use as Python Library
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
import asyncio
|
|
238
|
+
from backend.core.data_aggregator import DataAggregator
|
|
239
|
+
from backend.core.conflict_resolver import ConflictResolver
|
|
240
|
+
from backend.core.system_scanner import SystemScanner
|
|
241
|
+
from backend.manifest_detector import ManifestDetector
|
|
242
|
+
|
|
243
|
+
async def main():
|
|
244
|
+
scanner = SystemScanner()
|
|
245
|
+
system_info = await scanner.scan_all()
|
|
246
|
+
print(system_info["platform"]["system"], system_info["cpu"]["brand"])
|
|
247
|
+
|
|
248
|
+
aggregator = DataAggregator()
|
|
249
|
+
data = await aggregator.get_package_info("torch", ecosystem="pypi",
|
|
250
|
+
include_dependencies=True,
|
|
251
|
+
include_versions=True)
|
|
252
|
+
print(data["name"], data["versions"])
|
|
253
|
+
|
|
254
|
+
detector = ManifestDetector("./my-project")
|
|
255
|
+
manifests = detector.detect()
|
|
256
|
+
packages = detector.normalize(detector.parse_all(manifests))
|
|
257
|
+
print(f"{len(packages)} packages found")
|
|
258
|
+
|
|
259
|
+
asyncio.run(main())
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Docker (production)
|
|
263
|
+
|
|
264
|
+
Pre-built images are available on **GitHub Container Registry (GHCR)**:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
docker pull ghcr.io/code-with-zeeshan/universal-dependency-resolver-backend:latest
|
|
268
|
+
docker pull ghcr.io/code-with-zeeshan/universal-dependency-resolver-frontend:latest
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Or build and run locally:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
cp .env.example .env
|
|
275
|
+
docker compose up -d
|
|
276
|
+
docker compose exec backend alembic upgrade head
|
|
277
|
+
|
|
278
|
+
# Frontend: http://localhost:8080
|
|
279
|
+
# API Docs: http://localhost:8000/api/v1/docs
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
> **Note**: The Docker images are published automatically via CI on every push to `main` and on tags (`v*`).
|
|
283
|
+
|
|
284
|
+
## How It Works
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
Your request → Fetch metadata from ecosystem registries
|
|
288
|
+
↓
|
|
289
|
+
Scan target system (OS, GPU, Python, CUDA)
|
|
290
|
+
↓
|
|
291
|
+
Resolve conflicts with SAT solver
|
|
292
|
+
↓
|
|
293
|
+
Export to 12 formats
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
The system runs as a FastAPI service with optional PostgreSQL, Redis, and a Vue.js frontend.
|
|
297
|
+
|
|
298
|
+
## API Quick Reference
|
|
299
|
+
|
|
300
|
+
| Endpoint | Method | Purpose |
|
|
301
|
+
|----------|--------|---------|
|
|
302
|
+
| `/api/v1/packages/search` | GET | Search across ecosystems |
|
|
303
|
+
| `/api/v1/packages/{ecosystem}/{name}` | GET | Get package info |
|
|
304
|
+
| `/api/v1/packages/versions` | GET | List versions |
|
|
305
|
+
| `/api/v1/packages/resolve` | POST | Resolve dependencies |
|
|
306
|
+
| `/api/v1/packages/export` | POST | Export to any format |
|
|
307
|
+
| `/api/v1/packages/export-formats` | GET | Available export formats |
|
|
308
|
+
| `/api/v1/system/info` | GET | System information |
|
|
309
|
+
| `/api/v1/system/check-compatibility` | POST | Check dependency-system fit |
|
|
310
|
+
| `/api/v1/scan/github` | POST | Scan a GitHub repo |
|
|
311
|
+
| `/api/v1/scan/upload` | POST | Scan an uploaded archive |
|
|
312
|
+
| `/api/v1/scan/local` | POST | Scan a local directory |
|
|
313
|
+
| `/api/v1/health` | GET | Health check |
|
|
314
|
+
|
|
315
|
+
Full reference in [docs/API.md](docs/API.md).
|
|
316
|
+
|
|
317
|
+
## Testing
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# Unit tests
|
|
321
|
+
python -m pytest tests/unit/
|
|
322
|
+
|
|
323
|
+
# Frontend tests
|
|
324
|
+
cd frontend && npm run test:unit
|
|
325
|
+
|
|
326
|
+
# E2E tests (requires Chromium)
|
|
327
|
+
cd frontend && npm run test:e2e
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Roadmap
|
|
331
|
+
|
|
332
|
+
| Priority | Feature | Status |
|
|
333
|
+
|----------|---------|--------|
|
|
334
|
+
| 🔴 High | Python SDK with async support | ✅ Done |
|
|
335
|
+
| 🔴 High | CLI tool for CI/CD | ✅ Done |
|
|
336
|
+
| 🟡 Medium | JavaScript/TypeScript SDK | Planned |
|
|
337
|
+
| 🟡 Medium | CI/CD integration examples (GitHub Actions, GitLab CI) | Planned |
|
|
338
|
+
| 🟡 Medium | SBOM export (CycloneDX, SPDX) | Planned |
|
|
339
|
+
| 🟡 Medium | Visual dependency graphs | Planned |
|
|
340
|
+
| 🟢 Low | Plugin system for custom ecosystems | Researching |
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for production deployment,
|
|
345
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) to contribute,
|
|
346
|
+
and [LICENSE](LICENSE) for licensing (MIT).
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# Universal Dependency Resolver
|
|
2
|
+
|
|
3
|
+
Resolve dependencies across **PyPI (pip)**, **npm**, **Cargo**, **Go**, and more — detect conflicts, check system compatibility, and export to any format.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
udr resolve numpy@pypi torch@pypi
|
|
7
|
+
→ numpy 1.26.2, torch 2.1.2+cu121 (CUDA 12.1)
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Package availability
|
|
11
|
+
|
|
12
|
+
| Source | Install | Published via |
|
|
13
|
+
|--------|---------|---------------|
|
|
14
|
+
| **PyPI** | `pip install ud-resolver` | GitHub Actions on release |
|
|
15
|
+
| **GitHub Packages** | `pip install ud-resolver --index-url https://pypi.pkg.github.com/code-with-zeeshan/` | GitHub Actions on release |
|
|
16
|
+
| **GHCR (Docker)** | `docker pull ghcr.io/code-with-zeeshan/universal-dependency-resolver-backend:latest` | CI on every push |
|
|
17
|
+
| **GitHub Releases** | Binary downloads from [Releases](https://github.com/code-with-zeeshan/universal-dependency-resolver/releases) | Manual / CI tag |
|
|
18
|
+
|
|
19
|
+
> **PyPI note**: The package is published on PyPI as **`ud-resolver`** — install with `pip install ud-resolver`, *not* `universal-dependency-resolver`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## The Problem
|
|
24
|
+
|
|
25
|
+
You have a project that depends on packages from multiple ecosystems. A Python script calls a Node service. A Docker image needs both `pip` and `apt` packages. A CI pipeline must pin every transitive dependency across all of them.
|
|
26
|
+
|
|
27
|
+
Existing tools only work within one ecosystem (`pip-compile`, `npm ls`, `bundler`). Cross-ecosystem conflicts go undetected until runtime. System compatibility (GPU, CUDA, OS version) is never checked.
|
|
28
|
+
|
|
29
|
+
This tool solves that.
|
|
30
|
+
|
|
31
|
+
## What It Does
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Input: ["requests>=2.25", "torch==2.0", "express@^4.18"]
|
|
35
|
+
↓
|
|
36
|
+
Fetch metadata from PyPI / npm / Conda / ...
|
|
37
|
+
Detect target system (OS, GPU, Python, CUDA)
|
|
38
|
+
Resolve conflicts with SAT solver
|
|
39
|
+
↓
|
|
40
|
+
Output: Locked dependency tree + export (Dockerfile, requirements.txt, ...)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Example
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
curl -X POST http://localhost:8000/api/v1/packages/resolve \
|
|
47
|
+
-H "Content-Type: application/json" \
|
|
48
|
+
-d '{
|
|
49
|
+
"packages": [
|
|
50
|
+
{"name": "requests", "ecosystem": "pypi"},
|
|
51
|
+
{"name": "express", "ecosystem": "npm"}
|
|
52
|
+
],
|
|
53
|
+
"auto_detect_system": true
|
|
54
|
+
}'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Returns a resolved dependency tree with all transitive deps, conflict status, and system compatibility notes.
|
|
58
|
+
|
|
59
|
+
| Feature | What it does |
|
|
60
|
+
|---------|--------------|
|
|
61
|
+
| **Multi-ecosystem** | PyPI (pip), npm, Cargo, Go, Conda, Maven, NuGet, RubyGems, Linux packages, Homebrew |
|
|
62
|
+
| **GPU-aware resolution** | Scans CUDA, cuDNN, GPU memory — resolves CUDA variants automatically |
|
|
63
|
+
| **System scan** | Detects OS, CPU, GPU, Python, Node.js, GCC, Java |
|
|
64
|
+
| **12 export formats** | Dockerfile, requirements.txt, package.json, docker-compose.yml, install.sh, CMakeLists.txt, pyproject.toml, environment.yml, Cargo.toml, build.gradle, pom.xml, Gemfile |
|
|
65
|
+
| **CI/CD ready** | CLI for pipelines, health check endpoint, structured logging |
|
|
66
|
+
| **Desktop app** | Cross-platform Electron app with integrated Python backend |
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
### PyPI (recommended)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install ud-resolver
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Install with extras for additional features:
|
|
77
|
+
```bash
|
|
78
|
+
pip install "ud-resolver[system]" # GPU & system scanning
|
|
79
|
+
pip install "ud-resolver[monitoring]" # OpenTelemetry & Sentry
|
|
80
|
+
pip install "ud-resolver[security]" # Auth & JWT support
|
|
81
|
+
pip install "ud-resolver[postgres]" # PostgreSQL + Redis + Celery
|
|
82
|
+
pip install "ud-resolver[all]" # Everything
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### GitHub Packages
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install ud-resolver --index-url https://pypi.pkg.github.com/code-with-zeeshan/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This requires GitHub authentication. Create a [PAT](https://github.com/settings/tokens) with `read:packages` scope and use it in `~/.netrc` or `PIP_EXTRA_INDEX_URL`:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
echo "machine pypi.pkg.github.com login $GITHUB_USER password $GITHUB_TOKEN" > ~/.netrc
|
|
95
|
+
pip install ud-resolver
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### From source
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git clone https://github.com/code-with-zeeshan/universal-dependency-resolver.git
|
|
102
|
+
cd universal-dependency-resolver
|
|
103
|
+
pip install -e .
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Use as CLI
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Start the API server
|
|
110
|
+
udr serve --port 8000
|
|
111
|
+
|
|
112
|
+
# Check system compatibility
|
|
113
|
+
udr check
|
|
114
|
+
|
|
115
|
+
# Resolve dependencies
|
|
116
|
+
udr resolve numpy pandas scikit-learn
|
|
117
|
+
|
|
118
|
+
# Resolve from other ecosystems
|
|
119
|
+
udr resolve react vue -e npm
|
|
120
|
+
udr resolve serde tokio -e crates
|
|
121
|
+
|
|
122
|
+
# Show system info
|
|
123
|
+
udr info
|
|
124
|
+
|
|
125
|
+
# Auto-detect manifests in project dir and lock all deps
|
|
126
|
+
udr lock
|
|
127
|
+
|
|
128
|
+
# Lock with explicit manifest
|
|
129
|
+
udr lock --manifest requirements.txt --manifest package.json
|
|
130
|
+
|
|
131
|
+
# Dry-run lock (no files written)
|
|
132
|
+
udr lock --dry-run
|
|
133
|
+
|
|
134
|
+
# Resolve with JSON output
|
|
135
|
+
udr resolve torch torchvision --format json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Desktop app
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
cd desktop
|
|
142
|
+
npm install
|
|
143
|
+
npm start
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The Electron app spawns the Python backend automatically and opens the Vue.js UI. Binary downloads are available from GitHub Releases.
|
|
147
|
+
|
|
148
|
+
### Web UI
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
cd frontend && npm install && npm run serve
|
|
152
|
+
# → http://localhost:8080
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The frontend connects to the backend at `http://localhost:8000` (configurable via `VUE_APP_API_URL`).
|
|
156
|
+
|
|
157
|
+
### Use as Python Library
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
import asyncio
|
|
161
|
+
from backend.core.data_aggregator import DataAggregator
|
|
162
|
+
from backend.core.conflict_resolver import ConflictResolver
|
|
163
|
+
from backend.core.system_scanner import SystemScanner
|
|
164
|
+
from backend.manifest_detector import ManifestDetector
|
|
165
|
+
|
|
166
|
+
async def main():
|
|
167
|
+
scanner = SystemScanner()
|
|
168
|
+
system_info = await scanner.scan_all()
|
|
169
|
+
print(system_info["platform"]["system"], system_info["cpu"]["brand"])
|
|
170
|
+
|
|
171
|
+
aggregator = DataAggregator()
|
|
172
|
+
data = await aggregator.get_package_info("torch", ecosystem="pypi",
|
|
173
|
+
include_dependencies=True,
|
|
174
|
+
include_versions=True)
|
|
175
|
+
print(data["name"], data["versions"])
|
|
176
|
+
|
|
177
|
+
detector = ManifestDetector("./my-project")
|
|
178
|
+
manifests = detector.detect()
|
|
179
|
+
packages = detector.normalize(detector.parse_all(manifests))
|
|
180
|
+
print(f"{len(packages)} packages found")
|
|
181
|
+
|
|
182
|
+
asyncio.run(main())
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Docker (production)
|
|
186
|
+
|
|
187
|
+
Pre-built images are available on **GitHub Container Registry (GHCR)**:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
docker pull ghcr.io/code-with-zeeshan/universal-dependency-resolver-backend:latest
|
|
191
|
+
docker pull ghcr.io/code-with-zeeshan/universal-dependency-resolver-frontend:latest
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Or build and run locally:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
cp .env.example .env
|
|
198
|
+
docker compose up -d
|
|
199
|
+
docker compose exec backend alembic upgrade head
|
|
200
|
+
|
|
201
|
+
# Frontend: http://localhost:8080
|
|
202
|
+
# API Docs: http://localhost:8000/api/v1/docs
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
> **Note**: The Docker images are published automatically via CI on every push to `main` and on tags (`v*`).
|
|
206
|
+
|
|
207
|
+
## How It Works
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
Your request → Fetch metadata from ecosystem registries
|
|
211
|
+
↓
|
|
212
|
+
Scan target system (OS, GPU, Python, CUDA)
|
|
213
|
+
↓
|
|
214
|
+
Resolve conflicts with SAT solver
|
|
215
|
+
↓
|
|
216
|
+
Export to 12 formats
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The system runs as a FastAPI service with optional PostgreSQL, Redis, and a Vue.js frontend.
|
|
220
|
+
|
|
221
|
+
## API Quick Reference
|
|
222
|
+
|
|
223
|
+
| Endpoint | Method | Purpose |
|
|
224
|
+
|----------|--------|---------|
|
|
225
|
+
| `/api/v1/packages/search` | GET | Search across ecosystems |
|
|
226
|
+
| `/api/v1/packages/{ecosystem}/{name}` | GET | Get package info |
|
|
227
|
+
| `/api/v1/packages/versions` | GET | List versions |
|
|
228
|
+
| `/api/v1/packages/resolve` | POST | Resolve dependencies |
|
|
229
|
+
| `/api/v1/packages/export` | POST | Export to any format |
|
|
230
|
+
| `/api/v1/packages/export-formats` | GET | Available export formats |
|
|
231
|
+
| `/api/v1/system/info` | GET | System information |
|
|
232
|
+
| `/api/v1/system/check-compatibility` | POST | Check dependency-system fit |
|
|
233
|
+
| `/api/v1/scan/github` | POST | Scan a GitHub repo |
|
|
234
|
+
| `/api/v1/scan/upload` | POST | Scan an uploaded archive |
|
|
235
|
+
| `/api/v1/scan/local` | POST | Scan a local directory |
|
|
236
|
+
| `/api/v1/health` | GET | Health check |
|
|
237
|
+
|
|
238
|
+
Full reference in [docs/API.md](docs/API.md).
|
|
239
|
+
|
|
240
|
+
## Testing
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Unit tests
|
|
244
|
+
python -m pytest tests/unit/
|
|
245
|
+
|
|
246
|
+
# Frontend tests
|
|
247
|
+
cd frontend && npm run test:unit
|
|
248
|
+
|
|
249
|
+
# E2E tests (requires Chromium)
|
|
250
|
+
cd frontend && npm run test:e2e
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Roadmap
|
|
254
|
+
|
|
255
|
+
| Priority | Feature | Status |
|
|
256
|
+
|----------|---------|--------|
|
|
257
|
+
| 🔴 High | Python SDK with async support | ✅ Done |
|
|
258
|
+
| 🔴 High | CLI tool for CI/CD | ✅ Done |
|
|
259
|
+
| 🟡 Medium | JavaScript/TypeScript SDK | Planned |
|
|
260
|
+
| 🟡 Medium | CI/CD integration examples (GitHub Actions, GitLab CI) | Planned |
|
|
261
|
+
| 🟡 Medium | SBOM export (CycloneDX, SPDX) | Planned |
|
|
262
|
+
| 🟡 Medium | Visual dependency graphs | Planned |
|
|
263
|
+
| 🟢 Low | Plugin system for custom ecosystems | Researching |
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for production deployment,
|
|
268
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) to contribute,
|
|
269
|
+
and [LICENSE](LICENSE) for licensing (MIT).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# backend/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
Universal Dependency Resolver Backend Package
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .settings import get_ecosystem_config
|
|
7
|
+
from .core import DataAggregator, ConflictResolver, SystemScanner, ExportGenerator
|
|
8
|
+
from .manifest_detector import ManifestDetector
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"get_ecosystem_config",
|
|
12
|
+
"DataAggregator",
|
|
13
|
+
"ConflictResolver",
|
|
14
|
+
"SystemScanner",
|
|
15
|
+
"ExportGenerator",
|
|
16
|
+
"ManifestDetector",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
import logging
|
|
20
|
+
logging.getLogger(__name__).addHandler(logging.NullHandler())
|