featuresmith-cli 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.
- featuresmith_cli/__init__.py +3 -0
- featuresmith_cli/commands/__init__.py +1 -0
- featuresmith_cli/commands/analyze.py +151 -0
- featuresmith_cli/json_output.py +32 -0
- featuresmith_cli/main.py +36 -0
- featuresmith_cli/output.py +50 -0
- featuresmith_cli/py.typed +1 -0
- featuresmith_cli/rich_output.py +163 -0
- featuresmith_cli/utils.py +50 -0
- featuresmith_cli-0.1.0.dist-info/METADATA +55 -0
- featuresmith_cli-0.1.0.dist-info/RECORD +15 -0
- featuresmith_cli-0.1.0.dist-info/WHEEL +5 -0
- featuresmith_cli-0.1.0.dist-info/entry_points.txt +2 -0
- featuresmith_cli-0.1.0.dist-info/licenses/LICENSE +187 -0
- featuresmith_cli-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Subcommands for the Featuresmith CLI."""
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"""Command handler for featuresmith analyze."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import traceback
|
|
7
|
+
from typing import Annotated, Literal
|
|
8
|
+
|
|
9
|
+
import typer
|
|
10
|
+
|
|
11
|
+
import featuresmith.api as fs
|
|
12
|
+
from featuresmith.api import ConnectorError, SourceNotFoundError, SourceParseError
|
|
13
|
+
from featuresmith_cli.output import handle_output
|
|
14
|
+
from featuresmith_cli.utils import SEVERITY_LEVELS, get_version_info
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def version_callback(value: bool) -> None:
|
|
18
|
+
"""Print the version string and exit if the flag is set.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
value: Boolean flag value.
|
|
22
|
+
"""
|
|
23
|
+
if value:
|
|
24
|
+
typer.echo(get_version_info())
|
|
25
|
+
raise typer.Exit()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def analyze_command(
|
|
29
|
+
source: Annotated[
|
|
30
|
+
str,
|
|
31
|
+
typer.Argument(
|
|
32
|
+
help="Path to the local tabular dataset (CSV, Excel, or Parquet)."
|
|
33
|
+
),
|
|
34
|
+
],
|
|
35
|
+
target: Annotated[
|
|
36
|
+
str | None,
|
|
37
|
+
typer.Option(
|
|
38
|
+
"--target",
|
|
39
|
+
help="Name of the target column in the dataset for leakage evaluation.",
|
|
40
|
+
),
|
|
41
|
+
] = None,
|
|
42
|
+
format: Annotated[
|
|
43
|
+
Literal["table", "json"],
|
|
44
|
+
typer.Option("--format", help="Output format to display."),
|
|
45
|
+
] = "table",
|
|
46
|
+
output: Annotated[
|
|
47
|
+
str | None,
|
|
48
|
+
typer.Option(
|
|
49
|
+
"--output",
|
|
50
|
+
help="Path to save the output report (JSON or txt depending on format).",
|
|
51
|
+
),
|
|
52
|
+
] = None,
|
|
53
|
+
severity: Annotated[
|
|
54
|
+
Literal["info", "warning", "critical"],
|
|
55
|
+
typer.Option(
|
|
56
|
+
"--severity",
|
|
57
|
+
help="Severity threshold for displayed findings and exit-code gating.",
|
|
58
|
+
),
|
|
59
|
+
] = "critical",
|
|
60
|
+
max_correlation_columns: Annotated[
|
|
61
|
+
int,
|
|
62
|
+
typer.Option(
|
|
63
|
+
"--max-correlation-columns",
|
|
64
|
+
help="Combinatorial cutoff limit for correlation profiling.",
|
|
65
|
+
),
|
|
66
|
+
] = 100,
|
|
67
|
+
quiet: Annotated[
|
|
68
|
+
bool,
|
|
69
|
+
typer.Option("--quiet", help="Suppress all standard console report output."),
|
|
70
|
+
] = False,
|
|
71
|
+
verbose: Annotated[
|
|
72
|
+
bool,
|
|
73
|
+
typer.Option(
|
|
74
|
+
"--verbose",
|
|
75
|
+
help="Show full Python tracebacks on error instead of generic messages.",
|
|
76
|
+
),
|
|
77
|
+
] = False,
|
|
78
|
+
version: Annotated[
|
|
79
|
+
bool | None,
|
|
80
|
+
typer.Option(
|
|
81
|
+
"--version",
|
|
82
|
+
callback=version_callback,
|
|
83
|
+
is_eager=True,
|
|
84
|
+
help="Show version info and exit.",
|
|
85
|
+
),
|
|
86
|
+
] = None,
|
|
87
|
+
) -> None:
|
|
88
|
+
"""Analyze a local tabular dataset and evaluate quality rules."""
|
|
89
|
+
try:
|
|
90
|
+
# 1. Load the dataset (performs file suffix and existence check)
|
|
91
|
+
try:
|
|
92
|
+
dataset = fs.load(source)
|
|
93
|
+
except ConnectorError as error:
|
|
94
|
+
err_msg = str(error)
|
|
95
|
+
if isinstance(error, (SourceNotFoundError, SourceParseError)):
|
|
96
|
+
if not quiet:
|
|
97
|
+
sys.stderr.write(f"Error: {err_msg}\n")
|
|
98
|
+
raise typer.Exit(code=3) from error
|
|
99
|
+
else:
|
|
100
|
+
if not quiet:
|
|
101
|
+
sys.stderr.write(f"Error: {err_msg}\n")
|
|
102
|
+
raise typer.Exit(code=2) from error
|
|
103
|
+
|
|
104
|
+
# 2. Validate target column presence in schema if specified
|
|
105
|
+
if target is not None:
|
|
106
|
+
if target not in dataset.schema.names:
|
|
107
|
+
if not quiet:
|
|
108
|
+
available = ", ".join(dataset.schema.names)
|
|
109
|
+
sys.stderr.write(
|
|
110
|
+
f"Error: Target column '{target}' not found in dataset.\n"
|
|
111
|
+
)
|
|
112
|
+
sys.stderr.write(f"Available columns: {available}\n")
|
|
113
|
+
raise typer.Exit(code=2)
|
|
114
|
+
|
|
115
|
+
# 3. Call core analyze SDK
|
|
116
|
+
result = fs.analyze(
|
|
117
|
+
dataset,
|
|
118
|
+
target_column=target,
|
|
119
|
+
max_correlation_columns=max_correlation_columns,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# 4. Process and dispatch output formatting
|
|
123
|
+
handle_output(
|
|
124
|
+
result=result,
|
|
125
|
+
format_type=format.lower(),
|
|
126
|
+
severity_threshold=severity.lower(),
|
|
127
|
+
output_path=output,
|
|
128
|
+
quiet=quiet,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# 5. Evaluate exit codes based on severity threshold filter
|
|
132
|
+
threshold_rank = SEVERITY_LEVELS.get(severity.lower(), 1)
|
|
133
|
+
has_matched_findings = any(
|
|
134
|
+
SEVERITY_LEVELS.get(finding.severity.lower(), 1) >= threshold_rank
|
|
135
|
+
for finding in result.findings
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
if has_matched_findings:
|
|
139
|
+
raise typer.Exit(code=1)
|
|
140
|
+
else:
|
|
141
|
+
raise typer.Exit(code=0)
|
|
142
|
+
|
|
143
|
+
except typer.Exit:
|
|
144
|
+
# Re-raise Typer Exit exceptions to let Click handle exits
|
|
145
|
+
raise
|
|
146
|
+
except Exception as error:
|
|
147
|
+
if verbose:
|
|
148
|
+
traceback.print_exc()
|
|
149
|
+
else:
|
|
150
|
+
sys.stderr.write(f"Unexpected internal error: {error}\n")
|
|
151
|
+
raise typer.Exit(code=4) from error
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""JSON formatting for Featuresmith CLI results."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
from featuresmith.api import RuleResult
|
|
8
|
+
from featuresmith_cli.utils import SEVERITY_LEVELS
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def format_json(result: RuleResult, severity_threshold: str) -> str:
|
|
12
|
+
"""Serialize the RuleResult to JSON, filtering findings by severity threshold.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
result: The canonical RuleResult from the SDK.
|
|
16
|
+
severity_threshold: The severity level threshold to filter findings by.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
str: A JSON-serialized string of the result.
|
|
20
|
+
"""
|
|
21
|
+
result_dict = result.to_dict()
|
|
22
|
+
threshold_rank = SEVERITY_LEVELS.get(severity_threshold, 1)
|
|
23
|
+
|
|
24
|
+
# Filter findings inside the dictionary representation
|
|
25
|
+
filtered_findings = [
|
|
26
|
+
finding
|
|
27
|
+
for finding in result_dict.get("findings", [])
|
|
28
|
+
if SEVERITY_LEVELS.get(finding.get("severity"), 1) >= threshold_rank
|
|
29
|
+
]
|
|
30
|
+
result_dict["findings"] = filtered_findings
|
|
31
|
+
|
|
32
|
+
return json.dumps(result_dict, indent=2)
|
featuresmith_cli/main.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Main entry point for the Featuresmith CLI."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from featuresmith_cli.commands.analyze import analyze_command, version_callback
|
|
8
|
+
|
|
9
|
+
# Create the Typer CLI application
|
|
10
|
+
app = typer.Typer(
|
|
11
|
+
name="featuresmith",
|
|
12
|
+
help="Featuresmith CLI: Reusable data profiling and rules engine.",
|
|
13
|
+
no_args_is_help=True,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
# Register analyze command
|
|
17
|
+
app.command(name="analyze")(analyze_command)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Add a top-level version callback on the CLI itself (e.g. featuresmith --version)
|
|
21
|
+
@app.callback() # type: ignore[untyped-decorator]
|
|
22
|
+
def main(
|
|
23
|
+
version: bool = typer.Option(
|
|
24
|
+
None,
|
|
25
|
+
"--version",
|
|
26
|
+
callback=version_callback,
|
|
27
|
+
is_eager=True,
|
|
28
|
+
help="Show version info and exit.",
|
|
29
|
+
),
|
|
30
|
+
) -> None:
|
|
31
|
+
"""Featuresmith command line interface."""
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
app()
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Output routing and dispatch for Featuresmith CLI results."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import io
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
|
|
11
|
+
from featuresmith.api import RuleResult
|
|
12
|
+
from featuresmith_cli.json_output import format_json
|
|
13
|
+
from featuresmith_cli.rich_output import render_rich_report
|
|
14
|
+
from featuresmith_cli.utils import strip_ansi
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def handle_output(
|
|
18
|
+
result: RuleResult,
|
|
19
|
+
format_type: str,
|
|
20
|
+
severity_threshold: str,
|
|
21
|
+
output_path: str | None,
|
|
22
|
+
quiet: bool,
|
|
23
|
+
) -> None:
|
|
24
|
+
"""Route analysis results to stdout and/or output files.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
result: The canonical RuleResult.
|
|
28
|
+
format_type: The format type ('table' or 'json').
|
|
29
|
+
severity_threshold: Findings severity threshold level.
|
|
30
|
+
output_path: Optional path to save the output file to.
|
|
31
|
+
quiet: Suppress stdout printing.
|
|
32
|
+
"""
|
|
33
|
+
if format_type == "json":
|
|
34
|
+
json_str = format_json(result, severity_threshold)
|
|
35
|
+
if not quiet:
|
|
36
|
+
sys.stdout.write(json_str + "\n")
|
|
37
|
+
if output_path:
|
|
38
|
+
Path(output_path).write_text(json_str, encoding="utf-8")
|
|
39
|
+
else: # table format
|
|
40
|
+
# Use a StringIO buffer to capture output if quiet mode is enabled
|
|
41
|
+
buffer = io.StringIO() if quiet else None
|
|
42
|
+
console = Console(record=True, file=buffer, width=200)
|
|
43
|
+
|
|
44
|
+
render_rich_report(result, severity_threshold, console)
|
|
45
|
+
|
|
46
|
+
if output_path:
|
|
47
|
+
# Capture the table output, strip colors, and save to file
|
|
48
|
+
styled_text = console.export_text(clear=False)
|
|
49
|
+
plain_text = strip_ansi(styled_text)
|
|
50
|
+
Path(output_path).write_text(plain_text, encoding="utf-8")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Marker file for PEP 561.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""Rich terminal formatting for Featuresmith CLI results."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
from rich.panel import Panel
|
|
9
|
+
from rich.table import Table
|
|
10
|
+
|
|
11
|
+
from featuresmith.api import RuleResult
|
|
12
|
+
from featuresmith_cli.utils import SEVERITY_LEVELS
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def format_size(bytes_val: int | None) -> str:
|
|
16
|
+
"""Format file size in human-readable bytes units.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
bytes_val: The size in bytes.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
str: Format string such as '12.4 KB'.
|
|
23
|
+
"""
|
|
24
|
+
if bytes_val is None:
|
|
25
|
+
return "Unknown"
|
|
26
|
+
if bytes_val == 0:
|
|
27
|
+
return "0 Bytes"
|
|
28
|
+
units = ["Bytes", "KB", "MB", "GB"]
|
|
29
|
+
i = int(math.floor(math.log(bytes_val, 1024)))
|
|
30
|
+
p = math.pow(1024, i)
|
|
31
|
+
s = round(bytes_val / p, 2)
|
|
32
|
+
return f"{s} {units[i]}"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def render_rich_report(
|
|
36
|
+
result: RuleResult, severity_threshold: str, console: Console
|
|
37
|
+
) -> None:
|
|
38
|
+
"""Print a styled terminal report for the analysis result.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
result: The canonical RuleResult from the SDK.
|
|
42
|
+
severity_threshold: The severity level threshold to filter findings by.
|
|
43
|
+
console: The rich Console to write to.
|
|
44
|
+
"""
|
|
45
|
+
summary = result.profile.dataset_summary
|
|
46
|
+
metadata = result.profile.dataset_metadata
|
|
47
|
+
exec_meta = result.profile.execution_metadata
|
|
48
|
+
|
|
49
|
+
# 1. Title Panel
|
|
50
|
+
console.print(
|
|
51
|
+
Panel(
|
|
52
|
+
"[bold white]Featuresmith Dataset Analysis Report[/]",
|
|
53
|
+
expand=False,
|
|
54
|
+
style="bold blue",
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# 2. Dataset Summary Table
|
|
59
|
+
summary_table = Table(
|
|
60
|
+
title="[bold]Dataset Overview[/]", title_justify="left", show_header=False
|
|
61
|
+
)
|
|
62
|
+
summary_table.add_column("Metric", style="dim")
|
|
63
|
+
summary_table.add_column("Value")
|
|
64
|
+
|
|
65
|
+
source_path = metadata.source or "In-memory Dataframe"
|
|
66
|
+
summary_table.add_row("Source", source_path)
|
|
67
|
+
summary_table.add_row("Backend", metadata.backend)
|
|
68
|
+
summary_table.add_row("Rows", f"{summary.row_count:,}")
|
|
69
|
+
summary_table.add_row("Columns", f"{summary.column_count:,}")
|
|
70
|
+
summary_table.add_row("Size", format_size(metadata.file_size))
|
|
71
|
+
summary_table.add_row("Missing Cells", f"{summary.missing_percentage:.2f}%")
|
|
72
|
+
summary_table.add_row("Duplicate Rows", f"{summary.duplicate_percentage:.2f}%")
|
|
73
|
+
|
|
74
|
+
col_types = (
|
|
75
|
+
f"Numeric: {summary.num_numeric_columns} | "
|
|
76
|
+
f"Categorical: {summary.num_categorical_columns} | "
|
|
77
|
+
f"Datetime: {summary.num_datetime_columns} | "
|
|
78
|
+
f"Text: {summary.num_text_columns}"
|
|
79
|
+
)
|
|
80
|
+
summary_table.add_row("Column Types", col_types)
|
|
81
|
+
|
|
82
|
+
console.print(summary_table)
|
|
83
|
+
console.print()
|
|
84
|
+
|
|
85
|
+
# 3. Findings Table
|
|
86
|
+
findings_table = Table(
|
|
87
|
+
title="[bold]Analysis Findings & Issues[/]", title_justify="left"
|
|
88
|
+
)
|
|
89
|
+
findings_table.add_column("Severity")
|
|
90
|
+
findings_table.add_column("Column")
|
|
91
|
+
findings_table.add_column("Finding", overflow="fold", min_width=24)
|
|
92
|
+
findings_table.add_column("Description")
|
|
93
|
+
findings_table.add_column("Evidence")
|
|
94
|
+
|
|
95
|
+
threshold_rank = SEVERITY_LEVELS.get(severity_threshold, 1)
|
|
96
|
+
findings_displayed = 0
|
|
97
|
+
|
|
98
|
+
# Sort findings by severity level descending
|
|
99
|
+
sorted_findings = sorted(
|
|
100
|
+
result.findings,
|
|
101
|
+
key=lambda f: SEVERITY_LEVELS.get(f.severity, 1),
|
|
102
|
+
reverse=True,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
for finding in sorted_findings:
|
|
106
|
+
finding_rank = SEVERITY_LEVELS.get(finding.severity, 1)
|
|
107
|
+
if finding_rank < threshold_rank:
|
|
108
|
+
continue
|
|
109
|
+
|
|
110
|
+
findings_displayed += 1
|
|
111
|
+
|
|
112
|
+
# Severity Column Styling
|
|
113
|
+
severity_styles = {
|
|
114
|
+
"critical": "[bold red]CRITICAL[/]",
|
|
115
|
+
"warning": "[bold yellow]WARNING[/]",
|
|
116
|
+
"info": "[bold blue]INFO[/]",
|
|
117
|
+
}
|
|
118
|
+
sev_str = severity_styles.get(
|
|
119
|
+
finding.severity, f"[bold blue]{finding.severity.upper()}[/]"
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
col_name = finding.column_name if finding.column_name else "[dim]Dataset[/]"
|
|
123
|
+
|
|
124
|
+
# Format evidence dict
|
|
125
|
+
evidence_strs = []
|
|
126
|
+
for k, v in finding.evidence.items():
|
|
127
|
+
if isinstance(v, float):
|
|
128
|
+
evidence_strs.append(f"{k}: {v:.4f}")
|
|
129
|
+
else:
|
|
130
|
+
evidence_strs.append(f"{k}: {v}")
|
|
131
|
+
evidence_text = ", ".join(evidence_strs)
|
|
132
|
+
|
|
133
|
+
finding_cell = f"{finding.title}\n[dim]{finding.rule_id}[/]"
|
|
134
|
+
findings_table.add_row(
|
|
135
|
+
sev_str, col_name, finding_cell, finding.description, evidence_text
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
if findings_displayed > 0:
|
|
139
|
+
console.print(findings_table)
|
|
140
|
+
else:
|
|
141
|
+
console.print(
|
|
142
|
+
f"[dim]No quality findings discovered at or above the '{severity_threshold}' severity threshold.[/]"
|
|
143
|
+
)
|
|
144
|
+
console.print()
|
|
145
|
+
|
|
146
|
+
# 4. Execution statistics & Failed Rules
|
|
147
|
+
exec_table = Table(
|
|
148
|
+
title="[bold]Execution Summary[/]", title_justify="left", show_header=False
|
|
149
|
+
)
|
|
150
|
+
exec_table.add_column("Key", style="dim")
|
|
151
|
+
exec_table.add_column("Value")
|
|
152
|
+
exec_table.add_row("Rules Executed", f"{len(result.executed_rules)}")
|
|
153
|
+
exec_table.add_row("Run Time", f"{result.execution_time_ms:.2f} ms")
|
|
154
|
+
exec_table.add_row("Start Time (UTC)", exec_meta.start_time)
|
|
155
|
+
console.print(exec_table)
|
|
156
|
+
|
|
157
|
+
if result.failed_rules:
|
|
158
|
+
console.print()
|
|
159
|
+
console.print("[bold yellow]Warnings (Failed Rules):[/]")
|
|
160
|
+
for rule_id, error_trace in result.failed_rules.items():
|
|
161
|
+
console.print(
|
|
162
|
+
f" - [bold yellow]{rule_id}[/]: {error_trace.splitlines()[-1]}"
|
|
163
|
+
)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Utility constants and helpers for the Featuresmith CLI."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
# Mapping of severity levels to integer ranks for comparison and filtering
|
|
8
|
+
SEVERITY_LEVELS = {
|
|
9
|
+
"info": 1,
|
|
10
|
+
"warning": 2,
|
|
11
|
+
"critical": 3,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
# Regex to match ANSI escape sequences (used to strip styling for file exports)
|
|
15
|
+
ANSI_ESCAPE = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def strip_ansi(text: str) -> str:
|
|
19
|
+
"""Remove ANSI escape sequences from a styled terminal string.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
text: The string containing terminal color/formatting codes.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
str: The raw text without escape codes.
|
|
26
|
+
"""
|
|
27
|
+
return ANSI_ESCAPE.sub("", text)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def get_version_info() -> str:
|
|
31
|
+
"""Resolve and return version information for the CLI and core package.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
str: A formatted version string.
|
|
35
|
+
"""
|
|
36
|
+
from featuresmith_cli import __version__ as cli_version
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
from importlib.metadata import version
|
|
40
|
+
|
|
41
|
+
core_version = version("featuresmith-core")
|
|
42
|
+
except Exception:
|
|
43
|
+
try:
|
|
44
|
+
import featuresmith
|
|
45
|
+
|
|
46
|
+
core_version = featuresmith.__version__
|
|
47
|
+
except Exception:
|
|
48
|
+
core_version = "unknown"
|
|
49
|
+
|
|
50
|
+
return f"Featuresmith CLI v{cli_version} (core v{core_version})"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: featuresmith-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Command-line interface for the Featuresmith data quality engine.
|
|
5
|
+
Author: Featuresmith contributors
|
|
6
|
+
Maintainer: Featuresmith contributors
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/adityagangwani30/FeatureSmith
|
|
9
|
+
Project-URL: Documentation, https://featuresmith.adityagangwani.me
|
|
10
|
+
Project-URL: Repository, https://github.com/adityagangwani30/FeatureSmith
|
|
11
|
+
Project-URL: Issues, https://github.com/adityagangwani30/FeatureSmith/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/adityagangwani30/FeatureSmith/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: cli,data-quality,feature-engineering,profiling
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: featuresmith-core>=0.1.0
|
|
29
|
+
Requires-Dist: typer~=0.12
|
|
30
|
+
Requires-Dist: rich>=13.7
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# featuresmith-cli
|
|
34
|
+
|
|
35
|
+
`featuresmith-cli` is the thin command-line interface for Featuresmith.
|
|
36
|
+
|
|
37
|
+
It exposes the `featuresmith` console command and delegates analysis work to
|
|
38
|
+
`featuresmith-core`.
|
|
39
|
+
|
|
40
|
+
Install featuresmith-core and featuresmith-cli directly from PyPI:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install featuresmith-core featuresmith-cli
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Run an analysis:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
featuresmith analyze customers.csv
|
|
50
|
+
featuresmith analyze customers.csv --target churn --format json
|
|
51
|
+
featuresmith --version
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For comprehensive guides and API reference, visit the official website:
|
|
55
|
+
<https://featuresmith.adityagangwani.me>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
featuresmith_cli/__init__.py,sha256=p219YzBFHBu2qTAkFyNyq0lrjnOVoyuaE8KBa6irtjU,55
|
|
2
|
+
featuresmith_cli/json_output.py,sha256=_54Z5JnXzKSKU1wsg7jXX_Cta_ynPSGWaBl3oiePX1k,1001
|
|
3
|
+
featuresmith_cli/main.py,sha256=qiEZlxSKx3DoKTZvK2VWN5CCE9Fxvq8F3F8gqMi9kPI,863
|
|
4
|
+
featuresmith_cli/output.py,sha256=wO51Q_0v7QNLMUVJRUjCoj6qX2jxW9YYrXxvcln9i30,1685
|
|
5
|
+
featuresmith_cli/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
|
|
6
|
+
featuresmith_cli/rich_output.py,sha256=wPOO0rMi5Fnz2P41zBN7k_PyBlqFVNjQQga4nIMNGAA,5418
|
|
7
|
+
featuresmith_cli/utils.py,sha256=RUz5y26AMOBLDyebsW0kEkO-rnqUG-VWJQmngKtkags,1292
|
|
8
|
+
featuresmith_cli/commands/__init__.py,sha256=XKsygA1akRuW-tSSqFkYu14XcS0hFVjXmzfPkVt3lAs,44
|
|
9
|
+
featuresmith_cli/commands/analyze.py,sha256=_-l3b2GyyEhQ6VTvKxWcYCD5mpaJuzX-gPu8JieStWs,4734
|
|
10
|
+
featuresmith_cli-0.1.0.dist-info/licenses/LICENSE,sha256=2V-SV_he4Wbt1eOFT_xNw6GpJOToqbH9L_8OJSSHUO0,10491
|
|
11
|
+
featuresmith_cli-0.1.0.dist-info/METADATA,sha256=wnf8flpGWS3J3hzWk5JJ3VxfoW54w6DQn0smABLGLcI,1994
|
|
12
|
+
featuresmith_cli-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
13
|
+
featuresmith_cli-0.1.0.dist-info/entry_points.txt,sha256=xAxrWho6aibPVU2cmCLv_KcYfbfA___x_iw1Y1GX6Bo,59
|
|
14
|
+
featuresmith_cli-0.1.0.dist-info/top_level.txt,sha256=2R7_CNYSt4dgjeyYH7nShJxme5oMpu659YZONn_MB-o,17
|
|
15
|
+
featuresmith_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as defined by Sections 2(b), any work of
|
|
48
|
+
authorship, including the original version of the Work and any
|
|
49
|
+
modifications or additions to that Work or Derivative Works of the Work,
|
|
50
|
+
that is intentionally submitted to the Licensor for inclusion in the Work
|
|
51
|
+
by the copyright owner or by an individual or Legal Entity authorized to
|
|
52
|
+
submit on behalf of the copyright owner. For the purposes of this
|
|
53
|
+
definition, "submitted" means any form of electronic, verbal, or written
|
|
54
|
+
communication sent to the Licensor or its representatives, including but
|
|
55
|
+
not limited to communication on electronic mailing lists, source code
|
|
56
|
+
control systems, and issue tracking systems that are managed by, or on
|
|
57
|
+
behalf of, the Licensor for the purpose of discussing and improving the
|
|
58
|
+
Work, but excluding communication that is conspicuously marked or
|
|
59
|
+
otherwise designated in writing by the copyright owner as "Not a
|
|
60
|
+
Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
63
|
+
whom a Contribution has been received by the Licensor and subsequently
|
|
64
|
+
incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, You must include a readable copy of the
|
|
108
|
+
attribution notices contained within such NOTICE file, in
|
|
109
|
+
at least one of the following places: within a NOTICE text
|
|
110
|
+
file distributed as part of the Derivative Works; within
|
|
111
|
+
the Source form or documentation, if provided along with the
|
|
112
|
+
Derivative Works; or, within a display generated by the
|
|
113
|
+
Derivative Works, if and wherever such third-party notices
|
|
114
|
+
normally appear. The contents of the NOTICE file are for
|
|
115
|
+
informational purposes only and do not modify the License.
|
|
116
|
+
You may add Your own attribution notices within Derivative
|
|
117
|
+
Works that You distribute, alongside or as an addendum to
|
|
118
|
+
the NOTICE text from the Work, provided that such additional
|
|
119
|
+
attribution notices cannot be construed as modifying the
|
|
120
|
+
License.
|
|
121
|
+
|
|
122
|
+
You may add Your own license statement for Your modifications and
|
|
123
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
124
|
+
publish, distribute, sublicense, and/or sell copies of the
|
|
125
|
+
Contribution, either on its own or as part of the Work.
|
|
126
|
+
|
|
127
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
128
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
129
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
130
|
+
this License, without any additional terms or conditions.
|
|
131
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
132
|
+
the terms of any separate license agreement you may have executed
|
|
133
|
+
with Licensor regarding such Contributions.
|
|
134
|
+
|
|
135
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
136
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
137
|
+
except as required for reasonable and customary use in describing the
|
|
138
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
139
|
+
|
|
140
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
141
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
142
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
143
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
144
|
+
implied, including, without limitation, any warranties or conditions
|
|
145
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
146
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
147
|
+
appropriateness of using or redistributing the Work and assume any
|
|
148
|
+
risks associated with Your exercise of permissions under this License.
|
|
149
|
+
|
|
150
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
151
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
152
|
+
unless required by applicable law (such as deliberate and grossly
|
|
153
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
154
|
+
liable to You for damages, including any direct, indirect, special,
|
|
155
|
+
incidental, or exemplary damages of any character arising as a
|
|
156
|
+
result of this License or out of the use or inability to use the
|
|
157
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
158
|
+
work stoppage, computer failure or malfunction, or all other
|
|
159
|
+
commercial damages or losses), even if such Contributor has been
|
|
160
|
+
advised of the possibility of such damages.
|
|
161
|
+
|
|
162
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
163
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
164
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
165
|
+
or other liability obligations and/or rights consistent with this
|
|
166
|
+
License. However, in accepting such obligations, You may act only
|
|
167
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
168
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
169
|
+
defend, and hold each Contributor harmless for any liability
|
|
170
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
171
|
+
of your accepting any such warranty or additional liability.
|
|
172
|
+
|
|
173
|
+
END OF TERMS AND CONDITIONS
|
|
174
|
+
|
|
175
|
+
Copyright 2026 Featuresmith Contributors
|
|
176
|
+
|
|
177
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
178
|
+
you may not use this file except in compliance with the License.
|
|
179
|
+
You may obtain a copy of the License at
|
|
180
|
+
|
|
181
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
182
|
+
|
|
183
|
+
Unless required by applicable law or agreed to in writing, software
|
|
184
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
185
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
186
|
+
See the License for the specific language governing permissions and
|
|
187
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
featuresmith_cli
|