irregex 0.1.0__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.
irregex-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Billy Company
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
irregex-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: irregex
3
+ Version: 0.1.0
4
+ Summary: Python integration for the irregex search and similarity engine
5
+ Keywords: code-search,regex,similarity,compression
6
+ Author: The Billy Company
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Requires-Python: >=3.10
14
+ Project-URL: Homepage, https://github.com/The-Billy-Company/irregex
15
+ Project-URL: Repository, https://github.com/The-Billy-Company/irregex
16
+ Project-URL: Issues, https://github.com/The-Billy-Company/irregex/issues
17
+ Description-Content-Type: text/markdown
18
+
19
+ # irregex
20
+
21
+ Python integration for the native
22
+ [irregex](https://github.com/The-Billy-Company/billy/tree/main/libs/kernels/irregex)
23
+ search and similarity engine.
24
+
25
+ The package provides a dependency-free subprocess API for invoking an installed
26
+ `irregex` binary and decoding its NDJSON output:
27
+
28
+ ```python
29
+ import irregex
30
+
31
+ matches = irregex.records(
32
+ "context",
33
+ "resident similarity cache",
34
+ "-e",
35
+ "Resident",
36
+ "--all",
37
+ )
38
+ ```
39
+
40
+ Set `IRREGEX_BIN` to an explicit executable path or place the native binary on
41
+ `PATH`. If neither is available, the API raises `ExecutableNotFound` with
42
+ installation guidance.
43
+
44
+ ## Install
45
+
46
+ ```console
47
+ python3 -m pip install irregex
48
+ ```
49
+
50
+ This initial package is the Python bridge; native binary wheels will follow.
51
+
52
+ ## License
53
+
54
+ MIT
@@ -0,0 +1,36 @@
1
+ # irregex
2
+
3
+ Python integration for the native
4
+ [irregex](https://github.com/The-Billy-Company/billy/tree/main/libs/kernels/irregex)
5
+ search and similarity engine.
6
+
7
+ The package provides a dependency-free subprocess API for invoking an installed
8
+ `irregex` binary and decoding its NDJSON output:
9
+
10
+ ```python
11
+ import irregex
12
+
13
+ matches = irregex.records(
14
+ "context",
15
+ "resident similarity cache",
16
+ "-e",
17
+ "Resident",
18
+ "--all",
19
+ )
20
+ ```
21
+
22
+ Set `IRREGEX_BIN` to an explicit executable path or place the native binary on
23
+ `PATH`. If neither is available, the API raises `ExecutableNotFound` with
24
+ installation guidance.
25
+
26
+ ## Install
27
+
28
+ ```console
29
+ python3 -m pip install irregex
30
+ ```
31
+
32
+ This initial package is the Python bridge; native binary wheels will follow.
33
+
34
+ ## License
35
+
36
+ MIT
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.11.16,<0.12"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "irregex"
7
+ version = "0.1.0"
8
+ description = "Python integration for the irregex search and similarity engine"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "The Billy Company" }]
14
+ keywords = ["code-search", "regex", "similarity", "compression"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Topic :: Software Development :: Libraries :: Python Modules",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/The-Billy-Company/irregex"
24
+ Repository = "https://github.com/The-Billy-Company/irregex"
25
+ Issues = "https://github.com/The-Billy-Company/irregex/issues"
26
+
27
+ [tool.uv.build-backend]
28
+ module-name = "irregex"
@@ -0,0 +1,52 @@
1
+ """Python integration for the native irregex engine."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ import shutil
8
+ import subprocess
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+ __all__ = ["ExecutableNotFound", "executable", "records", "run"]
13
+ __version__ = "0.1.0"
14
+
15
+
16
+ class ExecutableNotFound(FileNotFoundError):
17
+ """Raised when the native irregex executable cannot be located."""
18
+
19
+
20
+ def executable() -> str:
21
+ """Return the configured native irregex executable."""
22
+ if configured := os.environ.get("IRREGEX_BIN"):
23
+ path = Path(configured).expanduser()
24
+ if path.is_file() and os.access(path, os.X_OK):
25
+ return str(path)
26
+ raise ExecutableNotFound(f"IRREGEX_BIN is not executable: {path}")
27
+
28
+ if found := shutil.which("irregex"):
29
+ return found
30
+ raise ExecutableNotFound(
31
+ "irregex is not installed; build the native engine or set IRREGEX_BIN"
32
+ )
33
+
34
+
35
+ def run(
36
+ *arguments: str,
37
+ check: bool = True,
38
+ capture_output: bool = True,
39
+ ) -> subprocess.CompletedProcess[str]:
40
+ """Run the native irregex CLI with text-mode I/O."""
41
+ return subprocess.run(
42
+ [executable(), *arguments],
43
+ check=check,
44
+ capture_output=capture_output,
45
+ text=True,
46
+ )
47
+
48
+
49
+ def records(*arguments: str) -> list[dict[str, Any]]:
50
+ """Run an irregex verb in JSON mode and decode its NDJSON records."""
51
+ result = run(*arguments, "--json")
52
+ return [json.loads(line) for line in result.stdout.splitlines() if line]