Skip to content

refactor: move utils/structures.py into support/#186

Merged
tmgbedu merged 1 commit into
devfrom
task/audit-utils-structures-1133
Jul 17, 2026
Merged

refactor: move utils/structures.py into support/#186
tmgbedu merged 1 commit into
devfrom
task/audit-utils-structures-1133

Conversation

@tmgbedu

@tmgbedu tmgbedu commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Audit of fastapi_startkit/src/fastapi_startkit/utils/structures.py (task #1133).

  • Finding: not unused — data() is imported by configuration/Configuration.py, and load() is imported by loader/Loader.py.
  • Action: moved the file to support/structures.py (support/ already exists from the earlier foundation/support consolidation, PR Relocate providers/helpers into foundation and support #162) via git mv, and updated both import sites (..utils.structures -> ..support.structures). No __init__.py re-export was added, matching the existing precedent for support/dataclass.py (imported by its full module path, not re-exported from support/__init__.py).
  • utils/ had no __init__.py and nothing else referenced it, so the directory is gone now that its only file moved.

Test plan

  • Grepped the whole monorepo (fastapi_startkit/, example/*, application/, tests) for utils.structures/utils/structures/utils import structures — no remaining references.
  • uv run pytest --ignore=tests/masoniteorm/postgres — 1867 passed, 7 skipped, 4 subtests
  • uv run ruff check . / uv run ruff format --check . — clean

utils/structures.py was used (Configuration.data(), Loader.load()), so per
the foundation/support consolidation it belongs in support/ alongside the
rest of the framework's internal helpers. The utils/ directory had no
__init__.py and nothing else referenced it, so it's gone entirely now that
its one file has moved. Updated the two import sites accordingly.

@tmgbedu tmgbedu left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Code Reviewer verdict: APPROVE — posting as a comment; gh blocks formal --approve since the reviewing account is also the PR author.]

Verified independently (not just trusting the PR description):

1) History-preserving move + no dangling references

  • git diff shows support/structures.py as a 100% similarity RENAME from utils/structures.py — history preserved correctly.
  • File content is byte-for-byte unchanged (diff confirms 0 additions/0 deletions on the moved file itself).
  • Grepped the entire monorepo for utils.structures / utils/structures / utils import structures / any fastapi_startkit.utils / from ..utils / from .utils pattern — zero hits anywhere.
  • utils/ is untracked by git after the move (git ls-files src/fastapi_startkit/utils/ returns nothing) — a fresh clone won't have the directory at all. (A local worktree showed an empty leftover utils/ folder on disk, but that's just a filesystem artifact of an in-place checkout, not something committed — non-issue.)

2) Consistency with support/ conventions (PR #162)

  • Checked support/__init__.py: it re-exports Collection, collect, Str, Stringable, Uri, Uriable, Provider — but does not re-export anything from dataclass.py (the Dataclass class is imported by its full module path elsewhere). structures.py follows the same pattern (no re-export added). Precedent claim checks out.

3) Both import sites correctly updated + nothing else broken

  • configuration/Configuration.py: from ..support.structures import data — confirmed data() is actually called (self._config = data(), return data(config_at_path)).
  • loader/Loader.py: from ..support.structures import load — confirmed load() is actually called in 3 places.
  • Relative import depth is unaffected: utils/ and support/ are both direct children of fastapi_startkit/, so structures.py's own internal from ..exceptions.exceptions import LoaderNotFound still resolves correctly post-move.

4) CI / test status

  • Reran locally on the PR branch: uv run pytest --ignore=tests/masoniteorm/postgres -q1867 passed, 7 skipped, 4 subtests — matches the PR description exactly.
  • uv run ruff check . → all checks passed. uv run ruff format --check . → clean (490 files already formatted).
  • gh pr checks 186: Ruff and Pyright (non-blocking) both pass (on both workflow runs). The Pytest GitHub Actions job was still pending/queued at review time (not failed) — my local rerun already confirms the suite passes, so this isn't a correctness concern, just CI queue latency worth confirming turns green before merge.

No issues found. Clean, well-scoped refactor. Approving.

@codecov

codecov Bot commented Jul 17, 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 merged commit 62fc8a7 into dev Jul 17, 2026
5 of 6 checks passed
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