datamasque-cli 1.5.0__tar.gz → 1.6.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.
Files changed (92) hide show
  1. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/.github/workflows/ci.yml +24 -2
  2. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/.github/workflows/release-testpypi.yml +6 -1
  3. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/.github/workflows/release.yml +9 -1
  4. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/CHANGELOG.md +27 -0
  5. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/Makefile +9 -2
  6. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/PKG-INFO +18 -4
  7. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/README.md +13 -0
  8. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/datamasque-cli/skills/datamasque-cli/SKILL.md +10 -1
  9. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/pyproject.toml +6 -4
  10. datamasque_cli-1.6.0/scripts/installation_smoke_test.sh +30 -0
  11. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/client.py +10 -0
  12. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/connections.py +8 -10
  13. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/discovery.py +6 -12
  14. datamasque_cli-1.6.0/src/datamasque_cli/commands/table_references.py +287 -0
  15. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/fileio.py +11 -1
  16. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/main.py +2 -0
  17. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_connections.py +19 -0
  18. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_discovery.py +29 -0
  19. datamasque_cli-1.6.0/tests/commands/test_table_references.py +670 -0
  20. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/conftest.py +7 -0
  21. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/test_delete_safety.py +1 -1
  22. datamasque_cli-1.6.0/tests/integration/test_table_references.py +88 -0
  23. datamasque_cli-1.6.0/tests/test_client_connections.py +34 -0
  24. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/uv.lock +110 -10
  25. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/.claude-plugin/marketplace.json +0 -0
  26. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/.gitignore +0 -0
  27. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/CONTRIBUTING.md +0 -0
  28. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/LICENSE +0 -0
  29. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/NOTICE +0 -0
  30. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/assets/demo.gif +0 -0
  31. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/README.md +0 -0
  32. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/datamasque-cli/.claude-plugin/plugin.json +0 -0
  33. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-builder/.claude-plugin/plugin.json +0 -0
  34. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-builder/skills/ruleset-builder/SKILL.md +0 -0
  35. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-builder/skills/ruleset-builder/references/fk-cascade.md +0 -0
  36. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-builder/skills/ruleset-builder/references/hash-columns-guide.md +0 -0
  37. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-builder/skills/ruleset-builder/references/mask-definitions-guide.md +0 -0
  38. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-builder/skills/ruleset-builder/references/ruleset-libraries-guide.md +0 -0
  39. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-builder/skills/ruleset-builder/references/ruleset-yaml-reference.md +0 -0
  40. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-splitter/.claude-plugin/plugin.json +0 -0
  41. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/claude-skills/ruleset-splitter/skills/ruleset-splitter/SKILL.md +0 -0
  42. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/scripts/active_profile_env.py +0 -0
  43. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/scripts/bump_version.py +0 -0
  44. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/__init__.py +0 -0
  45. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/__init__.py +0 -0
  46. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/auth.py +0 -0
  47. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/discovery_config_libraries.py +0 -0
  48. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/discovery_configs.py +0 -0
  49. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/files.py +0 -0
  50. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/ifm.py +0 -0
  51. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/ruleset_libraries.py +0 -0
  52. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/rulesets.py +0 -0
  53. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/runs.py +0 -0
  54. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/seeds.py +0 -0
  55. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/system.py +0 -0
  56. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/commands/users.py +0 -0
  57. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/config.py +0 -0
  58. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/errors.py +0 -0
  59. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/output.py +0 -0
  60. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/protocols.py +0 -0
  61. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/src/datamasque_cli/py.typed +0 -0
  62. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/__init__.py +0 -0
  63. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/__init__.py +0 -0
  64. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_auth.py +0 -0
  65. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_catalog.py +0 -0
  66. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_discovery_config_libraries.py +0 -0
  67. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_discovery_configs.py +0 -0
  68. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_files.py +0 -0
  69. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_ifm.py +0 -0
  70. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_ruleset_libraries.py +0 -0
  71. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_rulesets.py +0 -0
  72. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_runs.py +0 -0
  73. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_seeds.py +0 -0
  74. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_system.py +0 -0
  75. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/commands/test_users.py +0 -0
  76. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/conftest.py +0 -0
  77. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/README.md +0 -0
  78. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/__init__.py +0 -0
  79. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/test_connections.py +0 -0
  80. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/test_discovery.py +0 -0
  81. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/test_discovery_configs.py +0 -0
  82. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/test_rulesets.py +0 -0
  83. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/test_runs.py +0 -0
  84. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/integration/test_system.py +0 -0
  85. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/test_client_auth.py +0 -0
  86. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/test_client_env.py +0 -0
  87. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/test_client_ifm.py +0 -0
  88. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/test_client_profile.py +0 -0
  89. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/test_config.py +0 -0
  90. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/test_main.py +0 -0
  91. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/test_output.py +0 -0
  92. {datamasque_cli-1.5.0 → datamasque_cli-1.6.0}/tests/test_version.py +0 -0
