MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / main

Function main

scripts/utils/check-dependency-caps.py:29–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27
28
29def main() -> None:
30 pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
31 with open(pyproject_path, "rb") as f:
32 pyproject = tomllib.load(f)
33
34 project: dict[str, Any] = pyproject["project"]
35 build_system: dict[str, Any] = pyproject.get("build-system", {})
36
37 requirement_tables: dict[str, list[str]] = {"project.dependencies": project.get("dependencies", [])}
38 optional_dependencies: dict[str, list[str]] = project.get("optional-dependencies", {})
39 for extra, requirements in optional_dependencies.items():
40 requirement_tables[f"project.optional-dependencies.{extra}"] = requirements
41 requirement_tables["build-system.requires"] = build_system.get("requires", [])
42
43 missing_caps: list[str] = []
44 for group, requirements in requirement_tables.items():
45 for raw in requirements:
46 requirement = Requirement(raw)
47 if not has_upper_bound(requirement):
48 missing_caps.append(f" [{group}] {raw}")
49
50 if missing_caps:
51 print("The following dependencies are missing an upper version bound (e.g. `>=2, <3`):")
52 print("\n".join(missing_caps))
53 sys.exit(1)
54
55
56if __name__ == "__main__":

Callers 1

Calls 2

has_upper_boundFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected