netra-core 0.1.0__py3-none-any.whl
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.
netra_core/main.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Root CLI entry point and dynamic plugin router for the NetraBase ecosystem.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import importlib.metadata
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
|
|
11
|
+
app = typer.Typer(
|
|
12
|
+
name="netra",
|
|
13
|
+
help="The NetraBase Data Reliability CLI.",
|
|
14
|
+
no_args_is_help=True,
|
|
15
|
+
add_completion=False,
|
|
16
|
+
)
|
|
17
|
+
console = Console()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _version_callback(value: bool) -> None:
|
|
21
|
+
"""Prints the version of netra-core and all installed Netra plugins."""
|
|
22
|
+
|
|
23
|
+
if not value:
|
|
24
|
+
return
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
core_version = importlib.metadata.version("netra-core")
|
|
28
|
+
except importlib.metadata.PackageNotFoundError:
|
|
29
|
+
core_version = "unknown"
|
|
30
|
+
|
|
31
|
+
console.print(f"[bold cyan]netra-core[/bold cyan] : v{core_version}")
|
|
32
|
+
|
|
33
|
+
entry_points = sorted(
|
|
34
|
+
importlib.metadata.entry_points(group="netra.subcommands"),
|
|
35
|
+
key=lambda ep: ep.name,
|
|
36
|
+
)
|
|
37
|
+
for ep in entry_points:
|
|
38
|
+
dist_name = ep.dist.name if ep.dist else ep.name
|
|
39
|
+
dist_version = ep.dist.version if ep.dist else "unknown"
|
|
40
|
+
console.print(f"[bold white]{dist_name:<16}[/bold white]: v{dist_version} ({ep.name})")
|
|
41
|
+
|
|
42
|
+
raise typer.Exit(0)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@app.callback()
|
|
46
|
+
def main(
|
|
47
|
+
version: Annotated[
|
|
48
|
+
bool | None,
|
|
49
|
+
typer.Option(
|
|
50
|
+
"--version",
|
|
51
|
+
"-V",
|
|
52
|
+
"-v",
|
|
53
|
+
callback=_version_callback,
|
|
54
|
+
is_eager=True,
|
|
55
|
+
help="Show installed Netra package versions and exit.",
|
|
56
|
+
),
|
|
57
|
+
] = None,
|
|
58
|
+
) -> None:
|
|
59
|
+
"""Root callback for the Netra CLI."""
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def discover_plugins() -> None:
|
|
63
|
+
"""Scans the Python environment for registered Netra subcommands."""
|
|
64
|
+
|
|
65
|
+
entry_points = sorted(
|
|
66
|
+
importlib.metadata.entry_points(group="netra.subcommands"),
|
|
67
|
+
key=lambda ep: ep.name,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
for entry_point in entry_points:
|
|
71
|
+
try:
|
|
72
|
+
register_function = entry_point.load()
|
|
73
|
+
sub_app = register_function()
|
|
74
|
+
app.add_typer(sub_app, name=entry_point.name)
|
|
75
|
+
except Exception as e: # noqa: BLE001
|
|
76
|
+
console.print(f"[red]Failed to load plugin '{entry_point.name}': {e}[/red]")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
discover_plugins()
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
app()
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: netra-core
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Core CLI router and plugin registry for the NetraBase data reliability ecosystem.
|
|
5
|
+
Project-URL: Homepage, https://github.com/netrabase/netra-core
|
|
6
|
+
Project-URL: Repository, https://github.com/netrabase/netra-core
|
|
7
|
+
Project-URL: Issues, https://github.com/netrabase/netra-core/issues
|
|
8
|
+
Author-email: Nitin Paul <nitinpaul.dev@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cli,data-contracts,data-quality,netra,odcs
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Database
|
|
23
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: rich>=14.3.1
|
|
27
|
+
Requires-Dist: typer>=0.24.0
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# Netra Core
|
|
31
|
+
|
|
32
|
+
[](https://pypi.org/project/netra-core/)
|
|
33
|
+
|
|
34
|
+
**`netra-core`** is the lightweight CLI router and plugin registry for the **NetraBase** data reliability ecosystem.
|
|
35
|
+
|
|
36
|
+
It provides the unified `netra` command-line entry point and dynamically discovers installed Netra packages via Python `importlib.metadata` entry points (`netra.subcommands`).
|
|
37
|
+
|
|
38
|
+
## Ecosystem Packages
|
|
39
|
+
|
|
40
|
+
| Package | CLI Subcommands | Description |
|
|
41
|
+
| :--- | :--- | :--- |
|
|
42
|
+
| **[`netra-profiler`](https://github.com/netrabase/netra-profiler)** | `netra profile`<br>`netra contract`<br>`netra diff` | High-performance statistical data profiler, ODCS v3.1.0 contract generator, and schema drift detector. |
|
|
43
|
+
| **[`netra-validator`](https://github.com/netrabase/netra-validator)** | `netra validate` | High-performance data validator built with Polars and DuckDB. |
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
Install the Netra tools you need (which automatically pulls in `netra-core`):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uv pip install netra-profiler netra-validator
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or with standard `pip`:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install netra-profiler netra-validator
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
Once installed, `netra` automatically routes subcommands to all installed Netra packages in your environment:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# View available subcommands
|
|
65
|
+
netra --help
|
|
66
|
+
|
|
67
|
+
# Check installed versions of netra-core and all registered plugins
|
|
68
|
+
netra --version
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Example output of `netra --version`:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
netra-core : v0.1.0
|
|
75
|
+
netra-profiler : v0.5.0 (contract)
|
|
76
|
+
netra-profiler : v0.5.0 (diff)
|
|
77
|
+
netra-profiler : v0.5.0 (profile)
|
|
78
|
+
netra-validator : v0.1.0 (validate)
|
|
79
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
netra_core/main.py,sha256=A07HW9oFNLnscHh3WG-CdyTKS-6bc7Fda_Y2UwpyQag,2155
|
|
2
|
+
netra_core-0.1.0.dist-info/METADATA,sha256=rUjqsGLTwZPXEpAYaQggK9KTS3V8XJFQCmSWA9CnsYA,2811
|
|
3
|
+
netra_core-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
netra_core-0.1.0.dist-info/entry_points.txt,sha256=-BJWW3DzaR7BSA7EqrwuBTQR7zw-uI0iqhTv-_Bw_3Q,46
|
|
5
|
+
netra_core-0.1.0.dist-info/licenses/LICENSE,sha256=w5KOhiLMpKyXd_TNATwBCt3esKt2QyjdZ56Jr7WdZUw,1067
|
|
6
|
+
netra_core-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nitin Paul
|
|
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.
|