Skip to content

fix(AI-3750): stop duplicate _ui_dist wheel entry on VCS-less source builds - #623

Open
Matovidlo wants to merge 1 commit into
mainfrom
martinvasko-ai-3750-ai-kit-docs-misroute-kbagent-install-points-at-old-kbc-cli
Open

fix(AI-3750): stop duplicate _ui_dist wheel entry on VCS-less source builds#623
Matovidlo wants to merge 1 commit into
mainfrom
martinvasko-ai-3750-ai-kit-docs-misroute-kbagent-install-points-at-old-kbc-cli

Conversation

@Matovidlo

Copy link
Copy Markdown
Contributor

Summary

  • Fixes a wheel-build crash ("A second file is being added to the wheel archive at the same path") hit when installing kbagent via uv tool install git+https://github.com/keboola/cli (the install.sh fallback path) on a source tree with no .git directory.
  • Root cause: force-include's de-dup with hatchling's default package globbing for _ui_dist/ relies on .gitignore-based exclusion, which needs a .git dir to run git check-ignore against. Without one, the (gitignored) _ui_dist/ the build hook just populated gets picked up by both the default globbing and force-include → duplicate archive entry → build aborts.
  • Fix: add an explicit exclude = ["src/keboola_agent_cli/_ui_dist"] under [tool.hatch.build.targets.wheel] — a plain glob evaluated unconditionally, independent of VCS state, so force-include is the only path that adds it.
  • Adds an end-to-end regression test (tests/test_build_hook.py::TestForceIncludeNoDuplicate) that builds a real wheel in a .git-less tree; verified it fails on the pre-fix config and passes on the post-fix one.
  • Documents the previously-undocumented Python >=3.12 install floor in README's Install section, with the UV_PYTHON=3.12 workaround for when uv doesn't auto-fetch a matching interpreter.

Filed against AI-3750. Note: this PR covers only Defects 2 & 3 from that issue (the wheel-build crash and the undocumented Python floor). Defect 1 (ai-kit's docs pointing at the wrong CLI / developers.keboola.com/cli) lives entirely in the separate keboola/ai-kit repo — nothing in this repo references it, so there's nothing to fix here for that part.

Test plan

  • Reproduced the exact reported error locally: cloned the repo, stripped .git, populated a fake SPA dist, ran uv build --wheel → same ValueError: A second file is being added to the wheel archive at the same path traceback.
  • Applied the exclude fix, reran the same reproduction → build succeeds; confirmed via zipfile inspection that _ui_dist/index.html and py.typed are each present exactly once.
  • Sanity-built the wheel in the real repo (with .git present, both with and without a prebuilt SPA dist) → no regression.
  • New test TestForceIncludeNoDuplicate::test_wheel_builds_without_git_directory added; confirmed it fails without the pyproject.toml fix and passes with it (git-stash round-trip).
  • ruff check / ruff format --check clean on changed files.
  • Full test suite (uv run pytest tests/ -m "not e2e", 5.6k+ tests) passes.

Related issues

AI-3750

🤖 Generated with Claude Code

…builds

hatchling's force-include for _ui_dist/ relies on .gitignore-based exclusion
to avoid double-adding the path, but that exclusion needs a .git directory to
run `git check-ignore` against. A git+ install that hands hatchling a plain
exported tree (no .git) skips it, so _ui_dist/index.html gets added twice and
the build aborts. Add an explicit wheel-target exclude so it works regardless
of VCS state, and document the undocumented Python >=3.12 floor in the README
install instructions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Aug 20, 2026

Copy link
Copy Markdown

AI-3750

@Matovidlo

Copy link
Copy Markdown
Contributor Author

@claude review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a wheel-build failure that occurs when building from a VCS-less exported source tree (no .git directory), where src/keboola_agent_cli/_ui_dist/ could be collected twice (default package collection + force-include) and abort the build with a duplicate-archive-path error. It also adds a regression test to exercise that no-.git build path and documents the project’s Python version floor in the install instructions.

Changes:

  • Prevent duplicate _ui_dist/ inclusion by explicitly excluding src/keboola_agent_cli/_ui_dist from default wheel collection while keeping force-include as the single inclusion path.
  • Add an end-to-end test that builds a wheel in a .git-less temporary project and asserts _ui_dist/index.html appears exactly once.
  • Document the Python >= 3.12 requirement (and UV_PYTHON=3.12 workaround) in the README install section.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pyproject.toml Adds an explicit wheel exclude to avoid duplicate _ui_dist/ entries in VCS-less builds while retaining force-include.
tests/test_build_hook.py Adds an end-to-end regression test that builds a wheel without a .git directory and checks _ui_dist isn’t duplicated.
README.md Documents Python >= 3.12 install requirement and a uv interpreter selection workaround.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test_build_hook.py
@Matovidlo

Copy link
Copy Markdown
Contributor Author

Closing -- scope was wrong for this issue; redoing the actual fix (ai-kit docs cross-references) in keboola/ai-kit instead.

@Matovidlo Matovidlo closed this Aug 20, 2026
@Matovidlo Matovidlo reopened this Aug 20, 2026
@Matovidlo
Matovidlo requested a review from MiroCillik August 20, 2026 09:44
@Matovidlo
Matovidlo marked this pull request as ready for review August 20, 2026 09:44
@Matovidlo
Matovidlo requested a review from soustruh August 20, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants