depguard 0.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.
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: depguard
3
+ Version: 0.1.0
4
+ Summary: AI-powered Python dependency vulnerability scanner
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: typer>=0.9.0
7
+ Requires-Dist: httpx>=0.27.0
@@ -0,0 +1 @@
1
+ from .cli import main
@@ -0,0 +1,74 @@
1
+ import typer
2
+ import httpx
3
+ import os
4
+ import json
5
+
6
+ app = typer.Typer()
7
+
8
+ API_URL = "https://depguard.onrender.com/scan"
9
+ HEALTH_URL = "https://depguard.onrender.com/health"
10
+
11
+
12
+ def wake_server():
13
+ """Ping the server to wake it up if it's sleeping."""
14
+ try:
15
+ typer.echo("⏳ Connecting to DepGuard server...")
16
+ httpx.get(HEALTH_URL, timeout=60.0)
17
+ typer.echo("✅ Server is awake!\n")
18
+ except httpx.TimeoutException:
19
+ typer.echo("⚠️ Server is slow to wake — retrying scan anyway...\n")
20
+ except Exception:
21
+ pass # Best effort
22
+
23
+
24
+ @app.command()
25
+ def scan():
26
+ """Scan your project's requirements.txt for known vulnerabilities."""
27
+
28
+ req_path = os.path.join(os.getcwd(), "requirements.txt")
29
+
30
+ if not os.path.exists(req_path):
31
+ typer.echo("❌ No requirements.txt found in the current directory.")
32
+ raise typer.Exit()
33
+
34
+ wake_server()
35
+
36
+ typer.echo("📦 requirements.txt Found — Processing for vulnerabilities...\n")
37
+
38
+ try:
39
+ with open(req_path, "rb") as f:
40
+ response = httpx.post(
41
+ API_URL,
42
+ files={"requirements": ("requirements.txt", f, "text/plain")},
43
+ timeout=180.0
44
+ )
45
+ except httpx.TimeoutException:
46
+ typer.echo("❌ Request timed out. The server may be overloaded — please try again.")
47
+ raise typer.Exit()
48
+
49
+ if response.status_code != 200:
50
+ typer.echo(f"❌ Server error: {response.status_code} — {response.text}")
51
+ raise typer.Exit()
52
+
53
+ data = response.json()
54
+
55
+ # Print the full agent log
56
+ for log in data.get("logs", []):
57
+ typer.echo(log)
58
+
59
+ # Write updated requirements.txt back to the developer's project
60
+ if data.get("updated_requirements"):
61
+ with open(req_path, "w") as f:
62
+ f.write(data["updated_requirements"])
63
+ typer.echo("\n✅ requirements.txt updated in your project.")
64
+
65
+ # Write audit_report.json to the developer's project
66
+ if data.get("audit_report"):
67
+ report_path = os.path.join(os.getcwd(), "audit_report.json")
68
+ with open(report_path, "w") as f:
69
+ json.dump(data["audit_report"], f, indent=2)
70
+ typer.echo("✅ audit_report.json saved in your project.")
71
+
72
+
73
+ def main():
74
+ app()
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: depguard
3
+ Version: 0.1.0
4
+ Summary: AI-powered Python dependency vulnerability scanner
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: typer>=0.9.0
7
+ Requires-Dist: httpx>=0.27.0
@@ -0,0 +1,9 @@
1
+ pyproject.toml
2
+ depguard/__init__.py
3
+ depguard/cli.py
4
+ depguard.egg-info/PKG-INFO
5
+ depguard.egg-info/SOURCES.txt
6
+ depguard.egg-info/dependency_links.txt
7
+ depguard.egg-info/entry_points.txt
8
+ depguard.egg-info/requires.txt
9
+ depguard.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ depguard = depguard.cli:main
@@ -0,0 +1,2 @@
1
+ typer>=0.9.0
2
+ httpx>=0.27.0
@@ -0,0 +1 @@
1
+ depguard
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "depguard"
7
+ version = "0.1.0"
8
+ description = "AI-powered Python dependency vulnerability scanner"
9
+ requires-python = ">=3.11"
10
+ dependencies = [
11
+ "typer>=0.9.0",
12
+ "httpx>=0.27.0",
13
+ ]
14
+
15
+ [project.scripts]
16
+ depguard = "depguard.cli:main"
17
+
18
+ [tool.setuptools.packages.find]
19
+ where = ["."]
20
+ include = ["depguard*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+