SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
13 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
5.5 KB · 82 lines python
Raw Blame History
1import pytest23from aiatlas.connectors.code.github import GitHubConnector, entity_type_for, repo_entries4from aiatlas.connectors.code.pypi import PyPIConnector, _license, _norm5from aiatlas.ontology.taxonomy import FRAMEWORK_KINDS6from aiatlas.registry import organizations7from aiatlas.sdk.facts import Target8from tests.conftest import claims_of, extract_from_fixture, fixture_path91011def test_repositories_registry():12    entries = repo_entries()13    assert len(entries) >= 70 and len({e["key"] for e in entries}) == len(entries)14    assert all((e["kind"] == "model" or e["kind"] in FRAMEWORK_KINDS) and e["repo"].count("/") == 1 for e in entries)   # canonical kinds15    assert all(e["organization"] in organizations() for e in entries if e.get("organization"))16    agents = [e for e in entries if e["kind"] == "agent"]17    assert {e["key"] for e in agents} == {"claude-code", "codex", "gemini-cli", "openhands", "aider", "browser-use"}18    assert all(e.get("agent_kind") in ("coding", "browser", "research") for e in agents)19    assert entity_type_for("agent") == "agent" and entity_type_for("application") == "tool" and entity_type_for("mcp-server") == "tool"20    assert entity_type_for("model") == "repository" and entity_type_for("inference-engine") == "framework" and entity_type_for("library") == "framework"21    tools = [e["key"] for e in entries if entity_type_for(e["kind"]) == "tool"]22    assert {"comfyui", "lms", "text-generation-webui", "stable-diffusion-webui", "mcp-servers"} <= set(tools)232425@pytest.fixture26def gh() -> GitHubConnector:27    return GitHubConnector()282930async def test_github_discover(gh):31    targets = await gh.discover(None)  # type: ignore[arg-type]32    assert len(targets) == 3 * len(repo_entries())33    assert {t.doc_type for t in targets} == {"repository", "feed", "readme"} and gh.rate_per_min == 20343536async def test_github_repo_page(gh):37    target = Target(url="https://github.com/vllm-project/vllm", doc_type="repository", key="repo:vllm-project/vllm", meta={"repo": "vllm-project/vllm"})38    facts = await extract_from_fixture(gh, target, fixture_path("github", "repo-vllm.html"))39    vllm = next(e for e in facts.entities if e.entity_type == "framework")40    assert vllm.identifiers == {"github_repo": "vllm-project/vllm", "pypi": "vllm"} and vllm.organization.name == "vLLM project"41    c = claims_of(facts, "vllm")42    assert c["metric.stars"] == 91512 and c["metric.forks"] == 22070 and c["license"] == "Apache-2.0" and c["metric.releases"] == 10543    assert c["kind"] == "inference-engine" and "kind_raw" not in c and "license_raw" not in c            # already canonical in the seed / SPDX44    assert c["description"].startswith("A high-throughput") and c["homepage"] == "https://vllm.ai" and "llm-serving" in c["topics"]45    assert c["created_at"] == "2023-02-09T11:23:20+00:00" and "language" not in c            # language bar is client-rendered464748async def test_github_releases(gh):49    target = Target(url="https://github.com/vllm-project/vllm/releases.atom", doc_type="feed", key="releases:vllm-project/vllm", meta={"repo": "vllm-project/vllm"})50    facts = await extract_from_fixture(gh, target, fixture_path("github", "releases-vllm.atom"), content_type="application/atom+xml")51    c = claims_of(facts, "vllm")52    assert c["latest_version"] == "0.29.0" and c["latest_release_tag"] == "v0.29.0" and c["latest_release_at"].startswith("2026-09-10")53    events = [e for e in facts.events if e.event_type == "RELEASE"]54    assert len(events) == 10 and events[0].dedupe_key == "RELEASE:https://github.com/vllm-project/vllm/releases/tag/proto-v0.1.0"55    assert all(e.effective_at is not None for e in events)565758async def test_github_readme(gh):59    target = Target(url="https://raw.githubusercontent.com/vllm-project/vllm/HEAD/README.md", doc_type="readme", key="readme:vllm-project/vllm", meta={"repo": "vllm-project/vllm"})60    facts = await extract_from_fixture(gh, target, fixture_path("github", "readme-vllm.md"), content_type="text/markdown")61    assert facts.document_entity is not None and facts.document_entity.identifiers["github_repo"] == "vllm-project/vllm"626364async def test_pypi_package():65    c = PyPIConnector()66    assert len(c.packages()) >= 100 and "vllm" in c.packages() and c.packages()["vllm"]["repo"] == "vllm-project/vllm"67    target = Target(url="https://pypi.org/pypi/vllm/json", doc_type="package", key="pkg:vllm", meta={"pypi": "vllm"})68    facts = await extract_from_fixture(c, target, fixture_path("pypi", "vllm.json"), content_type="application/json")69    ent = next(e for e in facts.entities if e.entity_type == "framework")70    assert ent.identifiers == {"github_repo": "vllm-project/vllm", "pypi": "vllm"}       # merges with the GitHub entity71    cl = claims_of(facts, "vllm")72    assert cl["pypi_version"] == "0.29.0" and cl["pypi_release_at"] == "2026-09-09T08:58:32+00:00" and cl["pypi_license"] == "Apache-2.0"73    assert "license" not in cl and "homepage" not in cl                                 # owned by the GitHub page for mapped repos74    assert cl["requires_python"] == "<3.15,>=3.10" and cl["metric.releases"] == 97 and cl["docs_url"] == "https://docs.vllm.ai/en/latest/"75    assert "latest_version" not in cl                                                     # owned by the GitHub release feed for mapped repos767778def test_pypi_helpers():79    assert _norm("Llama_CPP.python") == "llama-cpp-python"80    assert _license({"license_expression": "MIT"}) == "MIT"81    assert _license({"license": "", "classifiers": ["License :: OSI Approved :: Apache Software License"]}) == "Apache Software License"82