datasecops-cli 0.2.2__tar.gz → 0.2.4__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.
Files changed (47) hide show
  1. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/CHANGELOG.md +19 -0
  2. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/PKG-INFO +1 -1
  3. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/pyproject.toml +1 -1
  4. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/menus/development.py +11 -8
  5. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/services/bootstrap_service.py +1 -1
  6. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/services/download_service.py +10 -2
  7. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/services/linting_service.py +42 -3
  8. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/.github/workflows/publish-cli.yml +0 -0
  9. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/.gitignore +0 -0
  10. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/DEVELOPMENT.md +0 -0
  11. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/LICENSE +0 -0
  12. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/README.md +0 -0
  13. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/docs/getting-started.md +0 -0
  14. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/docs/legacy.md +0 -0
  15. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/docs/legacy_plan_of_action.md +0 -0
  16. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/docs/mcp-server.md +0 -0
  17. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/mcp-servers.json +0 -0
  18. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/setup.ps1 +0 -0
  19. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/setup.sh +0 -0
  20. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/__init__.py +0 -0
  21. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/config.py +0 -0
  22. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/main.py +0 -0
  23. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/menus/__init__.py +0 -0
  24. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/menus/downloads.py +0 -0
  25. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/menus/git_operations.py +0 -0
  26. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/models/__init__.py +0 -0
  27. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/models/git_helpers.py +0 -0
  28. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/models/project_config.py +0 -0
  29. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/services/__init__.py +0 -0
  30. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/services/dbt_runner.py +0 -0
  31. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/services/git_service.py +0 -0
  32. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/services/skill_service.py +0 -0
  33. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/services/snowflake_service.py +0 -0
  34. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/utilities/__init__.py +0 -0
  35. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/utilities/display.py +0 -0
  36. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/utilities/file_utils.py +0 -0
  37. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_cli/utilities/yaml_utils.py +0 -0
  38. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_mcp/__init__.py +0 -0
  39. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_mcp/__main__.py +0 -0
  40. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_mcp/connection.py +0 -0
  41. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/src/datasecops_mcp/server.py +0 -0
  42. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/tests/__init__.py +0 -0
  43. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/tests/test_config.py +0 -0
  44. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/tests/test_file_utils.py +0 -0
  45. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/tests/test_models.py +0 -0
  46. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/tests/test_version.py +0 -0
  47. {datasecops_cli-0.2.2 → datasecops_cli-0.2.4}/tests/test_yaml_utils.py +0 -0
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to the DataSecOps CLI are documented in this file.
4
4
 
5
+ ## [0.2.4] - 2026-05-11
6
+
7
+ ### Fixed
8
+
9
+ - **Use `uv pip` instead of `pip`** for all package operations — `get_installed_versions()`, `install_requirements()`, and bootstrap hints now use `uv pip show` / `uv pip install` to match the framework's `uv`-based toolchain
10
+ - **Pin sqlfluff versions from native app** — the lint menu now fetches the framework-mandated `sqlfluff` and `sqlfluff-templater-dbt` versions from `DBT_VERSIONS` config and installs/upgrades to those exact versions before linting
11
+
12
+ ## [0.2.3] - 2026-05-11
13
+
14
+ ### Fixed
15
+
16
+ - **Stripped invalid `dbt_skip_compilation_error` option** from the generated `[sqlfluff:templater:dbt]` section — this native app field is not a valid sqlfluff config key and caused parse errors
17
+ - **`profiles_dir = ${DBT_PROFILES_DIR}` no longer leaks** into generated config — the raw value from the native app is now always replaced with the resolved local path or removed entirely
18
+ - **Empty string values** (e.g. `warnings = ""`) now emit `None` instead of blank, matching sqlfluff's expected INI format
19
+
20
+ ### Added
21
+
22
+ - **Auto-install `sqlfluff-templater-dbt`** — the lint menu now checks for missing sqlfluff packages before linting and installs them automatically
23
+
5
24
  ## [0.2.2] - 2026-05-10
6
25
 
7
26
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datasecops-cli
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: DataSecOps Framework CLI for Snowflake Native App
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "datasecops-cli"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  description = "DataSecOps Framework CLI for Snowflake Native App"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -141,15 +141,18 @@ class DevelopmentMenu:
141
141
  complete_action()
142
142
 
143
143
  def _ensure_sqlfluff_config(self) -> bool:
144
- """Download .sqlfluff from the framework if it doesn't exist locally."""
144
+ """Download .sqlfluff from the framework if it doesn't exist locally, and ensure correct versions are installed."""
145
145
  config_path = self.linting.project_dir / ".sqlfluff"
146
- if config_path.exists():
147
- return True
148
- if not self.downloads:
149
- error_line("No .sqlfluff config found and download service not available")
150
- return False
151
- info_line("No .sqlfluff config found — downloading from framework...")
152
- return self.downloads.download_sqlfluff_config(profiles_dir=self.profiles_dir)
146
+ if not config_path.exists():
147
+ if not self.downloads:
148
+ error_line("No .sqlfluff config found and download service not available")
149
+ return False
150
+ info_line("No .sqlfluff config found — downloading from framework...")
151
+ if not self.downloads.download_sqlfluff_config(profiles_dir=self.profiles_dir):
152
+ return False
153
+ # Fetch pinned versions from the native app and ensure they're installed
154
+ required = self.downloads.get_sqlfluff_requirements() if self.downloads else None
155
+ return self.linting.ensure_templater_installed(required_packages=required or None)
153
156
 
