Skip to content

Keep labextensions source tree out of wheels - #3459

Merged
lresende merged 1 commit into
elyra-ai:mainfrom
lresende:fix-wheel-labextensions
Nov 15, 2026
Merged

lresende merged 1 commit into
elyra-ai:mainfrom
lresende:fix-wheel-labextensions

Conversation

@lresende

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

[tool.hatch.build] include = ["elyra/*", "labextensions/**/*"] put the whole labextensions/ source tree into every wheel. That is on top of the copy that [tool.hatch.build.targets.wheel.shared-data] already installs into share/jupyter/labextensions:

4.2.0 wheel UI in share/jupyter/labextensions unused copy in site-packages/labextensions
elyra 131 files 131 files (an 8.5 MB duplicate) plus 12 stub __init__.py
elyra-server 0 12 stub __init__.py (the 3.x wheels shipped none)
individual extensions their UI 67–86 duplicate files each

The stubs are cookiecutter _jupyter_labextension_paths() modules, and nothing imports them. JupyterLab discovers the extensions through share/jupyter/labextensions/*/package.json. When an individual extension is installed next to elyra-server, conda reports these duplicated stubs as clobbered paths.

This PR excludes the root-level labextensions/ directory from the wheel target, both in pyproject.toml and in the individual-extension template (etc/templates/pyproject.toml):

  • The pattern is anchored (/labextensions). hatchling also applies wheel excludes to shared-data target paths, so an unanchored labextensions would drop share/jupyter/labextensions as well.
  • elyra/tests is repeated in the new exclude list. A target-level exclude replaces the global one.
  • sdists are unchanged. Their UI assets come from the sdist target's artifacts, so anything that builds from the sdist (e.g. conda-forge) keeps working and picks up the fix.

It also adds elyra/tests/test_packaging.py, which builds wheels from the real pyproject.toml and the extension template and checks their layout, and adds hatchling to test_requirements.txt.

How was this pull request tested?

  • New tests: python -m pytest elyra/tests/test_packaging.py. 4 of the 5 cases fail on the current configuration, and all 5 pass with this change. The UI-through-shared-data case caught the unanchored-pattern pitfall described above.
  • Release packaging: I ran the packaging functions from create-release.py on this branch: build_server(), build_release() with a real UI build, and prepare_extensions_release(). Compared with the published 4.2.0 wheels:
    • elyra: 131 UI files and no site-packages/labextensions (was 131 UI files plus a 131-file duplicate plus 12 stubs).
    • elyra-server: no labextension files at all, the same shape as 3.x.
    • Each individual extension: the same set of bundled labextensions and the same UI files as 4.2.0, with no site-packages/labextensions.
    • elyra sdist: an identical file list with and without the change (412 files, including all 131 built assets).
    • A wheel built from that sdist without build isolation, as conda-forge does: UI present, no duplicate.
  • Individual installs: I installed each individual extension on its own next to elyra-server in a clean conda env. In each case jupyter labextension list showed exactly its bundled @elyra extensions as enabled OK, the elyra server extension validated, pip check was clean, and uninstalling left nothing behind. I then installed elyra-server with all five extensions together and checked the UI in JupyterLab.

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.89%. Comparing base (12f0d4e) to head (552bffc).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3459      +/-   ##
==========================================
+ Coverage   84.86%   84.89%   +0.03%     
==========================================
  Files         160      161       +1     
  Lines       19327    19379      +52     
  Branches      502      502              
==========================================
+ Hits        16402    16452      +50     
- Misses       2885     2887       +2     
  Partials       40       40              
Flag Coverage Δ
integration-editors 48.14% <ø> (-0.07%) ⬇️
integration-misc 25.64% <ø> (ø)
integration-pipeline 47.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
elyra/tests/test_packaging.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lresende
lresende force-pushed the fix-wheel-labextensions branch from b19439b to 019c174 Compare November 15, 2026 01:09
@lresende lresende added this to the 4.3.0 milestone Nov 15, 2026
The [tool.hatch.build] include of "labextensions/**/*" put the whole
labextensions/ source tree into every wheel, in addition to the copy
installed through the shared-data mappings:

- elyra wheels shipped each built UI asset twice: once under
  share/jupyter/labextensions, which JupyterLab loads, and again under
  site-packages/labextensions (about 8.5 MB unused in 4.2.0).
- elyra-server wheels, built before the UI exists, were no longer
  server-only: they installed the twelve labextensions/*/__init__.py
  stub modules into site-packages.
- The individual extension wheels, rendered from the package template,
  carried the same duplicate copy and stubs, which clobber
  elyra-server's stubs when both are installed.

Exclude the root-level labextensions/ directory from the wheel target
in pyproject.toml and in the extension template. The pattern is
anchored with a leading "/" because hatchling also applies wheel
excludes to shared-data target paths, so an unanchored pattern would
drop share/jupyter/labextensions as well. The sdist is unchanged: its
UI assets come from the sdist target's artifacts, so builds from the
sdist (such as conda-forge) keep working and pick up the fix.

Add tests that build wheels from the real pyproject.toml and template
and check the layout, and add hatchling to the test requirements.

Signed-off-by: Luciano Resende <lresende@apple.com>
@lresende
lresende force-pushed the fix-wheel-labextensions branch from 019c174 to 552bffc Compare November 15, 2026 15:34
@lresende
lresende merged commit 94ed013 into elyra-ai:main Nov 15, 2026
19 checks passed
@lresende
lresende deleted the fix-wheel-labextensions branch November 15, 2026 15:49
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