Skip to content

fix(page_package): prefer the package found in the working dir - #152

Open
LukasGold wants to merge 1 commit into
mainfrom
fix/prefer-package-in-workdir
Open

fix(page_package): prefer the package found in the working dir#152
LukasGold wants to merge 1 commit into
mainfrom
fix/prefer-package-in-workdir

Conversation

@LukasGold

Copy link
Copy Markdown
Contributor

Closes #135

Changes

  • New find_first_package_dir, which walks the search paths in order and returns the first match, or None
  • Package info lookup in PagePackageController uses it instead of find_package_dir
  • find_package_dir is untouched, so the script lookup path keeps its current behaviour
  • tests/test_page_package_search.py covers search order, fall-through to a later path, no match, and that find_package_dir still rejects ambiguity

Rationale

The old call passed all search paths to find_package_dir at once. That function collects matches across every path and raises ValueError when there is more than one, so a package present both in the working dir and in an additional_package_dirs entry 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_script branch 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.

- 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
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Release preview

Merging this PR would release v2.0.3 (current: v2.0.2).

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.

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.

Prefere package found in working dir if multiple were found

1 participant