154
157
  def _lint_menu(self) -> None:
155
158
  clear()
@@ -116,7 +116,7 @@ class BootstrapService:
116
116
  requirements = self.download_service.get_sqlfluff_requirements()
117
117
  if requirements:
118
118
  info_line(f" Required: {', '.join(requirements)}")
119
- info_line(" (install with: pip install " + " ".join(requirements) + ")")
119
+ info_line(" (install with: uv pip install " + " ".join(requirements) + ")")
120
120
  steps_passed += 1
121
121
 
122
122
  # Step 8: Install Cortex Code skills
@@ -69,6 +69,11 @@ class DownloadService:
69
69
  self.sf = snowflake_service
70
70
  self.project_dir = project_dir
71
71
 
72
+ # Options to strip from specific core sections (not valid sqlfluff config keys).
73
+ CORE_STRIP_OPTIONS: dict[str, set[str]] = {
74
+ "dbt": {"dbt_skip_compilation_error"},
75
+ }
76
+
72
77
  @staticmethod
73
78
  def _format_value(val) -> str:
74
79
  """Format a JSON value for sqlfluff INI output."""
@@ -106,13 +111,16 @@ class DownloadService:
106
111
  if not isinstance(entry, dict) or not entry.get("enabled", True):
107
112
  continue
108
113
  opts = dict(entry.get("options", {}))
114
+ # Strip options that are not valid sqlfluff config keys
115
+ for strip_key in self.CORE_STRIP_OPTIONS.get(key, set()):
116
+ opts.pop(strip_key, None)
109
117
  if key == "dbt":
110
118
  # Override profiles_dir / project_dir with local values
111
119
  opts["project_dir"] = "."
112
120
  if profiles_dir:
113
121
  opts["profiles_dir"] = profiles_dir
114
- elif "profiles_dir" in opts:
115
- del opts["profiles_dir"]
122
+ else:
123
+ opts.pop("profiles_dir", None)
116
124
  if opts:
117
125
  self._emit_section(lines, section_header, opts)
118
126
 
@@ -15,7 +15,7 @@ class LintingService:
15
15
  versions = {}
16
16
  for package in ["sqlfluff", "sqlfluff-templater-dbt"]:
17
17
  result = subprocess.run(
18
- ["pip", "show", package],
18
+ ["uv", "pip", "show", package],
19
19
  capture_output=True, text=True
20
20
  )
21
21
  if result.returncode == 0:
@@ -33,16 +33,55 @@ class LintingService:
33
33
  warning_line("No packages to install")
34
34
  return False
35
35
 
36
- cmd = ["pip", "install"] + packages
36
+ cmd = ["uv", "pip", "install"] + packages
37
37
  info_line(f"Installing: {', '.join(packages)}")
38
38
  result = subprocess.run(cmd, capture_output=False)
39
39
  if result.returncode == 0:
40
40
  success_line("SQLFluff requirements installed successfully")
41
41
  return True
42
42
  else:
43
- error_line(f"pip install failed with exit code {result.returncode}")
43
+ error_line(f"uv pip install failed with exit code {result.returncode}")
44
44
  return False
45
45
 
46
+ def ensure_templater_installed(self, required_packages: list[str] = None) -> bool:
47
+ """Check sqlfluff packages are installed at the required versions.
48
+
49
+ Args:
50
+ required_packages: Pinned packages from the framework, e.g. ["sqlfluff==3.4.0", "sqlfluff-templater-dbt==3.4.0"].
51
+ If None, just checks that the packages are present (any version).
52
+ """
53
+ installed = self.get_installed_versions()
54
+
55
+ if required_packages:
56
+ # Build a map of package -> required version from "pkg==ver" strings
57
+ required: dict[str, str | None] = {}
58
+ for spec in required_packages:
59
+ if "==" in spec:
60
+ name, ver = spec.split("==", 1)
61
+ required[name] = ver
62
+ else:
63
+ required[spec] = None
64
+
65
+ to_install: list[str] = []
66
+ for name, req_ver in required.items():
67
+ cur_ver = installed.get(name)
68
+ if not cur_ver:
69
+ to_install.append(f"{name}=={req_ver}" if req_ver else name)
70
+ elif req_ver and cur_ver != req_ver:
71
+ info_line(f" {name}: installed {cur_ver}, framework requires {req_ver}")
72
+ to_install.append(f"{name}=={req_ver}")
73
+
74
+ if not to_install:
75
+ return True
76
+ return self.install_requirements(to_install)
77
+
78
+ # No pinned versions — just ensure packages are present
79
+ missing = [pkg for pkg in ["sqlfluff", "sqlfluff-templater-dbt"] if not installed.get(pkg)]
80
+ if not missing:
81
+ return True
82
+ warning_line(f"Missing packages: {', '.join(missing)}")
83
+ return self.install_requirements(missing)
84
+
46
85
  def lint_file(self, file_path: str = None, fix: bool = False) -> subprocess.CompletedProcess:
47
86
  action = "fix" if fix else "lint"
48
87
  cmd = ["sqlfluff", action]
File without changes
File without changes
File without changes
File without changes