Skip to content

fix(packaging): include image fixture in wheel - #977

Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit into
mainfrom
abhi/investigate-ci-failure-3953b521
Oct 19, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 1 commit into
mainfrom
abhi/investigate-ci-failure-3953b521

Conversation

@AbhiPrasad

Copy link
Copy Markdown
Member

Release validation fails in make test-wheel because three Decisions tests read braintrust/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:

  • Reproduced all three failures against the wheel before the change; the same tests passed from source.
  • Confirmed the rebuilt wheel contains the exact fixture and all three affected tests pass.
  • Full mise exec -- make test-wheel on Python 3.14.7: 1,068 passed, 133 skipped, 12 xfailed.
  • mise exec -- pre-commit run --files py/pyproject.toml: passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T21:41:02.109670Z 7194734 PR opened
ℹ️ About Codex in GitHub

Your 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.

@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit 531e148 into main Oct 19, 2026
96 checks passed
@AbhiPrasad
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>
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.

1 participant