Skip to content

fix(packaging): include inference backends in wheels - #940

Merged
NandhaKishorM merged 1 commit into
NandhaKishorM:mainfrom
NikitaaRamesh:fix/include-backends-package
Oct 5, 2026
Merged

NandhaKishorM merged 1 commit into
NandhaKishorM:mainfrom
NikitaaRamesh:fix/include-backends-package

Conversation

@NikitaaRamesh

Copy link
Copy Markdown
Contributor

Summary

  • include laya.backends in setuptools' explicit package list so inference backends ship in wheels and source distributions
  • add a packaging regression that keeps declared packages aligned with every importable laya source package

Problem

Source checkouts and editable installs exposed laya.backends, but built distributions omitted it. As a result, backend selection could fail with ModuleNotFoundError after installing the published wheel.

Verification

  • python tests/test_packaging.py - 138 passed
  • python -m build
  • python -m twine check on the wheel and source distribution
  • inspected both artifacts and confirmed all laya/backends modules are present
  • installed the wheel with --no-deps into an isolated target and imported laya.backends without the source tree on sys.path

@NandhaKishorM
NandhaKishorM merged commit ec34ad9 into NandhaKishorM:main Oct 5, 2026
30 checks passed
@NandhaKishorM

Copy link
Copy Markdown
Owner

Merged, and this turned out to be the most important fix in this batch.

I checked the published artifact rather than taking the report at face value, and it is worse than a backend selection that could fail. On the wheel on PyPI today:

laya 0.3.27 imports OK
laya.backends FAILS: ModuleNotFoundError No module named 'laya.backends'
set_backend FAILS: AttributeError module 'laya' has no attribute 'set_backend'
get_backend FAILS: AttributeError module 'laya' has no attribute 'get_backend'

So the whole backend selection API is absent for anyone who installed with pip, while README.md and docs/compile-and-fast-path.md document it. git tag --contains on the commit that added laya/backends/ says this shipped in 0.3.25, 0.3.26 and 0.3.27, which is three releases of a documented API that only ever worked from a source checkout. Nobody reported it because every contributor here runs editable.

The regression test is the part that earns its place. A hand-maintained packages list will drift again, and a check that every importable laya source package is declared is the only thing that catches the next one at build time instead of at install time. Confirmed on the merged tree:

backends modules: ['laya/backends/__init__.py', 'laya/backends/base.py',
                   'laya/backends/compile.py', 'laya/backends/eager.py',
                   'laya/backends/tilelang.py']

This is going out as 0.3.28.

tests/test_packaging.py passes alongside #948, which also touches that file. All 81 suites pass.

@NandhaKishorM

Copy link
Copy Markdown
Owner

Correcting myself on one point in my comment above, because I named an API that does not exist and I would rather that not sit on the record.

I wrote that set_backend and get_backend are module-level functions on laya and that they are missing. They are not module-level functions in any version: backend selection is Agent(backend=...) and the Agent.set_backend method, and there is no laya.get_backend at all. My check probed laya.set_backend, got an AttributeError, and I read that as the symptom when it was my own wrong call shape.

The defect this PR fixes is real, and here it is measured correctly against the published 0.3.27 wheel in a clean virtualenv:

0.3.27 installed: 0.3.27
Agent built OK
 agent.set_backend("eager") FAILS: ImportError cannot import name 'backends' from 'laya'
 Agent(backend="eager")     FAILS: ModuleNotFoundError No module named 'laya.backends'
 default Agent + predict:   works (noul 0.9484)

So the accurate statement is narrower than what I wrote and still worth the release. The documented backend selection API, which docs/compile-and-fast-path.md describes with agent.set_backend("tilelang", strict=True) and agent.set_backend("compile", warmup=False), is unavailable to everyone who installed with pip, across 0.3.25, 0.3.26 and 0.3.27. The default inference path is unaffected, which is why nobody reported it, alongside the fact that it only ever worked from a source checkout.

Everything else stands. git tag --contains on the commit that added laya/backends/ still gives those three releases, the published wheel still ships zero files under laya/backends/, and the merged tree ships all five. The README note for 0.3.28 has been corrected to say this.

Your regression test is the part I would still highlight, and the correction reinforces it: I got the surface wrong by probing by hand, and a check that enumerates importable source packages and compares them with the declared list does not have that failure mode.

NandhaKishorM added a commit that referenced this pull request Oct 5, 2026
28 pull requests from 12 contributors. The headline fix is #940: laya/backends
was never in setuptools' package list, so the documented backend selection API
has been unavailable to pip installs since 0.3.25.

Co-Authored-By: Claude Opus 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.

2 participants