weevr-cli 0.1.1__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.
- weevr_cli/__init__.py +8 -0
- weevr_cli/cli.py +166 -0
- weevr_cli/config.py +141 -0
- weevr_cli/output.py +58 -0
- weevr_cli/py.typed +0 -0
- weevr_cli/state.py +24 -0
- weevr_cli-0.1.1.dist-info/METADATA +324 -0
- weevr_cli-0.1.1.dist-info/RECORD +10 -0
- weevr_cli-0.1.1.dist-info/WHEEL +4 -0
- weevr_cli-0.1.1.dist-info/entry_points.txt +3 -0
weevr_cli/__init__.py
ADDED
weevr_cli/cli.py
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""Main CLI application."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from weevr_cli import __version__
|
|
8
|
+
from weevr_cli.config import ConfigError, find_project_root, load_config
|
|
9
|
+
from weevr_cli.output import create_console, print_error, print_json
|
|
10
|
+
from weevr_cli.state import AppState
|
|
11
|
+
|
|
12
|
+
app = typer.Typer(
|
|
13
|
+
name="weevr",
|
|
14
|
+
help="CLI for managing weevr projects — scaffolding, validation, and deployment.",
|
|
15
|
+
no_args_is_help=True,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _version_callback(ctx: typer.Context, value: bool) -> None:
|
|
20
|
+
"""Print version and exit."""
|
|
21
|
+
if not value:
|
|
22
|
+
return
|
|
23
|
+
json_mode = ctx.params.get("json", False)
|
|
24
|
+
if json_mode:
|
|
25
|
+
print_json({"version": __version__})
|
|
26
|
+
else:
|
|
27
|
+
typer.echo(f"weevr {__version__}")
|
|
28
|
+
raise typer.Exit()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@app.callback()
|
|
32
|
+
def main(
|
|
33
|
+
ctx: typer.Context,
|
|
34
|
+
json: bool = typer.Option(
|
|
35
|
+
False,
|
|
36
|
+
"--json",
|
|
37
|
+
help="Output in JSON format for machine consumption.",
|
|
38
|
+
is_eager=True,
|
|
39
|
+
),
|
|
40
|
+
version: bool | None = typer.Option(
|
|
41
|
+
None,
|
|
42
|
+
"--version",
|
|
43
|
+
"-v",
|
|
44
|
+
help="Show version and exit.",
|
|
45
|
+
callback=_version_callback,
|
|
46
|
+
is_eager=True,
|
|
47
|
+
),
|
|
48
|
+
) -> None:
|
|
49
|
+
"""Weevr CLI — manage weevr projects from your terminal."""
|
|
50
|
+
console = create_console(json_mode=json)
|
|
51
|
+
|
|
52
|
+
config = None
|
|
53
|
+
project_root = find_project_root()
|
|
54
|
+
if project_root is not None:
|
|
55
|
+
config_path = project_root / ".weevr" / "cli.yaml"
|
|
56
|
+
try:
|
|
57
|
+
config = load_config(config_path)
|
|
58
|
+
except ConfigError as exc:
|
|
59
|
+
print_error(str(exc), exc.code, json_mode=json, console=console)
|
|
60
|
+
raise typer.Exit(code=1) from exc
|
|
61
|
+
|
|
62
|
+
ctx.obj = AppState(console=console, config=config, json_mode=json)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def require_config(ctx: typer.Context) -> AppState:
|
|
66
|
+
"""Get AppState from context, failing if config is not loaded.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
ctx: Typer context with AppState in obj.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
AppState with a guaranteed non-None config.
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
typer.Exit: If no config is available.
|
|
76
|
+
"""
|
|
77
|
+
state: AppState = ctx.obj
|
|
78
|
+
if state.config is None:
|
|
79
|
+
print_error(
|
|
80
|
+
"No weevr project found. Run 'weevr init' to create one, "
|
|
81
|
+
"or run this command from within a weevr project directory.",
|
|
82
|
+
"config_not_found",
|
|
83
|
+
json_mode=state.json_mode,
|
|
84
|
+
console=state.console,
|
|
85
|
+
)
|
|
86
|
+
raise typer.Exit(code=1)
|
|
87
|
+
return state
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@app.command()
|
|
91
|
+
def init(
|
|
92
|
+
name: str = typer.Argument(".", help="Project name or directory."),
|
|
93
|
+
examples: bool = typer.Option(False, "--examples", help="Include example files."),
|
|
94
|
+
interactive: bool = typer.Option(False, "--interactive", "-i", help="Interactive wizard."),
|
|
95
|
+
) -> None:
|
|
96
|
+
"""Create a new weevr project."""
|
|
97
|
+
typer.echo(f"Initializing weevr project: {name}")
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@app.command()
|
|
101
|
+
def new(
|
|
102
|
+
file_type: str = typer.Argument(..., help="File type: thread, weave, or loom."),
|
|
103
|
+
name: str = typer.Argument(..., help="Name for the new file."),
|
|
104
|
+
) -> None:
|
|
105
|
+
"""Generate a new thread, weave, or loom file from a template."""
|
|
106
|
+
typer.echo(f"Creating {file_type}: {name}")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@app.command()
|
|
110
|
+
def validate(
|
|
111
|
+
ctx: typer.Context,
|
|
112
|
+
path: str | None = typer.Argument(None, help="File or directory to validate."),
|
|
113
|
+
strict: bool = typer.Option(False, "--strict", help="Treat warnings as errors."),
|
|
114
|
+
) -> None:
|
|
115
|
+
"""Validate project files against schemas and check reference integrity."""
|
|
116
|
+
require_config(ctx)
|
|
117
|
+
target = path or "entire project"
|
|
118
|
+
typer.echo(f"Validating: {target}")
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@app.command()
|
|
122
|
+
def deploy(
|
|
123
|
+
ctx: typer.Context,
|
|
124
|
+
paths: list[str] | None = typer.Argument( # noqa: B008
|
|
125
|
+
None, help="Specific files to deploy."
|
|
126
|
+
),
|
|
127
|
+
target: str = typer.Option("", "--target", "-t", help="Named deploy target."),
|
|
128
|
+
workspace_id: str | None = typer.Option(None, "--workspace-id", help="Override workspace."),
|
|
129
|
+
lakehouse_id: str | None = typer.Option(None, "--lakehouse-id", help="Override lakehouse."),
|
|
130
|
+
path_prefix: str | None = typer.Option(None, "--path-prefix", help="Override path prefix."),
|
|
131
|
+
full: bool = typer.Option(False, "--full", help="Full overwrite instead of smart sync."),
|
|
132
|
+
clean: bool = typer.Option(False, "--clean", help="Remove remote files not present locally."),
|
|
133
|
+
dry_run: bool = typer.Option(False, "--dry-run", help="Show what would change."),
|
|
134
|
+
skip_validation: bool = typer.Option(
|
|
135
|
+
False, "--skip-validation", help="Skip pre-deploy validation."
|
|
136
|
+
),
|
|
137
|
+
) -> None:
|
|
138
|
+
"""Deploy project files to a Fabric Lakehouse."""
|
|
139
|
+
require_config(ctx)
|
|
140
|
+
typer.echo("Deploying...")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@app.command()
|
|
144
|
+
def status(
|
|
145
|
+
ctx: typer.Context,
|
|
146
|
+
target: str = typer.Option("", "--target", "-t", help="Named deploy target."),
|
|
147
|
+
) -> None:
|
|
148
|
+
"""Show diff between local files and deployed state."""
|
|
149
|
+
require_config(ctx)
|
|
150
|
+
typer.echo("Checking status...")
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@app.command(name="list")
|
|
154
|
+
def list_cmd(ctx: typer.Context) -> None:
|
|
155
|
+
"""Display project structure and dependency relationships."""
|
|
156
|
+
require_config(ctx)
|
|
157
|
+
typer.echo("Listing project structure...")
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@app.command()
|
|
161
|
+
def schema(
|
|
162
|
+
action: str = typer.Argument("version", help="Action: version or update."),
|
|
163
|
+
version: str | None = typer.Option(None, "--version", help="Specific schema version."),
|
|
164
|
+
) -> None:
|
|
165
|
+
"""Manage validation schemas."""
|
|
166
|
+
typer.echo(f"Schema: {action}")
|
weevr_cli/config.py
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"""Configuration loading and dataclasses for weevr CLI."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
import yaml
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ConfigError(Exception):
|
|
13
|
+
"""Error loading or parsing CLI configuration."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, message: str, code: str) -> None:
|
|
16
|
+
"""Initialize with a human-readable message and machine-readable error code."""
|
|
17
|
+
super().__init__(message)
|
|
18
|
+
self.code = code
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class TargetConfig:
|
|
23
|
+
"""A single deploy target environment."""
|
|
24
|
+
|
|
25
|
+
workspace_id: str
|
|
26
|
+
lakehouse_id: str
|
|
27
|
+
path_prefix: str | None = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass
|
|
31
|
+
class WeevrConfig:
|
|
32
|
+
"""Parsed .weevr/cli.yaml configuration."""
|
|
33
|
+
|
|
34
|
+
targets: dict[str, TargetConfig]
|
|
35
|
+
default_target: str | None = None
|
|
36
|
+
schema_version: str | None = None
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def from_dict(cls, data: dict[str, Any]) -> WeevrConfig:
|
|
40
|
+
"""Parse a config dictionary into a WeevrConfig instance.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
data: Raw dictionary from YAML parsing.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
Parsed WeevrConfig.
|
|
47
|
+
|
|
48
|
+
Raises:
|
|
49
|
+
ConfigError: If required fields are missing or invalid.
|
|
50
|
+
"""
|
|
51
|
+
raw_targets = data.get("targets")
|
|
52
|
+
if not isinstance(raw_targets, dict) or not raw_targets:
|
|
53
|
+
raise ConfigError(
|
|
54
|
+
"Config is missing required 'targets' section with at least one target.",
|
|
55
|
+
code="config_invalid",
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
targets: dict[str, TargetConfig] = {}
|
|
59
|
+
for name, target_data in raw_targets.items():
|
|
60
|
+
if not isinstance(target_data, dict):
|
|
61
|
+
raise ConfigError(
|
|
62
|
+
f"Target '{name}' must be a mapping with workspace_id and lakehouse_id.",
|
|
63
|
+
code="config_invalid",
|
|
64
|
+
)
|
|
65
|
+
workspace_id = target_data.get("workspace_id")
|
|
66
|
+
lakehouse_id = target_data.get("lakehouse_id")
|
|
67
|
+
if not workspace_id or not lakehouse_id:
|
|
68
|
+
raise ConfigError(
|
|
69
|
+
f"Target '{name}' is missing required fields: workspace_id, lakehouse_id.",
|
|
70
|
+
code="config_invalid",
|
|
71
|
+
)
|
|
72
|
+
targets[name] = TargetConfig(
|
|
73
|
+
workspace_id=str(workspace_id),
|
|
74
|
+
lakehouse_id=str(lakehouse_id),
|
|
75
|
+
path_prefix=target_data.get("path_prefix"),
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
schema_data = data.get("schema", {})
|
|
79
|
+
schema_version = schema_data.get("version") if isinstance(schema_data, dict) else None
|
|
80
|
+
|
|
81
|
+
return cls(
|
|
82
|
+
targets=targets,
|
|
83
|
+
default_target=data.get("default_target"),
|
|
84
|
+
schema_version=str(schema_version) if schema_version is not None else None,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def load_config(path: Path) -> WeevrConfig:
|
|
89
|
+
"""Load and parse a .weevr/cli.yaml file.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
path: Path to the cli.yaml file.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Parsed WeevrConfig.
|
|
96
|
+
|
|
97
|
+
Raises:
|
|
98
|
+
ConfigError: If the file cannot be read or parsed.
|
|
99
|
+
"""
|
|
100
|
+
try:
|
|
101
|
+
text = path.read_text(encoding="utf-8")
|
|
102
|
+
except OSError as exc:
|
|
103
|
+
raise ConfigError(
|
|
104
|
+
f"Cannot read config file: {path} ({exc})",
|
|
105
|
+
code="config_not_found",
|
|
106
|
+
) from exc
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
data = yaml.safe_load(text)
|
|
110
|
+
except yaml.YAMLError as exc:
|
|
111
|
+
raise ConfigError(
|
|
112
|
+
f"Invalid YAML in config file {path}: {exc}",
|
|
113
|
+
code="config_invalid",
|
|
114
|
+
) from exc
|
|
115
|
+
|
|
116
|
+
if not isinstance(data, dict):
|
|
117
|
+
raise ConfigError(
|
|
118
|
+
f"Config file {path} must contain a YAML mapping, got {type(data).__name__}.",
|
|
119
|
+
code="config_invalid",
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
return WeevrConfig.from_dict(data)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def find_project_root(start: Path | None = None) -> Path | None:
|
|
126
|
+
"""Walk up from start directory to find a .weevr/cli.yaml file.
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
start: Directory to start searching from. Defaults to cwd.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
The project root directory, or None if not found.
|
|
133
|
+
"""
|
|
134
|
+
current = (start or Path.cwd()).resolve()
|
|
135
|
+
while True:
|
|
136
|
+
if (current / ".weevr" / "cli.yaml").is_file():
|
|
137
|
+
return current
|
|
138
|
+
parent = current.parent
|
|
139
|
+
if parent == current:
|
|
140
|
+
return None
|
|
141
|
+
current = parent
|
weevr_cli/output.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Output helpers for Rich and JSON modes."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
from rich.panel import Panel
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def create_console(json_mode: bool = False) -> Console:
|
|
14
|
+
"""Create a Rich Console configured for the current output mode.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
json_mode: If True, suppress Rich output (quiet mode).
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
Configured Console instance.
|
|
21
|
+
"""
|
|
22
|
+
return Console(stderr=True, quiet=json_mode)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def print_json(data: dict[str, Any]) -> None:
|
|
26
|
+
"""Write a JSON object to stdout.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
data: Dictionary to serialize as JSON.
|
|
30
|
+
"""
|
|
31
|
+
sys.stdout.write(json.dumps(data) + "\n")
|
|
32
|
+
sys.stdout.flush()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def print_error(
|
|
36
|
+
message: str,
|
|
37
|
+
code: str,
|
|
38
|
+
*,
|
|
39
|
+
json_mode: bool,
|
|
40
|
+
console: Console | None = None,
|
|
41
|
+
) -> None:
|
|
42
|
+
"""Display an error in the appropriate format.
|
|
43
|
+
|
|
44
|
+
In JSON mode, writes a JSON error object to stderr.
|
|
45
|
+
In interactive mode, renders a Rich error panel to stderr.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
message: Human-readable error description.
|
|
49
|
+
code: Machine-readable error code.
|
|
50
|
+
json_mode: Whether to output JSON instead of Rich.
|
|
51
|
+
console: Rich Console for interactive mode (ignored in JSON mode).
|
|
52
|
+
"""
|
|
53
|
+
if json_mode:
|
|
54
|
+
sys.stderr.write(json.dumps({"error": message, "code": code}) + "\n")
|
|
55
|
+
sys.stderr.flush()
|
|
56
|
+
else:
|
|
57
|
+
err_console = console or Console(stderr=True)
|
|
58
|
+
err_console.print(Panel(message, title="Error", border_style="red"), highlight=False)
|
weevr_cli/py.typed
ADDED
|
File without changes
|
weevr_cli/state.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Application state passed through Typer context."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
|
|
9
|
+
from weevr_cli.config import WeevrConfig
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class AppState:
|
|
14
|
+
"""Typed context object stored in ctx.obj for all commands.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
console: Shared Rich Console instance.
|
|
18
|
+
config: Parsed project config, or None if outside a project.
|
|
19
|
+
json_mode: Whether JSON output is active.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
console: Console
|
|
23
|
+
config: WeevrConfig | None
|
|
24
|
+
json_mode: bool
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: weevr-cli
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: CLI for managing weevr projects — scaffolding, validation, and deployment to Microsoft Fabric.
|
|
5
|
+
Keywords: weevr,fabric,onelake,cli,yaml,deployment,data-pipeline
|
|
6
|
+
Author: Pierre LaFromboise
|
|
7
|
+
Author-email: Pierre LaFromboise <44212292+DataInsightPro@users.noreply.github.com>
|
|
8
|
+
License: Apache License
|
|
9
|
+
Version 2.0, January 2004
|
|
10
|
+
http://www.apache.org/licenses/
|
|
11
|
+
|
|
12
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
13
|
+
|
|
14
|
+
1. Definitions.
|
|
15
|
+
|
|
16
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
17
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
18
|
+
|
|
19
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
20
|
+
the copyright owner that is granting the License.
|
|
21
|
+
|
|
22
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
23
|
+
other entities that control, are controlled by, or are under common
|
|
24
|
+
control with that entity. For the purposes of this definition,
|
|
25
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
26
|
+
direction or management of such entity, whether by contract or
|
|
27
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
28
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
29
|
+
|
|
30
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
31
|
+
exercising permissions granted by this License.
|
|
32
|
+
|
|
33
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
34
|
+
including but not limited to software source code, documentation
|
|
35
|
+
source, and configuration files.
|
|
36
|
+
|
|
37
|
+
"Object" form shall mean any form resulting from mechanical
|
|
38
|
+
transformation or translation of a Source form, including but
|
|
39
|
+
not limited to compiled object code, generated documentation,
|
|
40
|
+
and conversions to other media types.
|
|
41
|
+
|
|
42
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
43
|
+
Object form, made available under the License, as indicated by a
|
|
44
|
+
copyright notice that is included in or attached to the work
|
|
45
|
+
(an example is provided in the Appendix below).
|
|
46
|
+
|
|
47
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
48
|
+
form, that is based on (or derived from) the Work and for which the
|
|
49
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
50
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
51
|
+
of this License, Derivative Works shall not include works that remain
|
|
52
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
53
|
+
the Work and Derivative Works thereof.
|
|
54
|
+
|
|
55
|
+
"Contribution" shall mean any work of authorship, including
|
|
56
|
+
the original version of the Work and any modifications or additions
|
|
57
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
58
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
59
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
60
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
61
|
+
means any form of electronic, verbal, or written communication sent
|
|
62
|
+
to the Licensor or its representatives, including but not limited to
|
|
63
|
+
communication on electronic mailing lists, source code control systems,
|
|
64
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
65
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
66
|
+
excluding communication that is conspicuously marked or otherwise
|
|
67
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
68
|
+
|
|
69
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
70
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
71
|
+
subsequently incorporated within the Work.
|
|
72
|
+
|
|
73
|
+
2. Grant of Copyright 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
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
77
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
78
|
+
Work and such Derivative Works in Source or Object form.
|
|
79
|
+
|
|
80
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
81
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
82
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
83
|
+
(except as stated in this section) patent license to make, have made,
|
|
84
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
85
|
+
where such license applies only to those patent claims licensable
|
|
86
|
+
by such Contributor that are necessarily infringed by their
|
|
87
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
88
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
89
|
+
institute patent litigation against any entity (including a
|
|
90
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
91
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
92
|
+
or contributory patent infringement, then any patent licenses
|
|
93
|
+
granted to You under this License for that Work shall terminate
|
|
94
|
+
as of the date such litigation is filed.
|
|
95
|
+
|
|
96
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
97
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
98
|
+
modifications, and in Source or Object form, provided that You
|
|
99
|
+
meet the following conditions:
|
|
100
|
+
|
|
101
|
+
(a) You must give any other recipients of the Work or
|
|
102
|
+
Derivative Works a copy of this License; and
|
|
103
|
+
|
|
104
|
+
(b) You must cause any modified files to carry prominent notices
|
|
105
|
+
stating that You changed the files; and
|
|
106
|
+
|
|
107
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
108
|
+
that You distribute, all copyright, patent, trademark, and
|
|
109
|
+
attribution notices from the Source form of the Work,
|
|
110
|
+
excluding those notices that do not pertain to any part of
|
|
111
|
+
the Derivative Works; and
|
|
112
|
+
|
|
113
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
114
|
+
distribution, then any Derivative Works that You distribute must
|
|
115
|
+
include a readable copy of the attribution notices contained
|
|
116
|
+
within such NOTICE file, excluding any notices that do not
|
|
117
|
+
pertain to any part of the Derivative Works, in at least one
|
|
118
|
+
of the following places: within a NOTICE text file distributed
|
|
119
|
+
as part of the Derivative Works; within the Source form or
|
|
120
|
+
documentation, if provided along with the Derivative Works; or,
|
|
121
|
+
within a display generated by the Derivative Works, if and
|
|
122
|
+
wherever such third-party notices normally appear. The contents
|
|
123
|
+
of the NOTICE file are for informational purposes only and
|
|
124
|
+
do not modify the License. You may add Your own attribution
|
|
125
|
+
notices within Derivative Works that You distribute, alongside
|
|
126
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
127
|
+
that such additional attribution notices cannot be construed
|
|
128
|
+
as modifying the License.
|
|
129
|
+
|
|
130
|
+
You may add Your own copyright statement to Your modifications and
|
|
131
|
+
may provide additional or different license terms and conditions
|
|
132
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
133
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
134
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
135
|
+
the conditions stated in this License.
|
|
136
|
+
|
|
137
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
138
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
139
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
140
|
+
this License, without any additional terms or conditions.
|
|
141
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
142
|
+
the terms of any separate license agreement you may have executed
|
|
143
|
+
with Licensor regarding such Contributions.
|
|
144
|
+
|
|
145
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
146
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
147
|
+
except as required for reasonable and customary use in describing the
|
|
148
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
149
|
+
|
|
150
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
151
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
152
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
153
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
154
|
+
implied, including, without limitation, any warranties or conditions
|
|
155
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
156
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
157
|
+
appropriateness of using or redistributing the Work and assume any
|
|
158
|
+
risks associated with Your exercise of permissions under this License.
|
|
159
|
+
|
|
160
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
161
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
162
|
+
unless required by applicable law (such as deliberate and grossly
|
|
163
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
164
|
+
liable to You for damages, including any direct, indirect, special,
|
|
165
|
+
incidental, or consequential damages of any character arising as a
|
|
166
|
+
result of this License or out of the use or inability to use the
|
|
167
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
168
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
169
|
+
other commercial damages or losses), even if such Contributor
|
|
170
|
+
has been advised of the possibility of such damages.
|
|
171
|
+
|
|
172
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
173
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
174
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
175
|
+
or other liability obligations and/or rights consistent with this
|
|
176
|
+
License. However, in accepting such obligations, You may act only
|
|
177
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
178
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
179
|
+
defend, and hold each Contributor harmless for any liability
|
|
180
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
181
|
+
of your accepting any such warranty or additional liability.
|
|
182
|
+
|
|
183
|
+
END OF TERMS AND CONDITIONS
|
|
184
|
+
|
|
185
|
+
Copyright 2025 Pierre LaFromboise
|
|
186
|
+
|
|
187
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
188
|
+
you may not use this file except in compliance with the License.
|
|
189
|
+
You may obtain a copy of the License at
|
|
190
|
+
|
|
191
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
192
|
+
|
|
193
|
+
Unless required by applicable law or agreed to in writing, software
|
|
194
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
195
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
196
|
+
See the License for the specific language governing permissions and
|
|
197
|
+
limitations under the License.
|
|
198
|
+
Classifier: Development Status :: 3 - Alpha
|
|
199
|
+
Classifier: Intended Audience :: Developers
|
|
200
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
201
|
+
Classifier: Programming Language :: Python :: 3
|
|
202
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
203
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
204
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
205
|
+
Classifier: Topic :: Utilities
|
|
206
|
+
Classifier: Typing :: Typed
|
|
207
|
+
Requires-Dist: typer>=0.15.0
|
|
208
|
+
Requires-Dist: rich>=13.0.0
|
|
209
|
+
Requires-Dist: pyyaml>=6.0,<7.0
|
|
210
|
+
Requires-Dist: jsonschema>=4.0,<5.0
|
|
211
|
+
Requires-Dist: azure-storage-file-datalake>=12.0.0
|
|
212
|
+
Requires-Dist: azure-identity>=1.0.0
|
|
213
|
+
Requires-Python: >=3.11
|
|
214
|
+
Project-URL: Repository, https://github.com/ardent-data/weevr-cli
|
|
215
|
+
Project-URL: Issues, https://github.com/ardent-data/weevr-cli/issues
|
|
216
|
+
Project-URL: Changelog, https://github.com/ardent-data/weevr-cli/blob/main/CHANGELOG.md
|
|
217
|
+
Description-Content-Type: text/markdown
|
|
218
|
+
|
|
219
|
+
# weevr-cli
|
|
220
|
+
|
|
221
|
+
CLI for managing [weevr](https://github.com/ardent-data/weevr) projects — scaffolding, validation, and deployment to Microsoft Fabric.
|
|
222
|
+
|
|
223
|
+
## What it does
|
|
224
|
+
|
|
225
|
+
The weevr engine runs inside Fabric notebooks; the CLI runs on your workstation and in CI/CD pipelines. It bridges the gap between your Git repository and the Fabric Lakehouse where weevr project files live.
|
|
226
|
+
|
|
227
|
+
- **`weevr init`** — Scaffold a new weevr project with the standard directory layout
|
|
228
|
+
- **`weevr new`** — Generate thread, weave, or loom files from templates
|
|
229
|
+
- **`weevr validate`** — Check YAML schema conformance and cross-file reference integrity
|
|
230
|
+
- **`weevr deploy`** — Sync project files to a Fabric Lakehouse via the OneLake API
|
|
231
|
+
- **`weevr status`** — Diff local files against what's deployed
|
|
232
|
+
- **`weevr list`** — View project structure and dependency relationships
|
|
233
|
+
- **`weevr schema`** — Manage validation schemas
|
|
234
|
+
|
|
235
|
+
## Installation
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# With uv (recommended)
|
|
239
|
+
uv tool install weevr-cli
|
|
240
|
+
|
|
241
|
+
# With pipx
|
|
242
|
+
pipx install weevr-cli
|
|
243
|
+
|
|
244
|
+
# With pip
|
|
245
|
+
pip install weevr-cli
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Quick start
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Create a new project
|
|
252
|
+
weevr init my-project
|
|
253
|
+
cd my-project
|
|
254
|
+
|
|
255
|
+
# Generate some files
|
|
256
|
+
weevr new thread orders
|
|
257
|
+
weevr new weave customer_dim
|
|
258
|
+
weevr new loom daily_load
|
|
259
|
+
|
|
260
|
+
# Validate
|
|
261
|
+
weevr validate
|
|
262
|
+
|
|
263
|
+
# Deploy to your Fabric Lakehouse
|
|
264
|
+
weevr deploy --target dev
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Configuration
|
|
268
|
+
|
|
269
|
+
The CLI reads its configuration from `.weevr/cli.yaml` in your project root:
|
|
270
|
+
|
|
271
|
+
```yaml
|
|
272
|
+
targets:
|
|
273
|
+
dev:
|
|
274
|
+
workspace_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
275
|
+
lakehouse_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
276
|
+
path_prefix: "weevr/my-project"
|
|
277
|
+
prod:
|
|
278
|
+
workspace_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
279
|
+
lakehouse_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
280
|
+
|
|
281
|
+
default_target: dev
|
|
282
|
+
|
|
283
|
+
schema:
|
|
284
|
+
version: "1.11"
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
All config values can be overridden via CLI flags for CI/CD use.
|
|
288
|
+
|
|
289
|
+
## Authentication
|
|
290
|
+
|
|
291
|
+
The CLI uses Azure `DefaultAzureCredential`, which automatically picks up credentials from:
|
|
292
|
+
|
|
293
|
+
- `az login` (local development)
|
|
294
|
+
- Environment variables (CI/CD pipelines)
|
|
295
|
+
- Managed identity (Fabric notebooks)
|
|
296
|
+
- VS Code Azure extension
|
|
297
|
+
|
|
298
|
+
No custom auth configuration needed.
|
|
299
|
+
|
|
300
|
+
## Requirements
|
|
301
|
+
|
|
302
|
+
- Python 3.11+
|
|
303
|
+
- Azure CLI (`az login`) or equivalent credential for deploy/status commands
|
|
304
|
+
|
|
305
|
+
## Development
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Prerequisites: Python 3.11, uv, Git
|
|
309
|
+
|
|
310
|
+
# Setup
|
|
311
|
+
uv sync --dev
|
|
312
|
+
|
|
313
|
+
# Quality checks
|
|
314
|
+
uv run ruff check . # Lint
|
|
315
|
+
uv run ruff format --check . # Format check
|
|
316
|
+
uv run pyright . # Type check
|
|
317
|
+
uv run pytest # Tests
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full development guide.
|
|
321
|
+
|
|
322
|
+
## License
|
|
323
|
+
|
|
324
|
+
Apache 2.0 — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
weevr_cli/__init__.py,sha256=7_se3c6ep81nYe1RJK3plFz-GlBO2ZO5BPlv0QqsJXM,217
|
|
2
|
+
weevr_cli/cli.py,sha256=npiiowX-QJoD9pgQV6yo5oZAGO_WylJPQnbYyMzgkIw,5367
|
|
3
|
+
weevr_cli/config.py,sha256=FdeMq_8kH6_fDnZa7MbaWMNirmzM4KQ9tUacMpOsc-w,4231
|
|
4
|
+
weevr_cli/output.py,sha256=lpsRXxiyTiOSVeOy6uCJmShscWPXhNIOzxI8OBqsPXM,1548
|
|
5
|
+
weevr_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
weevr_cli/state.py,sha256=traLmLYqeg0BvYF3LCSqodYVuW0fbYn1XDU838l_L50,558
|
|
7
|
+
weevr_cli-0.1.1.dist-info/WHEEL,sha256=bEhYrD-rjlF0iRRHiAnfJ0mEjMsRwm29hhDD7yRgWCY,80
|
|
8
|
+
weevr_cli-0.1.1.dist-info/entry_points.txt,sha256=Li2AdiUpU1c8YBD7h7BeXWWDP2ifabDr-CBJ51iQP8Y,45
|
|
9
|
+
weevr_cli-0.1.1.dist-info/METADATA,sha256=mwtdnxd_XOCPnbx8Q-M_Ad32QRMn1wyh6637S4RJ_6Q,16386
|
|
10
|
+
weevr_cli-0.1.1.dist-info/RECORD,,
|