Skip to content

Commit c0304eb

Browse files
committed
Merge origin/main into feat/mcp-server
- conflict in src/osw/wiki_tools.py: both sides appended after prefix_search, kept both additions - branch side: content_search - main side: _ask_results_as_dict, CONDITION_PATTERN, LIMIT_PARAM_PATTERN, get_query_limit
2 parents a3f5eec + a867b65 commit c0304eb

19 files changed

Lines changed: 2342 additions & 170 deletions

‎CHANGELOG.md‎

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,110 @@
1010
1111
<!-- version list -->
1212

13+
## v2.3.1 (2026-09-03)
14+
15+
### Bug Fixes
16+
17+
- **search**: Keep a limit the caller wrote into the ask query
18+
([`0c75699`](https://github.com/OpenSemanticLab/osw-python/commit/0c756993bcf9a9114c3072ee03037757aaa5fcf5))
19+
20+
- **search**: Treat a SearchParam limit of None as no limit
21+
([`6e94187`](https://github.com/OpenSemanticLab/osw-python/commit/6e94187c455942afdec2746a498c44c6fd5953e0))
22+
23+
24+
## v2.3.0 (2026-09-03)
25+
26+
### Features
27+
28+
- **wtsite**: Parametrize and parallelize modify_search_results
29+
([`d2e2952`](https://github.com/OpenSemanticLab/osw-python/commit/d2e29522033d5f0e8658c318b0fd909406e0f49d))
30+
31+
32+
## v2.2.1 (2026-09-03)
33+
34+
### Bug Fixes
35+
36+
- **core**: Honour per-property settings in the overwrite policy
37+
([`2ed0a1f`](https://github.com/OpenSemanticLab/osw-python/commit/2ed0a1fa027c7b4981a4c5955cbfe9e8d61b9976))
38+
39+
40+
## v2.2.0 (2026-09-02)
41+
42+
### Features
43+
44+
- **wtsite**: Allow an edit comment on upload_page
45+
([`0d3899c`](https://github.com/OpenSemanticLab/osw-python/commit/0d3899c782998c5750338dc11beea569207cb26c))
46+
47+
48+
## v2.1.5 (2026-09-02)
49+
50+
### Bug Fixes
51+
52+
- Handle empty SMW ask results in semantic_search
53+
([`e00ca8b`](https://github.com/OpenSemanticLab/osw-python/commit/e00ca8be80eb1575a520b609d5d988604ad59e24))
54+
55+
56+
## v2.1.4 (2026-09-02)
57+
58+
### Bug Fixes
59+
60+
- **page_package**: Apply the same search order to package scripts
61+
([`751a0e3`](https://github.com/OpenSemanticLab/osw-python/commit/751a0e3df80000e639349401b29a6ed311fb5f69))
62+
63+
- **page_package**: Prefer the package found in the working dir
64+
([`6e58d9e`](https://github.com/OpenSemanticLab/osw-python/commit/6e58d9ea1fe9067326571356ef8de736c7938ab2))
65+
66+
67+
## v2.1.3 (2026-09-02)
68+
69+
### Bug Fixes
70+
71+
- **wtsite**: Repair the dangling combine_into reference
72+
([`707be40`](https://github.com/OpenSemanticLab/osw-python/commit/707be4030e9221e8180de0198e4282b4d0cb4fcc))
73+
74+
75+
## v2.1.2 (2026-09-02)
76+
77+
### Bug Fixes
78+
79+
- **util**: Honour flush_at_end and progress_bar in parallelize
80+
([`2794c9b`](https://github.com/OpenSemanticLab/osw-python/commit/2794c9b0869963886c692947732ca910291e1b4f))
81+
82+
### Testing
83+
84+
- Cover osw.utils.util.parallelize
85+
([`fb73aaf`](https://github.com/OpenSemanticLab/osw-python/commit/fb73aafe410fa6c71f6b8f306061b2f02fd965df))
86+
87+
88+
## v2.1.1 (2026-09-02)
89+
90+
### Bug Fixes
91+
92+
- **core**: Write a stub for a $ref whose page does not exist
93+
([`6c672dc`](https://github.com/OpenSemanticLab/osw-python/commit/6c672dc4c1e44cb559b817597fcd34f54df10768))
94+
95+
96+
## v2.1.0 (2026-09-02)
97+
98+
### Features
99+
100+
- **express**: Let a download keep the original file name
101+
([`d8c30c9`](https://github.com/OpenSemanticLab/osw-python/commit/d8c30c99414977c7a8ed6fb0f72118c0b7d3d595))
102+
103+
104+
## v2.0.3 (2026-09-02)
105+
106+
### Bug Fixes
107+
108+
- Allow uploading a file from an in-memory stream
109+
([`64d99d6`](https://github.com/OpenSemanticLab/osw-python/commit/64d99d66ea45bc56bdaa6d12f2502df0bbbaf88c))
110+
111+
### Testing
112+
113+
- Rename oold.py to oold_test.py so its tests are collected
114+
([`20072a9`](https://github.com/OpenSemanticLab/osw-python/commit/20072a9249cd97126a222c62a70f84e0433343ef))
115+
116+
13117
## v2.0.2 (2026-08-28)
14118

15119
### Bug Fixes

‎CITATION.cff‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ message: "If you use this software, please cite it as below."
33
type: software
44
title: "OpenSemanticWorld Python Package (osw-python)"
55
# Managed by python-semantic-release (version_variables). Do not edit by hand.
6-
version: 2.0.2
6+
version: 2.3.1
77
abstract: "Python toolset for data processing, queries, wikicode generation and page manipulation within OpenSemanticLab: work with OpenSemanticLab instances as typed pydantic entities, query with semantic search, generate models from wiki schemas, and write changes back."
88
repository-code: "https://github.com/OpenSemanticLab/osw-python"
99
url: "https://opensemanticlab.github.io/osw-python/"

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license-files = ["LICENSE.txt"]
88
requires-python = ">=3.10,<3.14"
99
# Managed by python-semantic-release (see [tool.semantic_release]). Do not
1010
# edit by hand; it is bumped automatically on merge to main.
11-
version = "2.0.2"
11+
version = "2.3.1"
1212
classifiers = [
1313
"Development Status :: 3 - Alpha",
1414
"Intended Audience :: Developers",

‎src/osw/controller/page_package.py‎

Lines changed: 73 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,32 @@ def find_package_dir(
248248
return matching_dirs[0]
249249

250250

251+
def find_first_package_dir(
252+
package_or_script_name: str, search_paths: List[Path] = None
253+
) -> Optional[Path]:
254+
"""searches the search_paths in order and returns the first match
255+
256+
Unlike find_package_dir, which searches all paths at once and rejects a
257+
name that exists in more than one of them, this prefers the earlier path.
258+
Returns None if no search path holds the name. A path holding more than one
259+
match is ambiguous on its own, so it is skipped with a warning.
260+
"""
261+
if search_paths is None:
262+
search_paths = []
263+
for search_path in search_paths:
264+
try:
265+
return find_package_dir(package_or_script_name, [search_path])
266+
except FileNotFoundError:
267+
# expected: not every search path holds every package
268+
continue
269+
except ValueError as e:
270+
warn(
271+
f"Multiple elements {package_or_script_name} found in "
272+
f"{search_path}: {e}"
273+
)
274+
return None
275+
276+
251277
def get_listed_pages_from_package_info(package_info: Union[dict, Path]) -> List[str]:
252278
"""Takes in the output of read_package_info_file and returns a list of
253279
pages listed in the package"""
@@ -663,35 +689,58 @@ def recursive(
663689
if params.read_listed_pages_from_script:
664690
search_paths = [params.script_dir]
665691
search_paths.extend(params.additional_script_dirs)
666-
try:
667-
script_path = find_package_dir(
668-
f"{package_to_process}.py", search_paths
669-
)
670-
package_script = read_package_script_file(script_path)
671-
new_listed_pages = get_listed_pages_from_package_script(
672-
package_script
673-
)
674-
required_packages = get_required_packages_from_package_script(
675-
package_script
692+
# Prefer the script in script_dir over the additional dirs,
693+
# instead of failing on a script present in several.
694+
script_path = find_first_package_dir(
695+
f"{package_to_process}.py", search_paths
696+
)
697+
new_listed_pages = []
698+
required_packages = []
699+
if script_path is None:
700+
warn(
701+
f"Package script for {package_to_process} not found in any "
702+
f"of the search paths: {search_paths}"
676703
)
677-
except Exception as e:
678-
warn(f"Error reading package script for {package_to_process}: {e}")
679-
new_listed_pages = []
680-
required_packages = []
704+
else:
705+
try:
706+
package_script = read_package_script_file(script_path)
707+
new_listed_pages = get_listed_pages_from_package_script(
708+
package_script
709+
)
710+
required_packages = get_required_packages_from_package_script(
711+
package_script
712+
)
713+
except Exception as e:
714+
warn(
715+
f"Error reading package script for "
716+
f"{package_to_process}: {e}"
717+
)
681718
else:
682719
search_paths = [params.creation_config.working_dir.parent]
683720
search_paths.extend(params.additional_package_dirs)
684-
try:
685-
package_dir = find_package_dir(package_to_process, search_paths)
686-
package_info = read_package_info_file(package_dir)
687-
new_listed_pages = get_listed_pages_from_package_info(package_info)
688-
required_packages = get_required_packages_from_package_info_file(
689-
package_info
721+
# Prefer the package in the working dir over the additional
722+
# dirs, instead of failing on a package present in several.
723+
package_dir = find_first_package_dir(package_to_process, search_paths)
724+
new_listed_pages = []
725+
required_packages = []
726+
if package_dir is None:
727+
warn(
728+
f"Package info for {package_to_process} not found in any "
729+
f"of the search paths: {search_paths}"
690730
)
691-
except Exception as e:
692-
warn(f"Error reading package info for {package_to_process}: {e}")
693-
new_listed_pages = []
694-
required_packages = []
731+
else:
732+
try:
733+
package_info = read_package_info_file(package_dir)
734+
new_listed_pages = get_listed_pages_from_package_info(
735+
package_info
736+
)
737+
required_packages = (
738+
get_required_packages_from_package_info_file(package_info)
739+
)
740+
except Exception as e:
741+
warn(
742+
f"Error reading package info for {package_to_process}: {e}"
743+
)
695744
# Check for redundant pages
696745
for pack_ in listed_pages.keys():
697746
new_redundant_pages = list(

0 commit comments

Comments
 (0)