Repository navigation
refactor(scripts): find the repo root by pyproject.toml instead of .git - #170
Merged
Merged
Conversation
`scripts._utils.find_repo_root` walked up to the nearest `.git`, so it failed in source trees without git metadata, such as an unpacked archive. It now walks up to the nearest `pyproject.toml`, requires an explicit start path, and accepts a `marker` override. - Move the remaining `coreai_opt._utils.repo_utils` callers to the helper (tests, `ci/nox/utils.py`) or, where the repo is not importable yet, to an inline stdlib walk (`ci/nox/noxfile.py`). - Replace fixed `parents[N]` depths in the devtools tests with the helper. - Anchor `docs/scripts/generate_api_index.py` on the working directory, which is the repo whose index it writes. - Add `pythonpath = ["."]` to the pytest config so tests outside the `tests` package can import `scripts.*`. - Add tests for `find_repo_root`.
guru-desh
reviewed
Oct 28, 2026
guru-desh
approved these changes
Oct 28, 2026
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.
scripts._utils.find_repo_rootwalked up to the nearest.git, so tooling that calls it failed in a source tree without git metadata, such as an unpacked archive. It now walks up to the nearestpyproject.toml, requires the caller to pass a start path, and accepts amarkeroverride.The remaining callers of
coreai_opt._utils.repo_utils.find_repo_rootmove to the same rule, so nothing inci/,docs/, ortests/uses it anymore; a follow-up removes it.