codetool-explore 0.7.0__tar.gz → 0.7.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/PKG-INFO +1 -1
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/pyproject.toml +1 -1
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/api.py +2 -1
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/matcher.py +4 -3
- codetool_explore-0.7.1/src/codetool_explore/regex.py +14 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_api.py +33 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/uv.lock +1 -1
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/.gitignore +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/LICENSE +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/README.md +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/benchmarks/benchmark_output_lengths.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/benchmarks/benchmark_search.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/hatch_build.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/Cargo.lock +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/Cargo.toml +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/app.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/case.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/config.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/constants.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/file_search.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/ignore_rules.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/literal.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/main.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/matcher.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/models.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/output.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/path_utils.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/ranking.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/regex_search.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/search.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/text.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/rust/src/walker.rs +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/scripts/package_rust_binary.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/scripts/update_readme_benchmarks.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/__init__.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/cli.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/compression.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/cursor.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/errors.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/explorer.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/ignore.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/py.typed +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/__init__.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/case.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/config.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/constants.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/file_search.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/ignore_rules.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/literal.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/models.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/output.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/regex_search.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/search.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/text.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/walker.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/ranking.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/roots.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/rust_backend.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/text_output.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test___init__.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_cli.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_cursor.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_hatch_build.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_ignore.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_packaged_binary.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_python_backend.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_ranking.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_rust_backend.py +0 -0
- {codetool_explore-0.7.0 → codetool_explore-0.7.1}/tests/test_rust_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codetool-explore
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Fast, dependency-free workspace search, read, and list exploration for coding-agent tools with Rust backend
|
|
5
5
|
Project-URL: Homepage, https://github.com/pbi-agent/codetool-explore
|
|
6
6
|
Project-URL: Repository, https://github.com/pbi-agent/codetool-explore
|
|
@@ -10,6 +10,7 @@ from .compression import compress_result
|
|
|
10
10
|
from .errors import ExploreArgumentError, ExploreBackendError, ExplorePatternError
|
|
11
11
|
from .explorer import list_path_target, read_file_target
|
|
12
12
|
from .python_backend import resolve_case, search_python
|
|
13
|
+
from .regex import compile_regex
|
|
13
14
|
from .roots import RootInput
|
|
14
15
|
from .rust_backend import RustBackendUnavailable, find_rust_binary, search_rust
|
|
15
16
|
from .text_output import format_text_result
|
|
@@ -68,7 +69,7 @@ def _regex_can_produce_empty_match(pattern: str, *, case: str) -> bool:
|
|
|
68
69
|
_, case_sensitive = resolve_case(requested_case, pattern)
|
|
69
70
|
flags = 0 if case_sensitive else re.IGNORECASE
|
|
70
71
|
try:
|
|
71
|
-
compiled =
|
|
72
|
+
compiled = compile_regex(pattern, flags)
|
|
72
73
|
except re.error as exc:
|
|
73
74
|
raise ExplorePatternError(f"invalid regex: {exc}") from exc
|
|
74
75
|
return any(
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/matcher.py
RENAMED
|
@@ -6,6 +6,7 @@ import re
|
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from typing import TypeAlias
|
|
8
8
|
|
|
9
|
+
from ..regex import compile_regex
|
|
9
10
|
from .literal import LiteralMatcher
|
|
10
11
|
from .regex_search import RegexLineMatcher
|
|
11
12
|
|
|
@@ -22,7 +23,7 @@ def build_content_matcher(
|
|
|
22
23
|
|
|
23
24
|
if regex:
|
|
24
25
|
flags = 0 if case_sensitive else re.IGNORECASE
|
|
25
|
-
return RegexLineMatcher(
|
|
26
|
+
return RegexLineMatcher(compile_regex(pattern, flags))
|
|
26
27
|
needle = pattern.encode("utf-8", errors="surrogatepass")
|
|
27
28
|
return LiteralMatcher(needle=needle, case_sensitive=case_sensitive)
|
|
28
29
|
|
|
@@ -49,7 +50,7 @@ class PathMatcher:
|
|
|
49
50
|
compiled = None
|
|
50
51
|
if regex:
|
|
51
52
|
flags = 0 if case_sensitive else re.IGNORECASE
|
|
52
|
-
compiled =
|
|
53
|
+
compiled = compile_regex(pattern, flags)
|
|
53
54
|
return cls(
|
|
54
55
|
pattern=pattern,
|
|
55
56
|
regex=regex,
|
|
@@ -76,4 +77,4 @@ def path_match_subject(rel_path: str, path_scope: str) -> str:
|
|
|
76
77
|
|
|
77
78
|
if path_scope == "basename":
|
|
78
79
|
return rel_path.rsplit("/", 1)[-1]
|
|
79
|
-
return rel_path
|
|
80
|
+
return rel_path
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Shared regex helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
import warnings
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def compile_regex(pattern: str, flags: int = 0) -> re.Pattern[str]:
|
|
10
|
+
"""Compile a user regex without leaking Python's advisory future warnings."""
|
|
11
|
+
|
|
12
|
+
with warnings.catch_warnings():
|
|
13
|
+
warnings.simplefilter("ignore", FutureWarning)
|
|
14
|
+
return re.compile(pattern, flags)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import warnings
|
|
4
5
|
|
|
5
6
|
import pytest
|
|
6
7
|
|
|
@@ -823,6 +824,38 @@ def test_auto_regex_empty_match_uses_python_for_counts(monkeypatch, tmp_path):
|
|
|
823
824
|
assert result["matches"] == [{"path": "a.py", "count": 4, "first_line": 1}]
|
|
824
825
|
|
|
825
826
|
|
|
827
|
+
def test_nested_set_regex_warning_is_suppressed_in_auto(monkeypatch, tmp_path):
|
|
828
|
+
write(tmp_path / "a.py", "[abc]\n")
|
|
829
|
+
monkeypatch.setattr(api, "find_rust_binary", lambda: "/fake/rust")
|
|
830
|
+
|
|
831
|
+
def fake_rust(pattern, **kwargs):
|
|
832
|
+
return {
|
|
833
|
+
"pattern": pattern,
|
|
834
|
+
"backend": "rust",
|
|
835
|
+
"root": kwargs["root"],
|
|
836
|
+
"regex": True,
|
|
837
|
+
"mode": kwargs["mode"],
|
|
838
|
+
"matches": [],
|
|
839
|
+
"returned": 0,
|
|
840
|
+
"total_files": 1,
|
|
841
|
+
"total_matches": 0,
|
|
842
|
+
"count": 0,
|
|
843
|
+
"truncated": False,
|
|
844
|
+
"next_cursor": None,
|
|
845
|
+
"offset": 0,
|
|
846
|
+
"limit": kwargs["limit"],
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
monkeypatch.setattr(api, "search_rust", fake_rust)
|
|
850
|
+
|
|
851
|
+
with warnings.catch_warnings(record=True) as caught:
|
|
852
|
+
warnings.simplefilter("always")
|
|
853
|
+
api.explore("[[abc]]", root=str(tmp_path), result_format="full")
|
|
854
|
+
api.explore("[[abc]]", root=str(tmp_path), backend="python")
|
|
855
|
+
|
|
856
|
+
assert not [item for item in caught if item.category is FutureWarning]
|
|
857
|
+
|
|
858
|
+
|
|
826
859
|
def test_auto_regex_falls_back_to_python_when_rust_rejects_syntax(
|
|
827
860
|
monkeypatch, tmp_path
|
|
828
861
|
):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/__init__.py
RENAMED
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/case.py
RENAMED
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/config.py
RENAMED
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/constants.py
RENAMED
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/file_search.py
RENAMED
|
File without changes
|
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/literal.py
RENAMED
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/models.py
RENAMED
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/output.py
RENAMED
|
File without changes
|
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/search.py
RENAMED
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/text.py
RENAMED
|
File without changes
|
{codetool_explore-0.7.0 → codetool_explore-0.7.1}/src/codetool_explore/python_backend/walker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|