Repository navigation
fix(packaging): include image fixture in wheel - #977
Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit intoOct 19, 2026
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Abhijeet Prasad (AbhiPrasad)
deleted the
abhi/investigate-ci-failure-3953b521
branch
October 19, 2026 21:41
Abhijeet Prasad (AbhiPrasad)
added a commit
that referenced
this pull request
Oct 19, 2026
The wheel ships our colocated tests: 154 of its 465 files are `test_*.py`, `conftest.py`, private test helpers (`_test_*.py`), `type_tests/` and `fixtures/test-image.png`. That puts a `conftest.py` into users' site-packages and roughly doubles the wheel size. Some shipped tests don't even work: one btx test module crashes on import because `braintrust/btx/spec-ref.txt` isn't packaged. ## Changes - **Exclude tests from the wheel.** `py/_build_hooks.py` adds a `build_py` subclass that drops `test_*`, `_test_*` and `conftest` modules. It is registered via `[tool.setuptools.cmdclass]` with `backend-path = ["."]`, and included in the sdist through `MANIFEST.in` because uv builds the wheel from the sdist. `type_tests/` and `fixtures/` are excluded both as packages and as package data. Pyproject settings alone can't do this, because `exclude-package-data` doesn't filter `.py` modules. The sdist still contains the tests. - Wheel: 465 → 307 files, 1.16 MB → 0.68 MB compressed. - `braintrust.test_helpers` is still shipped. It's public and downstream test suites import it (`zenml-io/kitaru` and `braintrustdata/docs-training` use `with_memory_logger` and `init_test_logger`). The smoke test checks that it stays importable. - **Replace `make test-wheel`.** It ran `nox -s test_core -- --wheel`, which executed the tests shipped inside the wheel. It now runs a new `test_wheel` session over `py/tests/wheel/test_wheel.py`, from a temp dir against the wheel in `dist/`. The test checks: - braintrust is imported from site-packages - the version is templated - `py.typed` is present - no test files, cassettes, `type_tests/` or `fixtures/` are in the wheel - every `braintrust.*` submodule imports, allowing missing optional third-party packages - the pytest11, console script and harbor entry points resolve - `braintrust --help` works - a local `Eval(..., no_send_logs=True)` runs - **Remove the old `--wheel` mode:** the noxfile plumbing, the wheel-only VCR skip in `conftest.py`, the wheel branch in `test_version.py`, and two dead "scripts/ not available" skips. - **CI:** - `test_wheel` is excluded from the sharded nox matrix (in `checks.yaml` and `update-session-weights.yaml`). - The `upload-wheel` job now runs `build test-wheel`, so packaging regressions like #977 fail on PRs instead of at release time. - Release workflows pick up the new check through `verify-build` unchanged. ## Validation - `make build && make test-wheel`: 11 passed. - The same suite against a wheel built from current `main` fails `test_does_not_ship_tests` and `test_all_modules_import` (the btx `spec-ref.txt` crash). Its version check also failed, but only because that wheel was built without templating. - `nox -s test_core` from source: 1095 passed, 106 skipped, 12 xfailed. - pre-commit passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release validation fails in
make test-wheelbecause three Decisions tests readbraintrust/fixtures/test-image.png, which exists in the source checkout but is missing from the installed wheel. Include that fixture in setuptools package data so those tests also pass against the release artifact.Failure: https://github.com/braintrustdata/braintrust-sdk-python/actions/runs/39317702886/job/118305425731
Validation:
mise exec -- make test-wheelon Python 3.14.7: 1,068 passed, 133 skipped, 12 xfailed.mise exec -- pre-commit run --files py/pyproject.toml: passed.