Skip to content

Re-export ORM relationship classes from masoniteorm package root#137

Merged
bedus-creation merged 2 commits into
mainfrom
feature/export-orm-relationships
Jun 20, 2026
Merged

Re-export ORM relationship classes from masoniteorm package root#137
bedus-creation merged 2 commits into
mainfrom
feature/export-orm-relationships

Conversation

@bedus-creation

Copy link
Copy Markdown
Contributor

Summary

Makes from fastapi_startkit.masoniteorm import BelongsTo, HasMany, BelongsToMany, ... work for all public relationship classes. They previously had to be imported from the .relationships submodule.

Changes

  • masoniteorm/__init__.py: re-export all public relationship classes from .relationships and add them to __all__. Newly added at the root: BaseRelationship, MorphMany, MorphOne, MorphToMany (the others were already exported). Pure re-export — no behavior change.
  • Switched in-repo usages (example database-app models, ORM test fixtures, and a sqlite test) from from fastapi_startkit.masoniteorm.relationships import ... to the root import.
  • Added tests/masoniteorm/test_relationship_reexports.py asserting each class is importable from the root, listed in __all__, and is the same class object as in .relationships.

Verification

  • New test passes.
  • Full suite: uv run pytest --ignore=tests/masoniteorm/postgres --cov1549 passed, 7 skipped, total coverage 67.14% (above the threshold).

The docs site submodule was intentionally left untouched (handled separately).

Re-export the full set of public relationship classes (including
MorphMany, MorphOne, MorphToMany, and BaseRelationship) from
fastapi_startkit.masoniteorm so they can be imported directly from the
package root instead of the .relationships submodule.

Switch in-repo example models, fixtures, and tests to the root import.
Pure re-export — no behavior change.
@bedus-creation bedus-creation merged commit b256966 into main Jun 20, 2026
3 checks passed
@bedus-creation bedus-creation deleted the feature/export-orm-relationships branch June 20, 2026 16:35
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