@@ -4,7 +4,6 @@ on:
4
4
  push:
5
5
  branches: [main]
6
6
  pull_request:
7
- branches: [main]
8
7
 
9
8
  concurrency:
10
9
  group: ci-${{ github.workflow }}-${{ github.ref }}
@@ -12,7 +11,7 @@ concurrency:
12
11
 
13
12
  jobs:
14
13
  lint:
15
- name: Lint (ruff)
14
+ name: Lint
16
15
  runs-on: ubuntu-latest
17
16
  steps:
18
17
  - uses: actions/checkout@v4
@@ -34,6 +33,10 @@ jobs:
34
33
  - name: ruff format --check
35
34
  run: uv run ruff format --check src tests
36
35
 
36
+ # Fails when `src` imports a package `pyproject.toml` does not declare.
37
+ - name: deptry
38
+ run: uv run deptry src
39
+
37
40
  typecheck:
38
41
  name: Typecheck (mypy)
39
42
  runs-on: ubuntu-latest
@@ -89,3 +92,22 @@ jobs:
89
92
  name: test-results-py${{ matrix.python-version }}
90
93
  path: report.xml
91
94
  retention-days: 7
95
+
96
+ install-smoke:
97
+ name: Fresh install smoke test
98
+ runs-on: ubuntu-latest
99
+ steps:
100
+ - uses: actions/checkout@v4
101
+
102
+ - name: Set up uv
103
+ uses: astral-sh/setup-uv@v5
104
+ with:
105
+ enable-cache: true
106
+
107
+ - name: Build
108
+ run: |
109
+ rm -rf dist
110
+ uv build
111
+
112
+ - name: Install wheel into a clean venv and run dm
113
+ run: ./scripts/installation_smoke_test.sh
@@ -25,11 +25,16 @@ jobs:
25
25
  echo "::notice title=TestPyPI version::${VERSION}"
26
26
 
27
27
  - name: Build
28
- run: uv build
28
+ run: |
29
+ rm -rf dist
30
+ uv build
29
31
 
30
32
  - name: Validate distributions
