croqui 0.1.0__py3-none-any.whl

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.
croqui/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """croqui — sketch-style API + database maps generated from source."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,30 @@
1
+ """Per-stack scanners. Each adapter turns source code into graph nodes/edges."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ from .fastapi_py import FastApiScanner
8
+
9
+ ADAPTERS = {"python/fastapi": FastApiScanner}
10
+
11
+
12
+ def detect_stack(root: Path) -> str | None:
13
+ """Best-effort stack detection, cheapest signal first."""
14
+ for candidate in ("requirements.txt", "pyproject.toml", "requirements-worker.txt"):
15
+ path = root / candidate
16
+ if path.is_file():
17
+ text = path.read_text(encoding="utf-8", errors="replace").lower()
18
+ if "fastapi" in text:
19
+ return "python/fastapi"
20
+ if list(root.glob("**/main.py")) and list(root.rglob("*.py")):
21
+ for path in root.rglob("*.py"):
22
+ if "__pycache__" in path.parts:
23
+ continue
24
+ head = path.read_text(encoding="utf-8", errors="replace")[:2000]
25
+ if "APIRouter" in head or "from fastapi" in head:
26
+ return "python/fastapi"
27
+ return None
28
+
29
+
30
+ __all__ = ["ADAPTERS", "FastApiScanner", "detect_stack"]