{"record":{"id":"3b305b27be050ec3","repo":"zylon-ai/private-gpt","slug":"no-distributions-found-in-package-dir","errorCode":null,"errorMessage":"No distributions found in {package_dir}","messagePattern":"No distributions found in (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/build_pip_index.py","lineNumber":118,"sourceCode":"    output_dir = output_dir.resolve()\n    output_dir.mkdir(parents=True, exist_ok=True)\n\n    simple_dir = output_dir / \"simple\"\n    if simple_dir.exists():\n        for path in sorted(simple_dir.rglob(\"*\"), reverse=True):\n            if path.is_file():\n                path.unlink()\n            elif path.is_dir():\n                path.rmdir()\n    simple_dir.mkdir(exist_ok=True)\n\n    distributions = [\n        read_distribution(path)\n        for path in sorted(package_dir.iterdir())\n        if path.is_file() and (path.suffix == \".whl\" or path.name.endswith(\".tar.gz\"))\n    ]\n    if not distributions:\n        raise ValueError(f\"No distributions found in {package_dir}\")\n\n    grouped: dict[str, list[Distribution]] = defaultdict(list)\n    canonical_names: dict[str, str] = {}\n    for distribution in distributions:\n        grouped[distribution.normalized_name].append(distribution)\n        canonical_names.setdefault(distribution.normalized_name, distribution.name)\n\n    package_links = []\n    artifact_links = []\n    for normalized_name in sorted(grouped):\n        canonical_name = canonical_names[normalized_name]\n        project_dir = simple_dir / normalized_name\n        project_dir.mkdir(parents=True, exist_ok=True)\n\n        file_links = []\n        for distribution in sorted(\n            grouped[normalized_name], key=lambda item: item.filename\n        ):","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/scripts/build_pip_index.py#L100-L136","documentation":"Raised by the main index builder in scripts/build_pip_index.py when the package directory, after filtering for .whl and .tar.gz files, contains zero distributions. The script deliberately fails instead of emitting an empty index page, because an empty simple index usually indicates the artifacts were never copied or the wrong directory was passed.","triggerScenarios":"Running build_pip_index.py before any artifacts were placed in the expected folder; passing an output/dist directory path that contains only source files; artifacts named with non-matching extensions (see error 432) so the filter excludes everything; a build step that failed silently before the index step.","commonSituations":"CI pipelines where 'uv build' output dir differs from the dir the index script scans; artifacts cleaned by a prior step; first run on a fresh checkout with no build executed yet; pointing the script at a directory of symlinks that are not is_file()-true (broken links).","solutions":["Build first, then index: run uv build / python -m build and confirm .whl/.tar.gz files exist in the scanned directory","Check for extension mismatches or broken symlinks with ls -la on the package dir","Pass or configure the correct package directory path to the script","If the directory is intentionally empty, skip running the index builder (guard in CI)"],"exampleFix":"# before\npython scripts/build_pip_index.py --dir dist-empty/\n# ValueError: No distributions found in dist-empty\n\n# after\nuv build\npython scripts/build_pip_index.py --dir dist/","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef package_dir_ready(package_dir: Path) -> bool:\n    return any(\n        p.is_file() and (p.suffix == \".whl\" or p.name.endswith(\".tar.gz\"))\n        for p in package_dir.iterdir()\n    )\n\n# skip or fail with a clear message when False before building the index","typeGuard":"null","tryCatchPattern":"try:\n    build_index(package_dir, out)\nexcept ValueError as e:\n    if \"No distributions found\" in str(e):\n        raise SystemExit(\"build artifacts first: uv build, then rerun\")\n    raise","preventionTips":["Chain build and index steps in one CI job so artifacts exist before indexing","Assert the dist dir contains at least one .whl/.tar.gz as a CI gate","Use the same dist/ path in both the build step and the index script configuration","Fail CI early on empty builds instead of running downstream steps"],"tags":["packaging","pip-index","build","scripts"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}