fix(page_package): prefer the package found in the working dir - #152
Open
LukasGold wants to merge 1 commit into
Open
fix(page_package): prefer the package found in the working dir#152LukasGold wants to merge 1 commit into
LukasGold wants to merge 1 commit into
Conversation
- add find_first_package_dir, which returns the first search path match - use it for package info lookup instead of searching all paths at once - a package present in working dir and an additional dir no longer raises - closes #135
Contributor
Release previewMerging this PR would release v2.0.3 (current: Changelog preview (truncated)## v2.0.3 (2026-09-01)
### Bug Fixes
- **page_package**: Prefer the package found in the working dir
([`6e58d9e`](https://github.com/OpenSemanticLab/osw-python/commit/6e58d9ea1fe9067326571356ef8de736c7938ab2))
### Testing
- Rename oold.py to oold_test.py so its tests are collected
([`20072a9`](https://github.com/OpenSemanticLab/osw-python/commit/20072a9249cd97126a222c62a70f84e0433343ef))
Preview via python-semantic-release and conventional commits. |
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.
Closes #135
Changes
find_first_package_dir, which walks the search paths in order and returns the first match, orNonePagePackageControlleruses it instead offind_package_dirfind_package_diris untouched, so the script lookup path keeps its current behaviourtests/test_page_package_search.pycovers search order, fall-through to a later path, no match, and thatfind_package_dirstill rejects ambiguityRationale
The old call passed all search paths to
find_package_dirat once. That function collects matches across every path and raisesValueErrorwhen there is more than one, so a package present both in the working dir and in anadditional_package_dirsentry failed instead of resolving to the local one.Follows the approach proposed in the issue. A path holding several matches on its own is still ambiguous, so it is skipped with a warning rather than guessed at.
Note
The
read_listed_pages_from_scriptbranch a few lines above has the same all-at-once shape and the same latent problem. Left alone, since the issue is about package dirs.