Repository navigation
fix: run the link checkers from outside BeautifulRepo and under python -I - #89
Merged
Merged
Conversation
…n -I - html_navigation.py loaded docs_links with a plain sibling import, which fails under `python -I` because isolated mode drops the script directory from sys.path. It now loads the sibling by path, reusing an already imported copy of the same file. - docs_links.py and html_navigation.py defaulted --root to the parent of tools/, so a run from an installed copy without --root silently checked BeautifulRepo itself and printed OK. They now default to the current directory, like repo_audit.py. Commands run from the repository root behave as before; action.yml already passes --root. - New tests run every checker with -I from a foreign working directory and fail on the previous code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3 of 4 tasks
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.
Reader problem and change
To run BeautifulRepo's checkers from an installed copy (an agent plugin, a vendored checkout) against another repository, two bugs had to be fixed:
python -I tools/html_navigation.pycrashed withModuleNotFoundError: No module named 'docs_links'. Isolated mode drops the script directory fromsys.path, so the plain sibling import failed. The module is now loaded by path fromPath(__file__), and an already imported copy of the same file is reused, so tests that import both modules still share one.docs_links.pyandhtml_navigation.pychecked the wrong repository by default.--rootdefaulted to the parent oftools/, socd other-repo && python /path/to/BeautifulRepo/tools/docs_links.pysilently checked BeautifulRepo and printedOK. Both now default to the current directory, likerepo_audit.py.Commands documented "from the repository root" behave exactly as before, and
action.ymlalready passes--root.catalog.pykeeps its defaults, because it manages BeautifulRepo's own catalog rather than a target repository.Closes #68
Evidence
tests/test_tool_invocation.pyruns every checker withpython -Ifrom a temporary foreign repository, with and without--root. Against the previous tools it fails 3 times (both default-root cases and the-Icase). Against this branch it passes.tools/README.mddocuments the default and showspython -Iusage from another repository. A CHANGELOG entry is underUnreleased.Verification
python -m unittest discover -s tests→Ran 233 tests ... OK (skipped=5)on Windows 11 / Python 3.14.7.docs_links.py,html_navigation.py(also with-I) andrepo_audit.py .all pass on the repository.Limitations
The default change affects only someone who ran the link checkers from a different directory and expected BeautifulRepo to be checked. That case is now an explicit
--root.Part of epic #86, and a prerequisite for #69.
🤖 Generated with Claude Code