Skip to content

Relocate providers/helpers into foundation and support#162

Merged
tmgbedu merged 2 commits into
mainfrom
refactor/providers-foundation-support
Jul 10, 2026
Merged

Relocate providers/helpers into foundation and support#162
tmgbedu merged 2 commits into
mainfrom
refactor/providers-foundation-support

Conversation

@tmgbedu

@tmgbedu tmgbedu commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Relocates the framework's provider base and shared helpers out of the top-level providers/ and helpers/ packages into foundation/ and support/, and fixes every import across the framework and tests.

Moves

From To
providers/app_provider.py foundation/app_provider.py
providers/Provider.py support/providers/provider.py
providers/__init__.py support/providers/__init__.py
helpers/dataclass.py support/dataclass.py
helpers/app.py removed

support/__init__.py now re-exports Provider.

Import fixes

  • application.py: providers.app_providerfoundation.app_provider
  • configuration/Configuration.py: helpers.dataclasssupport.dataclass
  • support/providers/provider.py: helpers.dataclasssupport.dataclass (also dropped unused dataclasses/Any imports and corrected the now-invalid relative ..application type-check import to an absolute one)
  • masoniteorm/providers/DatabaseProvider.py: providers.Providersupport
  • from fastapi_startkit.providers import Providerfrom fastapi_startkit.support import Provider across mcp, vite, inertia, ai, fastapi, skills and logging providers plus the corresponding tests
  • Relative call sites from ...providers import Provider / from ..providers import Provider in configuration/providers/ConfigurationProvider.py, storage/providers/provider.py and broadcasting/provider.py

The broadcasting.helpers.app module is a separate module and is intentionally left untouched.

Verification

  • import fastapi_startkit smoke import: OK
  • pytest --ignore=tests/masoniteorm/postgres: 1777 passed, 7 skipped
  • Coverage: 75.84% (threshold 68%)
  • ruff check .: all checks passed
  • ruff format --check .: clean
  • grep sweep clean: no remaining fastapi_startkit.providers, providers.Provider, providers.app_provider, helpers.dataclass, or helpers.app references (only broadcasting.helpers.app remains, as intended)

⚠️ BREAKING CHANGE — clean break, no compat shim

The top-level fastapi_startkit.providers package is removed with no backward-compatibility shim (confirmed maintainer decision). Consumers must update imports:

Old import New import
from fastapi_startkit.providers import Provider from fastapi_startkit.support import Provider
from fastapi_startkit.providers.app_provider import ... from fastapi_startkit.foundation.app_provider import ...
from fastapi_startkit.helpers.dataclass import ... from fastapi_startkit.support.dataclass import ...

fastapi_startkit.helpers.app is removed.

Framework version bumped 0.47.0 → 0.48.0 (0.x package → breaking change bumps the minor). Documented in fastapi_startkit/CHANGELOG.md.

Downstream fix (follow-up to the sweep)

The original sweep missed the example/ workspace members, which broke their test suites with ModuleNotFoundError: No module named 'fastapi_startkit.providers'. Updated the two remaining consumers:

  • example/console-app/providers/console.py
  • example/database-app/providers/console_provider.py

Full-repo grep (application/, example/, src, tests) is clean — no remaining fastapi_startkit.providers / providers.Provider / providers.app_provider / helpers.dataclass / helpers.app references (only broadcasting.helpers.app remains, as intended). example/database-app tests/features/students + tests/features/teachers now pass (5 passed).

Move the framework's provider base and app provider out of the top-level
providers/ package and the shared helpers into support/:

- providers/app_provider.py    -> foundation/app_provider.py
- providers/Provider.py        -> support/providers/provider.py
- providers/__init__.py        -> support/providers/__init__.py
- helpers/dataclass.py         -> support/dataclass.py
- remove helpers/app.py
- support/__init__.py now re-exports Provider

Update every import across the framework and tests to the new
locations, including relative-import call sites in configuration,
storage and broadcasting providers.
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tmgbedu

tmgbedu commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Code Review — REQUEST CHANGES ❌

The framework-package refactor itself (src + tests) is clean, but the PR ships a breaking change with a red CI because downstream consumers were not updated and no backward-compat shim was added.

Blockers

  1. CI Pytest is RED — 5 errors. The database-app workspace job fails at collection with ModuleNotFoundError: No module named 'fastapi_startkit.providers' (job 86442886019). The "1777 passed" report only covered the fastapi_startkit/ package tests, not the workspace example apps that CI also runs.

  2. Grep is NOT clean repo-wide. Two downstream files still import the deleted package (verified against the PR branch):

    • example/console-app/providers/console.py:2from fastapi_startkit.providers import Provider
    • example/database-app/providers/console_provider.py:1from fastapi_startkit.providers import Provider
      These break because the PR deletes fastapi_startkit/providers/__init__.py and providers/Provider.py with no re-export. (application/ starter is clean.)
  3. Breaking change for downstream users — needs a decision. fastapi_startkit.providers and fastapi_startkit.providers.Provider were public import paths. Removing them with no shim breaks any downstream app using the documented from fastapi_startkit.providers import Provider pattern. Recommendation: either

    • (a) keep a thin fastapi_startkit/providers/__init__.py that re-exports Provider from fastapi_startkit.support and emits a DeprecationWarning (non-breaking, preferred), or
    • (b) update ALL downstream consumers in this same PR (the two example apps above + any docs referencing the old path) so CI goes green.

Verified good

  • src + tests: grep-clean, all 25 sites updated correctly.
  • helpers/app.py (storage_path/public_path standalone helpers): confirmed unused across src/tests/example/application → safe to delete.
  • Moved provider.py: imports and TYPE_CHECKING Application hint correct; no circular import (support/__init__ binds Str before importing Provider, and provider.py only needs Str).
  • Ruff green; framework coverage 75.84% (≥ 68%).

Action: pick shim (a) or downstream-update (b), get CI green, then re-request review. Do not merge until Pytest passes.

Point the console providers in example/console-app and example/database-app
at the new fastapi_startkit.support.Provider location so the example test
suites stop failing with ModuleNotFoundError.

Since the old fastapi_startkit.providers path is removed with no compat
shim, bump the framework minor version (0.47.0 -> 0.48.0) and document
the breaking import changes in a new CHANGELOG.
@tmgbedu

tmgbedu commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Code Review — APPROVE ✅ (re-review @ d2b29f0)

All previously-flagged blockers are resolved. Re-verified against the PR branch:

  1. CI green. gh pr checks 162: Pytest pass (3m4s, incl. workspace example apps — the jobs that were red before), Ruff pass (×2), codecov/patch pass.
  2. Repo-wide grep clean. My own sweep for fastapi_startkit.providers, helpers.dataclass, helpers.app, helpers/app across all *.py returns zero old-path imports. The 2 example apps now import Provider from fastapi_startkit.support.
  3. Version + docs accurate. fastapi-startkit bumped 0.47.0 → 0.48.0; CHANGELOG.md has a correct Breaking changes section documenting the removed fastapi_startkit.providers package, the foundation/support moves, and the removal of fastapi_startkit.helpers.app — matches the actual diff exactly. Clean break, no shim (maintainer decision, intentional).

Also confirmed earlier and still holds: helpers/app.py was genuinely unused (safe delete); moved provider.py imports/TYPE_CHECKING hint correct with no circular import; framework coverage well above the 68% floor.

LGTM. Approving. (Not merging — leave the merge to the maintainer.)

@tmgbedu tmgbedu merged commit 1480494 into main Jul 10, 2026
4 checks passed
@tmgbedu tmgbedu deleted the refactor/providers-foundation-support branch July 10, 2026 21:36
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