Trim public component surface and export build_from_gguf - #333
Merged
Conversation
Tighten the public API ahead of the first release. components.__all__ leaked 37 model-specific classes (vision towers, per-model attention/projector variants, codec/SSM blocks) that are implementation details of individual models, not reusable building blocks. Drop them from the public contract while keeping them importable internally via redundant-alias re-exports (`X as X`), so existing `from mobius.components import ...` call sites in model files are unaffected. components.__all__ shrinks from 112 to 75 names. Also export build_from_gguf at the top level: it was documented as public but never added to mobius.__all__ or re-exported. The gguf third-party import stays lazy, so `import mobius` remains safe without the optional gguf package installed. Config export policy (base-only vs export-all) is intentionally left to the config-redesign track. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <11205048+justinchuby@users.noreply.github.com>
Performance Comparison
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens the project’s public API surface ahead of the initial release by limiting what mobius.components publicly exports and by making build_from_gguf available from the top-level mobius package as documented.
Changes:
- Reduced
mobius.components.__all__to exclude model-specific implementation classes while keeping existing internal import sites working via explicit re-exports. - Added
build_from_gguftomobius.__all__and re-exported it frommobius.__init__.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/mobius/components/__init__.py |
Trims the public components export list while preserving internal accessibility of model-specific helpers via re-exports. |
src/mobius/__init__.py |
Re-exports build_from_gguf at the package root and includes it in __all__. |
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
justinchuby
added a commit
that referenced
this pull request
Jun 5, 2026
Reflect the public-API and DRY changes shipped in PRs #333/#334/#336: - build_from_gguf is now a top-level export; update the import examples in docs/api/build_from_gguf.md and docs/getting-started.md to `from mobius import build_from_gguf`. - weight-name-alignment skill: add a 'Shared helpers' section documenting the _weight_utils rename helpers, including the new rename_weight_keys and vlm_vision_weights, so future model work reuses them instead of hand-written rename loops. - multimodal-models skill: point at the shared vlm_* weight helpers. - moe-models skill: note Qwen35MoEBlock subclasses Qwen2MoELayer and fix the class file paths (models/qwen.py -> models/qwen35.py). Depends on #333 (build_from_gguf export), #334 (rename_weight_keys) and #336 (vlm_vision_weights) landing first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <11205048+justinchuby@users.noreply.github.com>
justinchuby
added a commit
that referenced
this pull request
Jun 5, 2026
Updates outdated docs and agent skills to match the public-API + DRY refactor shipped across the themed PRs. ## Changes - **`build_from_gguf` import** — now a top-level export, so `docs/api/build_from_gguf.md` and `docs/getting-started.md` use `from mobius import build_from_gguf` instead of the internal `mobius.integrations.gguf` path. - **weight-name-alignment skill** — new *Shared helpers* section documenting the `_weight_utils` rename helpers, including the new `rename_weight_keys` and `vlm_vision_weights`, so future model work reuses them instead of hand-written rename loops. - **multimodal-models skill** — points at the shared `vlm_*` weight helpers. - **moe-models skill** — notes `Qwen35MoEBlock` now subclasses `Qwen2MoELayer`, and fixes stale class file paths (`models/qwen.py` → `models/qwen35.py`). ## Dependencies Depends on the API PRs landing first (the helpers/exports documented here only exist on those branches): - #333 — `build_from_gguf` top-level export - #334 — `rename_weight_keys` - #336 — `vlm_vision_weights` Docs-only; no code or tests affected. --------- Signed-off-by: Justin Chu <11205048+justinchuby@users.noreply.github.com> Co-authored-by: Justin Chu <11205048+justinchuby@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
First in a series of PRs tightening the public API ahead of the initial release (no backward-compat concerns; unreleased).
Changes
mobius.components.__all__from 112 → 75 names. 37 model-specific classes (per-model vision towers, attention/projector variants, codec & SSM blocks — e.g.Qwen25VLVisionModel,WhisperAttention,DeepSeekMLA,Mamba2Block) were leaking into the public component contract. They are implementation details of individual models, not reusable building blocks.X as X), so existingfrom mobius.components import ...call sites in model files are untouched. Zero behavior change.build_from_ggufat the top level. It was documented as public but never added tomobius.__all__or re-exported. Theggufthird-party import stays lazy, soimport mobiusremains safe without the optionalggufpackage installed.Out of scope / deferred
models.__all__surface review is a later PR.Verification
ruff check+ruff format --checkclean on changed files.__all__/re-export lines changed).