31
33
  run: uvx twine check dist/*
32
34
 
35
+ - name: Fresh install smoke test
36
+ run: ./scripts/installation_smoke_test.sh
37
+
33
38
  - name: Upload distributions
34
39
  uses: actions/upload-artifact@v4
35
40
  with:
@@ -32,7 +32,15 @@ jobs:
32
32
  fi
33
33
 
34
34
  - name: Build
35
- run: uv build
35
+ run: |
36
+ rm -rf dist
37
+ uv build
38
+
39
+ - name: Validate distributions
40
+ run: uvx twine check dist/*
41
+
42
+ - name: Fresh install smoke test
43
+ run: ./scripts/installation_smoke_test.sh
36
44
 
37
45
  - name: Upload distributions
38
46
  uses: actions/upload-artifact@v4
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.6.0
4
+
5
+ ### Added
6
+ - `dm table-references` — manage table references (`list`, `get`, `create`,
7
+ `update`, `delete`), the named pointers to identity data used for
8
+ cross-system consistent masking. `create` accepts `--file` for a full
9
+ JSON definition or `--name`/`--connection`/`--source` flags plus the
10
+ format/CSV options (`--format`, `--delimiter`, `--encoding`,
11
+ `--quotechar`, `--null-string`) for the common case, and is a
12
+ create-or-update like `dm connections create`; `update` changes only the
13
+ fields passed, preserving the reference's id.
14
+
15
+ ### Internal
16
+ - Extracted `resolve_connection` (name-or-ID lookup) into `client.py` and
17
+ routed `connections.py`'s `test`/`update` and `discover schema`/`discover
18
+ file` through it, replacing three separate inline copies.
19
+
20
+ ## v1.5.1
21
+
22
+ ### Added
23
+ - `dm discover schema-results` notes when a run holds Safe Data Preview results.
24
+ The table cannot show them, so the note points to `--json`.
25
+
26
+ ### Fixed
27
+ - A fresh install no longer fails when `typer` drops a package `dm` imports.
28
+ `rich` is now a declared dependency, and `typer` requires 0.16.0 or later.
29
+
3
30
  ## v1.5.0
4
31
 
5
32
  ### Added
@@ -1,10 +1,11 @@
1
- .PHONY: install lint format mypy test test-integration test-integration-local check build release-patch release-minor release-major
1
+ .PHONY: install lint format mypy test test-integration test-integration-local check build smoke release-patch release-minor release-major
2
2
 
3
3
  install:
4
4
  uv sync
5
5
 
6
6
  lint:
7
7
  uv run ruff check src/ tests/
8
+ uv run deptry src/
8
9
 
9
10
  format:
10
11
  uv run ruff format src/ tests/
@@ -25,7 +26,7 @@ test-integration:
25
26
  test-integration-local:
26
27
  @eval "$$(python3 scripts/active_profile_env.py)" && uv run pytest -m integration
27
28
 
28
- check: lint format-check mypy test
29
+ check: lint format-check mypy test smoke
29
30
 
30
31
  format-check:
31
32
  uv run ruff format --check src/ tests/
@@ -33,6 +34,12 @@ format-check:
33
34
  build:
34
35
  uv build
35
36
 
37
+ # Build the wheel and install it into a clean venv, as a user's machine would.
38
+ smoke:
39
+ rm -rf dist
40
+ uv build
41
+ ./scripts/installation_smoke_test.sh
42
+
36
43
  # Bump version, commit, tag, push — CI publishes automatically.
37
44
  # Usage: make release-patch (0.1.0 → 0.1.1)
38
45
  # make release-minor (0.1.0 → 0.2.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: datamasque-cli
3
- Version: 1.5.0
3
+ Version: 1.6.0
4
4
  Summary: Official command-line interface for the DataMasque data-masking platform.
5
5
  Project-URL: Homepage, https://datamasque.com/
6
6
  Project-URL: Repository, https://github.com/datamasque/datamasque-cli
@@ -23,10 +23,11 @@ Classifier: Topic :: Database
23
23
  Classifier: Topic :: Utilities
24
24
  Classifier: Typing :: Typed
25
25
  Requires-Python: >=3.11
26
- Requires-Dist: datamasque-python<2,>=1.2.3
26
+ Requires-Dist: datamasque-python<2,>=1.2.5
27
27
  Requires-Dist: pydantic<3,>=2.5
28
- Requires-Dist: tomli-w>=1.0.0
29
- Requires-Dist: typer>=0.15.0
28
+ Requires-Dist: rich>=13.8
29
+ Requires-Dist: tomli-w<2,>=1.0.0
30
+ Requires-Dist: typer<1,>=0.16.0
30
31
  Description-Content-Type: text/markdown
31
32
 
32
33
  # DataMasque CLI
@@ -198,6 +199,19 @@ dm libraries status <name> # Validation status; poll afte
198
199
  dm libraries usage <name> # Show rulesets using it
199
200
  ```
200
201
 
202
+ ### Table references
203
+
204
+ ```console
205
+ dm table-references list # id, name, connection (ID), source
206
+ dm table-references get <name> # Show full details
207
+ dm table-references create --file reference.json # Create/update from JSON — connection must be an ID, not a name
208
+ dm table-references create --name <name> --connection <name-or-id> --source <path-or-schema.table>
209
+ dm table-references create --name <name> --connection <name-or-id> --source data.csv --format parquet # Format is explicit, never inferred from --source
210
+ dm table-references update <name> --source <new-path> # Change selected fields, preserving the id
211
+ dm table-references update <name> --delimiter ';' --null-string NULL # Any CSV/format flag replaces options wholesale, not a merge
212
+ dm table-references delete <name> # Delete a table reference
213
+ ```
214
+
201
215
  ### In-flight masking
202
216
 
203
217
  The IFM service runs alongside the admin server,
@@ -167,6 +167,19 @@ dm libraries status <name> # Validation status; poll afte
167
167
  dm libraries usage <name> # Show rulesets using it
168
168
  ```
169
169
 
170
+ ### Table references
171
+
172
+ ```console
173
+ dm table-references list # id, name, connection (ID), source
174
+ dm table-references get <name> # Show full details
175
+ dm table-references create --file reference.json # Create/update from JSON — connection must be an ID, not a name
176
+ dm table-references create --name <name> --connection <name-or-id> --source <path-or-schema.table>
177
+ dm table-references create --name <name> --connection <name-or-id> --source data.csv --format parquet # Format is explicit, never inferred from --source
178
+ dm table-references update <name> --source <new-path> # Change selected fields, preserving the id
179
+ dm table-references update <name> --delimiter ';' --null-string NULL # Any CSV/format flag replaces options wholesale, not a merge
180
+ dm table-references delete <name> # Delete a table reference
181
+ ```
182
+
170
183
  ### In-flight masking
171
184
 
172
185
  The IFM service runs alongside the admin server,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: datamasque-cli
3
- description: Use when the user wants to interact with a DataMasque instance — start masking runs, check run status, list connections or rulesets, manage seeds, manage ruleset libraries, check system health, configure the AI Engine, or any task involving the DataMasque API. Triggers on "mask the data", "start a run", "check the run", "list connections", "list rulesets", "upload a seed", "check DataMasque health", "dm status", "ruleset library", "configure the AI Engine", "set the AI Engine URL", or any request to operate DataMasque programmatically.
3
+ description: Use when the user wants to interact with a DataMasque instance — start masking runs, check run status, list connections or rulesets, manage seeds, manage ruleset libraries, manage table references, check system health, configure the AI Engine, or any task involving the DataMasque API. Triggers on "mask the data", "start a run", "check the run", "list connections", "list rulesets", "upload a seed", "check DataMasque health", "dm status", "ruleset library", "table reference", "cross-system consistent masking", "configure the AI Engine", "set the AI Engine URL", or any request to operate DataMasque programmatically.
4
4
  argument-hint: e.g. "start a run with docx_masking on var_input_docx"
5
5
  user-invocable: true
6
6
  ---
@@ -113,3 +113,12 @@ Pass repeated `--options key=value` for server-side knobs
113
113
  `dm run start -c <x>`, `dm discover schema <x>`, etc. all try the name
114
114
  first and fall back to a UUID match. Prefer names for readability;
115
115
  reach for UUIDs only when names collide (rare).
116
+
117
+ - **Table references are the identity map behind cross-system consistent
118
+ masking.** `dm table-references create --name <n> --connection <c>
119
+ --source <path-or-schema.table>` registers one; a ruleset then addresses
120
+ it by name via the `table_reference` hash source in `hash_columns`
121
+ (`source_key`/`target_key`/`value`) — this CLI doesn't generate or
122
+ validate that ruleset syntax. `create` is create-or-update like
123
+ `dm connections create`; `--file`'s JSON needs a connection **ID**, not
124
+ a name, unlike the `--connection` flag.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "datamasque-cli"
3
- version = "1.5.0"
3
+ version = "1.6.0"
4
4
  description = "Official command-line interface for the DataMasque data-masking platform."
5
5
  authors = [
6
6
  { name = "DataMasque Ltd" },
@@ -10,9 +10,10 @@ license = "Apache-2.0"
10
10
  license-files = ["LICENSE"]
11
11
  requires-python = ">=3.11"
12
12
  dependencies = [
13
- "typer>=0.15.0",
14
- "tomli-w>=1.0.0",
15
- "datamasque-python>=1.2.3,<2",
13
+ "typer>=0.16.0,<1",
14
+ "rich>=13.8",
15
+ "tomli-w>=1.0.0,<2",
16
+ "datamasque-python>=1.2.5,<2",
16
17
  "pydantic>=2.5,<3",
17
18
  ]
18
19
  classifiers = [
@@ -46,6 +47,7 @@ dev = [
46
47
  "ruff>=0.9",
47
48
  "mypy>=1.10",
48
49
  "types-requests>=2.31",
50
+ "deptry>=0.25.1",
49
51
  ]
50
52
 
51
53
  [tool.ruff]
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+ # Tests that the built wheel installs into a clean venv and `dm` runs,
3
+ # resolving from PyPI as a user does rather than from `uv.lock`,
4
+ # which pins transitive packages and so hides undeclared imports.
5
+ #
6
+ # Does not test:
7
+ # - imports inside functions (deptry catches those)
8
+ # - platforms or Pythons other than Linux and 3.11
9
+ # - behaviour beyond startup
10
+ set -euo pipefail
11
+
12
+ VENV="$(mktemp -d)/smoke"
13
+
14
+ uv venv --python 3.11 "$VENV"
15
+ uv pip install --python "$VENV/bin/python" dist/*.whl
16
+ uv pip check --python "$VENV/bin/python"
17
+
18
+ # `dm --help` only imports what the entry path touches,
19
+ # so a module used by a single subcommand needs importing directly.
20
+ "$VENV/bin/python" -c '
21
+ import importlib
22
+ import pkgutil
23
+
24
+ import datamasque_cli
25
+
26
+ for module in pkgutil.walk_packages(datamasque_cli.__path__, "datamasque_cli."):
27
+ importlib.import_module(module.name)
28
+ '
29
+
30
+ "$VENV/bin/dm" --help
@@ -10,6 +10,7 @@ import os
10
10
 
11
11
  from datamasque.client import DataMasqueClient, DataMasqueIfmClient
12
12
  from datamasque.client.exceptions import DataMasqueApiError, DataMasqueTransportError, IfmAuthError
13
+ from datamasque.client.models.connection import ConnectionConfig
13
14
  from datamasque.client.models.dm_instance import DataMasqueInstanceConfig
14
15
  from datamasque.client.models.ifm import DataMasqueIfmInstanceConfig
15
16
 
@@ -212,3 +213,12 @@ def get_ifm_client(profile_name: str | None = None) -> DataMasqueIfmClient:
212
213
  extra_auth_excs=(IfmAuthError,),
213
214
  )
214
215
  return client
216
+
217
+
218
+ def resolve_connection(client: DataMasqueClient, name_or_id: str) -> ConnectionConfig:
219
+ """Resolve a connection by name or ID via the connection listing, aborting when not found."""
220
+ connections = client.list_connections()
221
+ match = next((c for c in connections if c.name == name_or_id or str(c.id) == name_or_id), None)
222
+ if match is None:
223
+ abort(f"Connection '{name_or_id}' not found.", code=ErrorCode.NOT_FOUND)
224
+ return match
@@ -20,8 +20,9 @@ from datamasque.client.models.connection import (
20
20
  S3ConnectionConfig,
21
21
  SnowflakeConnectionConfig,
22
22
  )
23
+ from pydantic import ValidationError
23
24
 
24
- from datamasque_cli.client import get_client
25
+ from datamasque_cli.client import get_client, resolve_connection
25
26
  from datamasque_cli.errors import ErrorCode, abort, abort_api_error, confirm_or_abort
26
27
  from datamasque_cli.fileio import read_json_object_or_abort
27
28
  from datamasque_cli.output import print_success, redact_sensitive_fields, render_output
@@ -218,7 +219,10 @@ def _create_from_file(client: DataMasqueClient, file: Path) -> None:
218
219
  data["database_type"] = DatabaseType(data["database_type"])
219
220
 
220
221
  klass = _CONNECTION_CLASSES[conn_type]
221
- config = klass(**data)
222
+ try:
223
+ config = klass(**data)
224
+ except ValidationError as exc:
225
+ abort(f"{file} does not match the expected format: {exc}", code=ErrorCode.INVALID_INPUT)
222
226
  client.create_or_update_connection(config)
223
227
  print_success(f"Connection '{config.name}' created/updated.")
224
228
 
@@ -298,10 +302,7 @@ def test_connection(
298
302
  success, a warning, or a hard failure.
299
303
  """
300
304
  client = get_client(profile)
301
-
302
- match = next((c for c in client.list_connections() if c.name == name or str(c.id) == name), None)
303
- if match is None:
304
- abort(f"Connection '{name}' not found.", code=ErrorCode.NOT_FOUND)
305
+ match = resolve_connection(client, name)
305
306
 
306
307
  try:
307
308
  response = client.make_request("POST", f"/api/connections/{match.id}/test/", data={})
@@ -334,10 +335,7 @@ def update_connection(
334
335
  references it stays intact. Pass only the fields that should change.
335
336
  """
336
337
  client = get_client(profile)
337
-
338
- match = next((c for c in client.list_connections() if c.name == name or str(c.id) == name), None)
339
- if match is None:
340
- abort(f"Connection '{name}' not found.", code=ErrorCode.NOT_FOUND)
338
+ match = resolve_connection(client, name)
341
339
 
342
340
  updates: dict[str, object] = {
343
341
  key: value
@@ -23,7 +23,7 @@ from datamasque.client.models.discovery import (
23
23
  from datamasque.client.models.discovery_config import DiscoveryConfigId, DiscoveryConfigType
24
24
  from datamasque.client.models.status import MaskingRunStatus
25
25
 
26
- from datamasque_cli.client import get_client
26
+ from datamasque_cli.client import get_client, resolve_connection
27
27
  from datamasque_cli.commands import discovery_config_libraries, discovery_configs
28
28
  from datamasque_cli.errors import (
29
29
  ErrorCode,
@@ -33,7 +33,7 @@ from datamasque_cli.errors import (
33
33
  require_id_or_abort,
34
34
  )
35
35
  from datamasque_cli.fileio import write_bytes_or_abort, write_text_or_abort
36
- from datamasque_cli.output import print_json, print_success, render_output, should_emit_json
36
+ from datamasque_cli.output import print_info, print_json, print_success, render_output, should_emit_json
37
37
 
38
38
  app = typer.Typer(help="Data discovery operations.", no_args_is_help=True)
39
39
  app.add_typer(discovery_configs.app, name="configs")
@@ -79,14 +79,6 @@ def _write_or_echo(content: str, output: Path | None, success_label: str) -> Non
79
79
  print_success(f"{success_label} written to {output}")
80
80
 
81
81
 
82
- def _resolve_connection_id(client: DataMasqueClient, name_or_id: str) -> str:
83
- """Resolve a connection name or ID to its UUID string."""
84
- match = next((c for c in client.list_connections() if c.name == name_or_id or str(c.id) == name_or_id), None)
85
- if match is None:
86
- abort(f"Connection '{name_or_id}' not found.", code=ErrorCode.NOT_FOUND)
87
- return str(match.id)
88
-
89
-
90
82
  def _resolve_discovery_config_id(
91
83
  client: DataMasqueClient, name: str, expected_type: DiscoveryConfigType
92
84
  ) -> DiscoveryConfigId:
@@ -126,7 +118,7 @@ def schema_discovery(
126
118
  (poll with `dm run status <run-id>`).
127
119
  """
128
120
  client = get_client(profile)
129
- conn_id = _resolve_connection_id(client, connection)
121
+ conn_id = str(resolve_connection(client, connection).id)
130
122
 
131
123
  try:
132
124
  if config is not None:
@@ -168,7 +160,7 @@ def start_file_discovery(
168
160
  (poll with `dm run status <run-id>`).
169
161
  """
170
162
  client = get_client(profile)
171
- conn_id = _resolve_connection_id(client, connection)
163
+ conn_id = str(resolve_connection(client, connection).id)
172
164
 
173
165
  try:
174
166
  if config is not None:
@@ -237,6 +229,8 @@ def schema_results(
237
229
  columns=["id", "schema", "table", "column", "data_type", "matches", "constraint"],
238
230
  title=f"Schema Discovery: Run {run_id}",
239
231
  )
232
+ if not should_emit_json(is_json) and any(row["safe_data_preview"] for row in data):
233
+ print_info("Safe Data Preview results are not shown in the table. Use --json to view them.")
240
234
 
241
235
 
242
236
  @app.command("sdd-report")