Skip to content

Include tests and examples in sub-package source distributions#1618

Merged
skrawcz merged 4 commits into
mainfrom
stefan/add-tests-examples-to-sdist
Jun 7, 2026
Merged

Include tests and examples in sub-package source distributions#1618
skrawcz merged 4 commits into
mainfrom
stefan/add-tests-examples-to-sdist

Conversation

@skrawcz
Copy link
Copy Markdown
Contributor

@skrawcz skrawcz commented Jun 1, 2026

Problem

Vote feedback on RC0: tests and examples were excluded from the source tarballs. Per Apache release policy, voters need to be able to build from source and run tests to validate.

Changes

Tests included in sdist (all 4 packages):

  • ui/sdk: removed tests/** from exclude, added to include
  • dev_tools/language_server: same
  • contrib: removed tests/** from exclude
  • ui/backend: already included (no change)

Examples included via symlinks (SDK + Contrib):

  • ui/sdk/examples../../examples/hamilton_ui/
  • contrib/examples../examples/contrib/

Binary files excluded from sdist:

  • *.parquet, *.pkl, *.ipynb, *.png excluded to keep tarballs source-only

Verification

Built all 4 sdists and confirmed:

  • Tests present in all 4 source tarballs
  • Examples present in SDK and Contrib tarballs (source files only, no binaries)
  • All included files have Apache license headers

Context

Addresses feedback from Jernej Frank's -1 votes on SDK, LSP, and Contrib RC0:

In the main package we add tests to the source tarball and sdist, but here they are omitted.

@skrawcz skrawcz force-pushed the stefan/add-tests-examples-to-sdist branch from 2df93a8 to 78e4829 Compare June 1, 2026 06:04
Copy link
Copy Markdown
Collaborator

@Dev-iL Dev-iL left a comment

Choose a reason for hiding this comment

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

The PR change is verified:

  • tests are present in all 4 sdists.
  • The contrib package has 4 test files co-located inside the package (not a top-level tests/ dir), which is correct given how that package is structured.

Copy link
Copy Markdown
Contributor

@jernejfrank jernejfrank left a comment

Choose a reason for hiding this comment

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

Great, there's this one script that seems like we need to include in the source in the contrib package. Otherwise, rest looks all good!

Comment thread contrib/pyproject.toml
@skrawcz skrawcz force-pushed the stefan/add-tests-examples-to-sdist branch from b026cda to 792a69a Compare June 6, 2026 22:07
@skrawcz skrawcz force-pushed the stefan/add-tests-examples-to-sdist branch from 792a69a to 3bcf4a9 Compare June 6, 2026 22:35
skrawcz added 4 commits June 6, 2026 15:46
Per Apache release policy, tests should be included in the sdist so
voters can build from source and run tests to validate.

- ui/sdk: removed tests/** from exclude, added to include
- dev_tools/language_server: same
- contrib: removed tests/** from exclude (tests live inside the package)
- ui/backend: already includes tests/** (no change needed)
- Add prerequisite check for gpg, java, flit, uv, svn at script start
  (fails early with clear error instead of cryptic flit-not-found)
- Fix contrib verify: cd to /tmp before running python imports to avoid
  CWD shadowing installed hamilton package with local repo directory
Add test_sdist.py for ui/sdk, dev_tools/language_server, and contrib
that assert pyproject.toml [tool.flit.sdist] configuration:
- tests/** is in include (sdk, lsp) or not in exclude (contrib)
- examples/** is in include (sdk, contrib)
- scripts/** is in include (contrib) — addresses reviewer feedback
- Binary files (*.parquet, *.pkl, *.ipynb, *.png) are excluded

Also add test_flit_sdist_includes_tests to ui/backend/tests/test_build.py
to match the existing pattern for build/** verification.

Include contrib/scripts/** in sdist per reviewer request — contains
version_check.py used for release validation.
The UI sdist was including hamilton_ui/build/** (compiled JS/CSS from
npm build), which would require bundling third-party licenses.

Fix: build sdist first (without frontend), then npm build, then wheel.
- pyproject.toml: move hamilton_ui/build/** from include to exclude
- apache_release_helper.py: split UI build into 3 steps:
  1. flit build --format sdist (source-only)
  2. npm install + npm run build → copy to hamilton_ui/build/
  3. flit build --format wheel (includes frontend assets)
- test_build.py: update assertion to verify build/ is excluded from sdist
@skrawcz skrawcz force-pushed the stefan/add-tests-examples-to-sdist branch from 3bcf4a9 to a60e654 Compare June 6, 2026 22:47
@skrawcz skrawcz merged commit 92133ad into main Jun 7, 2026
14 checks passed
@skrawcz skrawcz deleted the stefan/add-tests-examples-to-sdist branch June 7, 2026 04:39
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.

4 participants