entropy-data 0.3.23__tar.gz → 0.3.24__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.
- {entropy_data-0.3.23 → entropy_data-0.3.24}/CHANGELOG.md +4 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/PKG-INFO +10 -2
- {entropy_data-0.3.23 → entropy_data-0.3.24}/README.md +9 -1
- {entropy_data-0.3.23 → entropy_data-0.3.24}/pyproject.toml +1 -1
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/cli.py +15 -3
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/client.py +20 -17
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/api_keys.py +1 -1
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/assets.py +6 -6
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/connection.py +2 -2
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/datacontract_branches.py +8 -8
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/datacontracts.py +2 -2
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/dataproducts.py +8 -8
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/git_credentials.py +2 -2
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/notification_channels.py +6 -6
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/organization.py +2 -2
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/semantic_branches.py +8 -10
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/settings.py +14 -14
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/sync.py +6 -7
- entropy_data-0.3.24/tests/test_timeout.py +79 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.dockerignore +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.editorconfig +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.github/dependabot.yml +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.github/pull_request_template.md +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.github/workflows/ci.yaml +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.github/workflows/dependabot-auto-merge.yaml +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.github/workflows/release.yaml +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.gitignore +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/.pre-commit-config.yaml +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/CLAUDE.md +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/Dockerfile +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/LICENSE +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/docs/apply-command-plan.md +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/release +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/__init__.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/__main__.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/__init__.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/access.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/certifications.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/classifications.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/connectors.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/costs.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/definitions.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/events.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/example_data.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/gitconnections.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/import_export.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/integrations.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/lineage.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/policies.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/schemas.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/search.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/semantics.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/sourcesystems.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/sync.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/tags.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/teams.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/test_results.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/usage.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/config.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/output.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/resources.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/util.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/__init__.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/__init__.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_access_request.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_api_keys.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_assets.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_classifications.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_connection.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_connectors.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_costs.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_datacontract_branches.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_datacontracts.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_dataproducts.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_email_templates.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_git_credentials.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_gitconnections.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_import_export.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_integrations.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_lineage.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_notification_channels.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_organization.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_policies.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_schemas.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_semantic_branches.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_semantics.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_settings.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_tags.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_team_roles.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_teams.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_test_results.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/commands/test_usage.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/conftest.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/test_cli.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/test_client.py +0 -0
- {entropy_data-0.3.23 → entropy_data-0.3.24}/tests/test_config.py +0 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.24]
|
|
4
|
+
|
|
5
|
+
- Add the global `--timeout <seconds>` option (or `ENTROPY_DATA_TIMEOUT`) to set how long every API request waits for a response. The default stays 30 seconds, and commands that already wait longer by themselves (`datacontracts test`, `datacontracts generate`) keep doing so unless `--timeout` is given. Replacing a branch with a large semantic ontology can take the server more than 30 seconds.
|
|
6
|
+
|
|
3
7
|
## [0.3.23]
|
|
4
8
|
|
|
5
9
|
- Add `entropy-data semantics branches` to work on branches of a semantic namespace: `list`, `create`, `get`, `put` (replace the branch with an OSI ontology YAML document, sent as written), `yaml`, `changes` (what the branch changes against the namespace, one entry per concept), `rebase`, `merge` and `delete`. `merge` lands the branch, or — where the namespace's git branch only takes reviewed changes — prints the pull/merge request opened from it, leaving the branch open. Requires semantic branches on the instance (entropy-data#1665).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: entropy-data
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.24
|
|
4
4
|
Summary: CLI for Entropy Data
|
|
5
5
|
Project-URL: Homepage, https://entropy-data.com
|
|
6
6
|
Project-URL: Documentation, https://docs.entropy-data.com
|
|
@@ -132,7 +132,7 @@ entropy-data semantics branches merge sales add-credit-limit
|
|
|
132
132
|
## Commands
|
|
133
133
|
|
|
134
134
|
```
|
|
135
|
-
entropy-data [--version] [--connection NAME] [--output table|json|yaml] [--debug]
|
|
135
|
+
entropy-data [--version] [--connection NAME] [--output table|json|yaml] [--debug] [--timeout SECONDS]
|
|
136
136
|
|
|
137
137
|
connection list | get | add | remove | set-default | test
|
|
138
138
|
dataproducts list | get | put | delete | import-from-git | star | unstar | star-status | stargazers | gitconnection ...
|
|
@@ -307,6 +307,14 @@ export ENTROPY_DATA_SYSTEM_TRUSTSTORE=1
|
|
|
307
307
|
|
|
308
308
|
This keeps certificate verification on while trusting the corporate root CA, and applies to every command that makes HTTPS requests.
|
|
309
309
|
|
|
310
|
+
### Timeouts
|
|
311
|
+
|
|
312
|
+
Each API request waits 30 seconds for a response by default (some commands wait longer, e.g. `datacontracts test`). Large documents, such as a semantic ontology with a thousand concepts, can take the server longer. Use the global `--timeout` option, or `ENTROPY_DATA_TIMEOUT`, to wait longer; it applies to every request of the invocation:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
entropy-data --timeout 120 semantics branches put sales add-credit-limit --file ontology.yaml
|
|
316
|
+
```
|
|
317
|
+
|
|
310
318
|
## Development
|
|
311
319
|
|
|
312
320
|
```bash
|
|
@@ -99,7 +99,7 @@ entropy-data semantics branches merge sales add-credit-limit
|
|
|
99
99
|
## Commands
|
|
100
100
|
|
|
101
101
|
```
|
|
102
|
-
entropy-data [--version] [--connection NAME] [--output table|json|yaml] [--debug]
|
|
102
|
+
entropy-data [--version] [--connection NAME] [--output table|json|yaml] [--debug] [--timeout SECONDS]
|
|
103
103
|
|
|
104
104
|
connection list | get | add | remove | set-default | test
|
|
105
105
|
dataproducts list | get | put | delete | import-from-git | star | unstar | star-status | stargazers | gitconnection ...
|
|
@@ -274,6 +274,14 @@ export ENTROPY_DATA_SYSTEM_TRUSTSTORE=1
|
|
|
274
274
|
|
|
275
275
|
This keeps certificate verification on while trusting the corporate root CA, and applies to every command that makes HTTPS requests.
|
|
276
276
|
|
|
277
|
+
### Timeouts
|
|
278
|
+
|
|
279
|
+
Each API request waits 30 seconds for a response by default (some commands wait longer, e.g. `datacontracts test`). Large documents, such as a semantic ontology with a thousand concepts, can take the server longer. Use the global `--timeout` option, or `ENTROPY_DATA_TIMEOUT`, to wait longer; it applies to every request of the invocation:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
entropy-data --timeout 120 semantics branches put sales add-credit-limit --file ontology.yaml
|
|
283
|
+
```
|
|
284
|
+
|
|
277
285
|
## Development
|
|
278
286
|
|
|
279
287
|
```bash
|
|
@@ -19,6 +19,7 @@ _cli_api_key: str | None = None
|
|
|
19
19
|
_cli_host: str | None = None
|
|
20
20
|
_output_format: OutputFormat = OutputFormat.table
|
|
21
21
|
_debug: bool = False
|
|
22
|
+
_timeout: int | None = None
|
|
22
23
|
|
|
23
24
|
error_console = Console(stderr=True)
|
|
24
25
|
|
|
@@ -30,7 +31,7 @@ def get_client() -> EntropyDataClient:
|
|
|
30
31
|
cli_api_key=_cli_api_key,
|
|
31
32
|
cli_host=_cli_host,
|
|
32
33
|
)
|
|
33
|
-
return EntropyDataClient(config)
|
|
34
|
+
return EntropyDataClient(config, timeout=_timeout)
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
def client_for_connection(name: str) -> EntropyDataClient:
|
|
@@ -40,7 +41,7 @@ def client_for_connection(name: str) -> EntropyDataClient:
|
|
|
40
41
|
target the primary connection and must not bleed into a second endpoint.
|
|
41
42
|
"""
|
|
42
43
|
config = resolve_connection(connection_name=name)
|
|
43
|
-
return EntropyDataClient(config)
|
|
44
|
+
return EntropyDataClient(config, timeout=_timeout)
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
def get_output_format() -> OutputFormat:
|
|
@@ -99,6 +100,16 @@ def main(
|
|
|
99
100
|
host: Annotated[Optional[str], typer.Option("--host", help="API host URL (overrides config and env).")] = None,
|
|
100
101
|
output: Annotated[OutputFormat, typer.Option("--output", "-o", help="Output format.")] = OutputFormat.table,
|
|
101
102
|
debug: Annotated[bool, typer.Option("--debug", help="Enable debug output.")] = False,
|
|
103
|
+
timeout: Annotated[
|
|
104
|
+
Optional[int],
|
|
105
|
+
typer.Option(
|
|
106
|
+
"--timeout",
|
|
107
|
+
min=1,
|
|
108
|
+
help="Seconds to wait for each API response (default 30, or longer where a command needs it, "
|
|
109
|
+
"e.g. datacontracts test). Raise it for large documents such as a whole semantic ontology.",
|
|
110
|
+
envvar="ENTROPY_DATA_TIMEOUT",
|
|
111
|
+
),
|
|
112
|
+
] = None,
|
|
102
113
|
system_truststore: Annotated[
|
|
103
114
|
bool,
|
|
104
115
|
typer.Option(
|
|
@@ -110,13 +121,14 @@ def main(
|
|
|
110
121
|
] = False,
|
|
111
122
|
) -> None:
|
|
112
123
|
"""Entropy Data CLI — manage your data platform from the command line."""
|
|
113
|
-
global _connection_name, _cli_api_key, _cli_host, _output_format, _debug
|
|
124
|
+
global _connection_name, _cli_api_key, _cli_host, _output_format, _debug, _timeout
|
|
114
125
|
load_dotenv()
|
|
115
126
|
_connection_name = connection
|
|
116
127
|
_cli_api_key = api_key
|
|
117
128
|
_cli_host = host
|
|
118
129
|
_output_format = output
|
|
119
130
|
_debug = debug
|
|
131
|
+
_timeout = timeout
|
|
120
132
|
if debug:
|
|
121
133
|
logging.basicConfig(level=logging.DEBUG, stream=sys.stderr)
|
|
122
134
|
if system_truststore:
|
|
@@ -77,8 +77,11 @@ def _validate_page(page: int) -> None:
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
class EntropyDataClient:
|
|
80
|
-
def __init__(self, config: ConnectionConfig):
|
|
80
|
+
def __init__(self, config: ConnectionConfig, timeout: int | None = None):
|
|
81
81
|
self.base_url = config.host.rstrip("/")
|
|
82
|
+
# An explicit --timeout also overrides the longer waits some commands choose for themselves.
|
|
83
|
+
self.timeout_override = timeout
|
|
84
|
+
self.timeout = timeout or REQUEST_TIMEOUT
|
|
82
85
|
self.session = requests.Session()
|
|
83
86
|
self.session.headers.update(
|
|
84
87
|
{
|
|
@@ -91,14 +94,14 @@ class EntropyDataClient:
|
|
|
91
94
|
"""GET /api/{path}. Returns (items, has_next_page)."""
|
|
92
95
|
if params and "p" in params:
|
|
93
96
|
_validate_page(int(params["p"]))
|
|
94
|
-
response = self.session.get(f"{self.base_url}/api/{path}", params=params, timeout=
|
|
97
|
+
response = self.session.get(f"{self.base_url}/api/{path}", params=params, timeout=self.timeout)
|
|
95
98
|
_raise_for_status(response)
|
|
96
99
|
return response.json(), _has_next_page(response)
|
|
97
100
|
|
|
98
101
|
def get_resource(self, path: str, resource_id: str) -> dict:
|
|
99
102
|
"""GET /api/{path}/{id}."""
|
|
100
103
|
_validate_resource_id(resource_id)
|
|
101
|
-
response = self.session.get(f"{self.base_url}/api/{path}/{resource_id}", timeout=
|
|
104
|
+
response = self.session.get(f"{self.base_url}/api/{path}/{resource_id}", timeout=self.timeout)
|
|
102
105
|
_raise_for_status(response)
|
|
103
106
|
return response.json()
|
|
104
107
|
|
|
@@ -107,20 +110,20 @@ class EntropyDataClient:
|
|
|
107
110
|
_validate_resource_id(resource_id)
|
|
108
111
|
if "id" in body and body["id"] != resource_id:
|
|
109
112
|
body = {**body, "id": resource_id}
|
|
110
|
-
response = self.session.put(f"{self.base_url}/api/{path}/{resource_id}", json=body, timeout=
|
|
113
|
+
response = self.session.put(f"{self.base_url}/api/{path}/{resource_id}", json=body, timeout=self.timeout)
|
|
111
114
|
_raise_for_status(response)
|
|
112
115
|
return response.headers.get(RESPONSE_HEADER_LOCATION_HTML)
|
|
113
116
|
|
|
114
117
|
def delete_resource(self, path: str, resource_id: str) -> None:
|
|
115
118
|
"""DELETE /api/{path}/{id}."""
|
|
116
119
|
_validate_resource_id(resource_id)
|
|
117
|
-
response = self.session.delete(f"{self.base_url}/api/{path}/{resource_id}", timeout=
|
|
120
|
+
response = self.session.delete(f"{self.base_url}/api/{path}/{resource_id}", timeout=self.timeout)
|
|
118
121
|
_raise_for_status(response)
|
|
119
122
|
|
|
120
123
|
def post_action(self, path: str, resource_id: str, action: str) -> str | None:
|
|
121
124
|
"""POST /api/{path}/{id}/{action}. Returns location-html URL if present."""
|
|
122
125
|
_validate_resource_id(resource_id)
|
|
123
|
-
response = self.session.post(f"{self.base_url}/api/{path}/{resource_id}/{action}", timeout=
|
|
126
|
+
response = self.session.post(f"{self.base_url}/api/{path}/{resource_id}/{action}", timeout=self.timeout)
|
|
124
127
|
_raise_for_status(response)
|
|
125
128
|
return response.headers.get(RESPONSE_HEADER_LOCATION_HTML)
|
|
126
129
|
|
|
@@ -131,7 +134,7 @@ class EntropyDataClient:
|
|
|
131
134
|
action: str,
|
|
132
135
|
params: dict | None = None,
|
|
133
136
|
body: dict | None = None,
|
|
134
|
-
timeout: int =
|
|
137
|
+
timeout: int | None = None,
|
|
135
138
|
) -> dict:
|
|
136
139
|
"""POST /api/{path}/{id}/{action}. Returns response JSON."""
|
|
137
140
|
_validate_resource_id(resource_id)
|
|
@@ -139,20 +142,20 @@ class EntropyDataClient:
|
|
|
139
142
|
f"{self.base_url}/api/{path}/{resource_id}/{action}",
|
|
140
143
|
params=params,
|
|
141
144
|
json=body if body is not None else None,
|
|
142
|
-
timeout=timeout,
|
|
145
|
+
timeout=self.timeout_override or timeout or self.timeout,
|
|
143
146
|
)
|
|
144
147
|
_raise_for_status(response)
|
|
145
148
|
return response.json()
|
|
146
149
|
|
|
147
150
|
def post_resource(self, path: str, body: dict, params: dict | None = None) -> str | None:
|
|
148
151
|
"""POST /api/{path}. Returns location-html URL if present."""
|
|
149
|
-
response = self.session.post(f"{self.base_url}/api/{path}", json=body, params=params, timeout=
|
|
152
|
+
response = self.session.post(f"{self.base_url}/api/{path}", json=body, params=params, timeout=self.timeout)
|
|
150
153
|
_raise_for_status(response)
|
|
151
154
|
return response.headers.get(RESPONSE_HEADER_LOCATION_HTML)
|
|
152
155
|
|
|
153
156
|
def delete_resources(self, path: str, params: dict | None = None) -> dict:
|
|
154
157
|
"""DELETE /api/{path} with query params. Returns response JSON."""
|
|
155
|
-
response = self.session.delete(f"{self.base_url}/api/{path}", params=params, timeout=
|
|
158
|
+
response = self.session.delete(f"{self.base_url}/api/{path}", params=params, timeout=self.timeout)
|
|
156
159
|
_raise_for_status(response)
|
|
157
160
|
try:
|
|
158
161
|
return response.json()
|
|
@@ -164,7 +167,7 @@ class EntropyDataClient:
|
|
|
164
167
|
params = {}
|
|
165
168
|
if last_event_id:
|
|
166
169
|
params["lastEventId"] = last_event_id
|
|
167
|
-
response = self.session.get(f"{self.base_url}/api/events", params=params, timeout=
|
|
170
|
+
response = self.session.get(f"{self.base_url}/api/events", params=params, timeout=self.timeout)
|
|
168
171
|
_raise_for_status(response)
|
|
169
172
|
return response.json()
|
|
170
173
|
|
|
@@ -173,7 +176,7 @@ class EntropyDataClient:
|
|
|
173
176
|
_validate_resource_id(resource_id)
|
|
174
177
|
response = self.session.get(
|
|
175
178
|
f"{self.base_url}/api/{path}/{resource_id}/gitconnection",
|
|
176
|
-
timeout=
|
|
179
|
+
timeout=self.timeout,
|
|
177
180
|
)
|
|
178
181
|
_raise_for_status(response)
|
|
179
182
|
return response.json()
|
|
@@ -184,7 +187,7 @@ class EntropyDataClient:
|
|
|
184
187
|
response = self.session.put(
|
|
185
188
|
f"{self.base_url}/api/{path}/{resource_id}/gitconnection",
|
|
186
189
|
json=body,
|
|
187
|
-
timeout=
|
|
190
|
+
timeout=self.timeout,
|
|
188
191
|
)
|
|
189
192
|
_raise_for_status(response)
|
|
190
193
|
return response.json()
|
|
@@ -194,7 +197,7 @@ class EntropyDataClient:
|
|
|
194
197
|
_validate_resource_id(resource_id)
|
|
195
198
|
response = self.session.delete(
|
|
196
199
|
f"{self.base_url}/api/{path}/{resource_id}/gitconnection",
|
|
197
|
-
timeout=
|
|
200
|
+
timeout=self.timeout,
|
|
198
201
|
)
|
|
199
202
|
_raise_for_status(response)
|
|
200
203
|
|
|
@@ -210,7 +213,7 @@ class EntropyDataClient:
|
|
|
210
213
|
response = self.session.post(
|
|
211
214
|
f"{self.base_url}/api/{path}/{resource_id}/gitconnection/{action}",
|
|
212
215
|
json=body if body is not None else None,
|
|
213
|
-
timeout=
|
|
216
|
+
timeout=self.timeout,
|
|
214
217
|
)
|
|
215
218
|
_raise_for_status(response)
|
|
216
219
|
return response.json()
|
|
@@ -225,13 +228,13 @@ class EntropyDataClient:
|
|
|
225
228
|
if version is not None and not _SCHEMA_VERSION_PATTERN.match(version):
|
|
226
229
|
raise ValueError(f"Invalid schema version '{version}'. Expected a version like 3.1.0.")
|
|
227
230
|
filename = f"{spec}{f'-{version}' if version else ''}{'-custom' if custom else ''}.schema.json"
|
|
228
|
-
response = self.session.get(f"{self.base_url}/api/schemas/{filename}", timeout=
|
|
231
|
+
response = self.session.get(f"{self.base_url}/api/schemas/{filename}", timeout=self.timeout)
|
|
229
232
|
_raise_for_status(response)
|
|
230
233
|
return response.text, response.headers.get("X-Schema-Version")
|
|
231
234
|
|
|
232
235
|
def search(self, query: str, **params) -> dict:
|
|
233
236
|
"""GET /api/search."""
|
|
234
237
|
params["query"] = query
|
|
235
|
-
response = self.session.get(f"{self.base_url}/api/search", params=params, timeout=
|
|
238
|
+
response = self.session.get(f"{self.base_url}/api/search", params=params, timeout=self.timeout)
|
|
236
239
|
_raise_for_status(response)
|
|
237
240
|
return response.json()
|
|
@@ -96,7 +96,7 @@ def list_asset_tags(
|
|
|
96
96
|
) -> None:
|
|
97
97
|
"""List tags assigned to an asset."""
|
|
98
98
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
99
|
-
from entropy_data.client import
|
|
99
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
100
100
|
|
|
101
101
|
fmt = output or get_output_format()
|
|
102
102
|
try:
|
|
@@ -104,7 +104,7 @@ def list_asset_tags(
|
|
|
104
104
|
_validate_resource_id(asset_id)
|
|
105
105
|
response = client.session.get(
|
|
106
106
|
f"{client.base_url}/api/assets/{asset_id}/assigned-tags",
|
|
107
|
-
timeout=
|
|
107
|
+
timeout=client.timeout,
|
|
108
108
|
)
|
|
109
109
|
_raise_for_status(response)
|
|
110
110
|
data = response.json()
|
|
@@ -124,7 +124,7 @@ def add_asset_tag(
|
|
|
124
124
|
) -> None:
|
|
125
125
|
"""Assign a tag to an asset."""
|
|
126
126
|
from entropy_data.cli import get_client, handle_error
|
|
127
|
-
from entropy_data.client import
|
|
127
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
128
128
|
|
|
129
129
|
try:
|
|
130
130
|
client = get_client()
|
|
@@ -133,7 +133,7 @@ def add_asset_tag(
|
|
|
133
133
|
# path-traversal-rejecting validator; the server validates anyway.
|
|
134
134
|
response = client.session.put(
|
|
135
135
|
f"{client.base_url}/api/assets/{asset_id}/assigned-tags/{tag_id}",
|
|
136
|
-
timeout=
|
|
136
|
+
timeout=client.timeout,
|
|
137
137
|
)
|
|
138
138
|
_raise_for_status(response)
|
|
139
139
|
print_success(f"Tag '{tag_id}' assigned to asset '{asset_id}'.")
|
|
@@ -148,14 +148,14 @@ def remove_asset_tag(
|
|
|
148
148
|
) -> None:
|
|
149
149
|
"""Unassign a tag from an asset."""
|
|
150
150
|
from entropy_data.cli import get_client, handle_error
|
|
151
|
-
from entropy_data.client import
|
|
151
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
152
152
|
|
|
153
153
|
try:
|
|
154
154
|
client = get_client()
|
|
155
155
|
_validate_resource_id(asset_id)
|
|
156
156
|
response = client.session.delete(
|
|
157
157
|
f"{client.base_url}/api/assets/{asset_id}/assigned-tags/{tag_id}",
|
|
158
|
-
timeout=
|
|
158
|
+
timeout=client.timeout,
|
|
159
159
|
)
|
|
160
160
|
_raise_for_status(response)
|
|
161
161
|
print_success(f"Tag '{tag_id}' removed from asset '{asset_id}'.")
|
|
@@ -24,13 +24,13 @@ def _fetch_vanity_url(api_key: str, host: str) -> str | None:
|
|
|
24
24
|
Returns None on any failure (older server, network error, etc.) so callers
|
|
25
25
|
can fall back to None instead of failing the whole `connection add`.
|
|
26
26
|
"""
|
|
27
|
-
from entropy_data.client import
|
|
27
|
+
from entropy_data.client import EntropyDataClient
|
|
28
28
|
|
|
29
29
|
try:
|
|
30
30
|
client = EntropyDataClient(cfg.ConnectionConfig(api_key=api_key, host=host))
|
|
31
31
|
response = client.session.get(
|
|
32
32
|
f"{client.base_url}/api/organization/settings",
|
|
33
|
-
timeout=
|
|
33
|
+
timeout=client.timeout,
|
|
34
34
|
)
|
|
35
35
|
if response.ok:
|
|
36
36
|
return response.json().get("vanityUrl")
|
{entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/datacontract_branches.py
RENAMED
|
@@ -63,12 +63,12 @@ def create_branch(
|
|
|
63
63
|
) -> None:
|
|
64
64
|
"""Cut a branch from a data contract. The branch starts as a copy of the data contract."""
|
|
65
65
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
66
|
-
from entropy_data.client import
|
|
66
|
+
from entropy_data.client import _raise_for_status
|
|
67
67
|
|
|
68
68
|
fmt = output or get_output_format()
|
|
69
69
|
try:
|
|
70
70
|
client = get_client()
|
|
71
|
-
response = client.session.put(f"{client.base_url}/api/{branch_path(id, branch)}", timeout=
|
|
71
|
+
response = client.session.put(f"{client.base_url}/api/{branch_path(id, branch)}", timeout=client.timeout)
|
|
72
72
|
_raise_for_status(response)
|
|
73
73
|
if fmt == OutputFormat.table:
|
|
74
74
|
print_success(f"Branch '{branch}' of data contract '{id}' created.")
|
|
@@ -122,14 +122,14 @@ def yaml_branch(
|
|
|
122
122
|
) -> None:
|
|
123
123
|
"""Get the branch's document as ODCS YAML."""
|
|
124
124
|
from entropy_data.cli import get_client, handle_error
|
|
125
|
-
from entropy_data.client import
|
|
125
|
+
from entropy_data.client import _raise_for_status
|
|
126
126
|
|
|
127
127
|
try:
|
|
128
128
|
client = get_client()
|
|
129
129
|
response = client.session.get(
|
|
130
130
|
f"{client.base_url}/api/{branch_path(id, branch)}/datacontract.yaml",
|
|
131
131
|
headers={"Accept": "application/yaml"},
|
|
132
|
-
timeout=
|
|
132
|
+
timeout=client.timeout,
|
|
133
133
|
)
|
|
134
134
|
_raise_for_status(response)
|
|
135
135
|
if out_file is not None:
|
|
@@ -149,7 +149,7 @@ def put_branch(
|
|
|
149
149
|
) -> None:
|
|
150
150
|
"""Replace the branch's document with an ODCS YAML file. The data contract itself is untouched."""
|
|
151
151
|
from entropy_data.cli import get_client, handle_error
|
|
152
|
-
from entropy_data.client import
|
|
152
|
+
from entropy_data.client import _raise_for_status
|
|
153
153
|
|
|
154
154
|
try:
|
|
155
155
|
content = read_text(file)
|
|
@@ -158,7 +158,7 @@ def put_branch(
|
|
|
158
158
|
f"{client.base_url}/api/{branch_path(id, branch)}/datacontract.yaml",
|
|
159
159
|
data=content.encode("utf-8"),
|
|
160
160
|
headers={"Content-Type": "application/yaml"},
|
|
161
|
-
timeout=
|
|
161
|
+
timeout=client.timeout,
|
|
162
162
|
)
|
|
163
163
|
_raise_for_status(response)
|
|
164
164
|
print_success(f"Branch '{branch}' of data contract '{id}' updated.")
|
|
@@ -233,7 +233,7 @@ def merge_branch(
|
|
|
233
233
|
) -> None:
|
|
234
234
|
"""Merge the branch: land it on the data contract, or open a pull request from it."""
|
|
235
235
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
236
|
-
from entropy_data.client import
|
|
236
|
+
from entropy_data.client import _raise_for_status
|
|
237
237
|
|
|
238
238
|
if route is not None and route not in MERGE_ROUTES:
|
|
239
239
|
raise typer.BadParameter(f"Must be one of: {', '.join(MERGE_ROUTES)}", param_hint="--route")
|
|
@@ -247,7 +247,7 @@ def merge_branch(
|
|
|
247
247
|
try:
|
|
248
248
|
client = get_client()
|
|
249
249
|
response = client.session.post(
|
|
250
|
-
f"{client.base_url}/api/{branch_path(id, branch)}/merge", json=body, timeout=
|
|
250
|
+
f"{client.base_url}/api/{branch_path(id, branch)}/merge", json=body, timeout=client.timeout
|
|
251
251
|
)
|
|
252
252
|
_raise_for_status(response)
|
|
253
253
|
if response.status_code == 204:
|
|
@@ -149,7 +149,7 @@ def yaml_datacontract(
|
|
|
149
149
|
) -> None:
|
|
150
150
|
"""Get a data contract as ODCS YAML."""
|
|
151
151
|
from entropy_data.cli import get_client, handle_error
|
|
152
|
-
from entropy_data.client import
|
|
152
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
153
153
|
|
|
154
154
|
try:
|
|
155
155
|
client = get_client()
|
|
@@ -157,7 +157,7 @@ def yaml_datacontract(
|
|
|
157
157
|
response = client.session.get(
|
|
158
158
|
f"{client.base_url}/api/datacontracts/{id}/{_branch_action(branch, 'datacontract.yaml')}",
|
|
159
159
|
headers={"Accept": "application/yaml"},
|
|
160
|
-
timeout=
|
|
160
|
+
timeout=client.timeout,
|
|
161
161
|
)
|
|
162
162
|
_raise_for_status(response)
|
|
163
163
|
if out_file is not None:
|
|
@@ -152,14 +152,14 @@ def star_dataproduct(
|
|
|
152
152
|
) -> None:
|
|
153
153
|
"""Star a data product (requires a user-scoped API key)."""
|
|
154
154
|
from entropy_data.cli import get_client, handle_error
|
|
155
|
-
from entropy_data.client import
|
|
155
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
156
156
|
|
|
157
157
|
try:
|
|
158
158
|
client = get_client()
|
|
159
159
|
_validate_resource_id(id)
|
|
160
160
|
response = client.session.put(
|
|
161
161
|
f"{client.base_url}/api/{RESOURCE_PATH}/{id}/star",
|
|
162
|
-
timeout=
|
|
162
|
+
timeout=client.timeout,
|
|
163
163
|
)
|
|
164
164
|
_raise_for_status(response)
|
|
165
165
|
print_success(f"Starred data product '{id}'.")
|
|
@@ -173,14 +173,14 @@ def unstar_dataproduct(
|
|
|
173
173
|
) -> None:
|
|
174
174
|
"""Remove your star from a data product (requires a user-scoped API key)."""
|
|
175
175
|
from entropy_data.cli import get_client, handle_error
|
|
176
|
-
from entropy_data.client import
|
|
176
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
177
177
|
|
|
178
178
|
try:
|
|
179
179
|
client = get_client()
|
|
180
180
|
_validate_resource_id(id)
|
|
181
181
|
response = client.session.delete(
|
|
182
182
|
f"{client.base_url}/api/{RESOURCE_PATH}/{id}/star",
|
|
183
|
-
timeout=
|
|
183
|
+
timeout=client.timeout,
|
|
184
184
|
)
|
|
185
185
|
_raise_for_status(response)
|
|
186
186
|
print_success(f"Unstarred data product '{id}'.")
|
|
@@ -195,7 +195,7 @@ def star_status_dataproduct(
|
|
|
195
195
|
) -> None:
|
|
196
196
|
"""Show the star count and whether you starred a data product."""
|
|
197
197
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
198
|
-
from entropy_data.client import
|
|
198
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
199
199
|
|
|
200
200
|
fmt = output or get_output_format()
|
|
201
201
|
try:
|
|
@@ -203,7 +203,7 @@ def star_status_dataproduct(
|
|
|
203
203
|
_validate_resource_id(id)
|
|
204
204
|
response = client.session.get(
|
|
205
205
|
f"{client.base_url}/api/{RESOURCE_PATH}/{id}/star",
|
|
206
|
-
timeout=
|
|
206
|
+
timeout=client.timeout,
|
|
207
207
|
)
|
|
208
208
|
_raise_for_status(response)
|
|
209
209
|
print_resource(response.json(), "star-status", fmt)
|
|
@@ -218,7 +218,7 @@ def stargazers_dataproduct(
|
|
|
218
218
|
) -> None:
|
|
219
219
|
"""List the users who starred a data product (organization owners only)."""
|
|
220
220
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
221
|
-
from entropy_data.client import
|
|
221
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
222
222
|
|
|
223
223
|
fmt = output or get_output_format()
|
|
224
224
|
try:
|
|
@@ -226,7 +226,7 @@ def stargazers_dataproduct(
|
|
|
226
226
|
_validate_resource_id(id)
|
|
227
227
|
response = client.session.get(
|
|
228
228
|
f"{client.base_url}/api/{RESOURCE_PATH}/{id}/stargazers",
|
|
229
|
-
timeout=
|
|
229
|
+
timeout=client.timeout,
|
|
230
230
|
)
|
|
231
231
|
_raise_for_status(response)
|
|
232
232
|
print_resource_list(response.json(), "stargazers", fmt)
|
|
@@ -369,7 +369,7 @@ def _create_credential(
|
|
|
369
369
|
bitbucket_username: Optional[str],
|
|
370
370
|
) -> None:
|
|
371
371
|
from entropy_data.cli import get_client, handle_error
|
|
372
|
-
from entropy_data.client import
|
|
372
|
+
from entropy_data.client import _raise_for_status
|
|
373
373
|
|
|
374
374
|
if git_connection_type and git_connection_type not in GIT_CONNECTION_TYPES:
|
|
375
375
|
raise typer.BadParameter(
|
|
@@ -394,7 +394,7 @@ def _create_credential(
|
|
|
394
394
|
response = client.session.post(
|
|
395
395
|
f"{client.base_url}/api/{_base_path(scope, team_id)}",
|
|
396
396
|
json=body,
|
|
397
|
-
timeout=
|
|
397
|
+
timeout=client.timeout,
|
|
398
398
|
)
|
|
399
399
|
_raise_for_status(response)
|
|
400
400
|
data = response.json()
|
{entropy_data-0.3.23 → entropy_data-0.3.24}/src/entropy_data/commands/notification_channels.py
RENAMED
|
@@ -23,14 +23,14 @@ def get_channel(
|
|
|
23
23
|
) -> None:
|
|
24
24
|
"""Get a team's notification channel."""
|
|
25
25
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
26
|
-
from entropy_data.client import
|
|
26
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
27
27
|
|
|
28
28
|
fmt = output or get_output_format()
|
|
29
29
|
try:
|
|
30
30
|
client = get_client()
|
|
31
31
|
_validate_resource_id(team_id)
|
|
32
32
|
_validate_resource_id(channel_id)
|
|
33
|
-
response = client.session.get(_channel_url(client, team_id, channel_id), timeout=
|
|
33
|
+
response = client.session.get(_channel_url(client, team_id, channel_id), timeout=client.timeout)
|
|
34
34
|
_raise_for_status(response)
|
|
35
35
|
data = response.json()
|
|
36
36
|
print_data(data, fmt)
|
|
@@ -46,7 +46,7 @@ def put_channel(
|
|
|
46
46
|
) -> None:
|
|
47
47
|
"""Create or update a team's notification channel."""
|
|
48
48
|
from entropy_data.cli import get_client, handle_error
|
|
49
|
-
from entropy_data.client import
|
|
49
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
50
50
|
|
|
51
51
|
try:
|
|
52
52
|
body = read_body(file)
|
|
@@ -56,7 +56,7 @@ def put_channel(
|
|
|
56
56
|
response = client.session.put(
|
|
57
57
|
_channel_url(client, team_id, channel_id),
|
|
58
58
|
json=body,
|
|
59
|
-
timeout=
|
|
59
|
+
timeout=client.timeout,
|
|
60
60
|
)
|
|
61
61
|
_raise_for_status(response)
|
|
62
62
|
print_success(f"Notification channel '{channel_id}' saved for team '{team_id}'.")
|
|
@@ -71,13 +71,13 @@ def delete_channel(
|
|
|
71
71
|
) -> None:
|
|
72
72
|
"""Delete a team's notification channel."""
|
|
73
73
|
from entropy_data.cli import get_client, handle_error
|
|
74
|
-
from entropy_data.client import
|
|
74
|
+
from entropy_data.client import _raise_for_status, _validate_resource_id
|
|
75
75
|
|
|
76
76
|
try:
|
|
77
77
|
client = get_client()
|
|
78
78
|
_validate_resource_id(team_id)
|
|
79
79
|
_validate_resource_id(channel_id)
|
|
80
|
-
response = client.session.delete(_channel_url(client, team_id, channel_id), timeout=
|
|
80
|
+
response = client.session.delete(_channel_url(client, team_id, channel_id), timeout=client.timeout)
|
|
81
81
|
_raise_for_status(response)
|
|
82
82
|
print_success(f"Notification channel '{channel_id}' deleted for team '{team_id}'.")
|
|
83
83
|
except Exception as e:
|
|
@@ -17,14 +17,14 @@ def get_organization(
|
|
|
17
17
|
) -> None:
|
|
18
18
|
"""Get settings of the organization the current API key is bound to."""
|
|
19
19
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
20
|
-
from entropy_data.client import
|
|
20
|
+
from entropy_data.client import _raise_for_status
|
|
21
21
|
|
|
22
22
|
fmt = output or get_output_format()
|
|
23
23
|
try:
|
|
24
24
|
client = get_client()
|
|
25
25
|
response = client.session.get(
|
|
26
26
|
f"{client.base_url}/api/organization/settings",
|
|
27
|
-
timeout=
|
|
27
|
+
timeout=client.timeout,
|
|
28
28
|
)
|
|
29
29
|
_raise_for_status(response)
|
|
30
30
|
data = response.json()
|
|
@@ -61,14 +61,12 @@ def create_branch(
|
|
|
61
61
|
) -> None:
|
|
62
62
|
"""Cut a branch from a namespace. Cutting an existing name returns that branch."""
|
|
63
63
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
64
|
-
from entropy_data.client import
|
|
64
|
+
from entropy_data.client import _raise_for_status
|
|
65
65
|
|
|
66
66
|
fmt = output or get_output_format()
|
|
67
67
|
try:
|
|
68
68
|
client = get_client()
|
|
69
|
-
response = client.session.put(
|
|
70
|
-
f"{client.base_url}/api/{branch_path(namespace, branch)}", timeout=REQUEST_TIMEOUT
|
|
71
|
-
)
|
|
69
|
+
response = client.session.put(f"{client.base_url}/api/{branch_path(namespace, branch)}", timeout=client.timeout)
|
|
72
70
|
_raise_for_status(response)
|
|
73
71
|
if fmt == OutputFormat.table:
|
|
74
72
|
print_success(f"Branch '{branch}' of namespace '{namespace}' created.")
|
|
@@ -122,14 +120,14 @@ def yaml_branch(
|
|
|
122
120
|
) -> None:
|
|
123
121
|
"""Get the branch as one OSI ontology YAML document."""
|
|
124
122
|
from entropy_data.cli import get_client, handle_error
|
|
125
|
-
from entropy_data.client import
|
|
123
|
+
from entropy_data.client import _raise_for_status
|
|
126
124
|
|
|
127
125
|
try:
|
|
128
126
|
client = get_client()
|
|
129
127
|
response = client.session.get(
|
|
130
128
|
f"{client.base_url}/api/{branch_path(namespace, branch)}/ontology.yaml",
|
|
131
129
|
headers={"Accept": "application/yaml"},
|
|
132
|
-
timeout=
|
|
130
|
+
timeout=client.timeout,
|
|
133
131
|
)
|
|
134
132
|
_raise_for_status(response)
|
|
135
133
|
if out_file is not None:
|
|
@@ -153,7 +151,7 @@ def put_branch(
|
|
|
153
151
|
from the branch. The namespace itself is untouched until the branch is merged.
|
|
154
152
|
"""
|
|
155
153
|
from entropy_data.cli import get_client, handle_error
|
|
156
|
-
from entropy_data.client import
|
|
154
|
+
from entropy_data.client import _raise_for_status
|
|
157
155
|
|
|
158
156
|
try:
|
|
159
157
|
content = read_text(file)
|
|
@@ -162,7 +160,7 @@ def put_branch(
|
|
|
162
160
|
f"{client.base_url}/api/{branch_path(namespace, branch)}/ontology.yaml",
|
|
163
161
|
data=content.encode("utf-8"),
|
|
164
162
|
headers={"Content-Type": "application/yaml"},
|
|
165
|
-
timeout=
|
|
163
|
+
timeout=client.timeout,
|
|
166
164
|
)
|
|
167
165
|
_raise_for_status(response)
|
|
168
166
|
print_success(f"Branch '{branch}' of namespace '{namespace}' updated.")
|
|
@@ -216,13 +214,13 @@ def merge_branch(
|
|
|
216
214
|
) -> None:
|
|
217
215
|
"""Merge the branch: land it on the namespace, or open a pull request where git requires review."""
|
|
218
216
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
219
|
-
from entropy_data.client import
|
|
217
|
+
from entropy_data.client import _raise_for_status
|
|
220
218
|
|
|
221
219
|
fmt = output or get_output_format()
|
|
222
220
|
try:
|
|
223
221
|
client = get_client()
|
|
224
222
|
response = client.session.post(
|
|
225
|
-
f"{client.base_url}/api/{branch_path(namespace, branch)}/merge", timeout=
|
|
223
|
+
f"{client.base_url}/api/{branch_path(namespace, branch)}/merge", timeout=client.timeout
|
|
226
224
|
)
|
|
227
225
|
_raise_for_status(response)
|
|
228
226
|
if response.status_code == 204:
|
|
@@ -22,7 +22,7 @@ def get_customization(
|
|
|
22
22
|
) -> None:
|
|
23
23
|
"""Get organization customization settings."""
|
|
24
24
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
25
|
-
from entropy_data.client import
|
|
25
|
+
from entropy_data.client import _raise_for_status
|
|
26
26
|
|
|
27
27
|
fmt = output or get_output_format()
|
|
28
28
|
try:
|
|
@@ -31,7 +31,7 @@ def get_customization(
|
|
|
31
31
|
response = client.session.get(
|
|
32
32
|
f"{client.base_url}/api/settings/customization",
|
|
33
33
|
headers={"Accept": accept},
|
|
34
|
-
timeout=
|
|
34
|
+
timeout=client.timeout,
|
|
35
35
|
)
|
|
36
36
|
_raise_for_status(response)
|
|
37
37
|
if fmt == OutputFormat.json:
|
|
@@ -62,7 +62,7 @@ def get_scim_mapping(
|
|
|
62
62
|
) -> None:
|
|
63
63
|
"""Get the SCIM group mapping configuration."""
|
|
64
64
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
65
|
-
from entropy_data.client import
|
|
65
|
+
from entropy_data.client import _raise_for_status
|
|
66
66
|
|
|
67
67
|
fmt = output or get_output_format()
|
|
68
68
|
try:
|
|
@@ -71,7 +71,7 @@ def get_scim_mapping(
|
|
|
71
71
|
response = client.session.get(
|
|
72
72
|
f"{client.base_url}/api/settings/scim-mapping",
|
|
73
73
|
headers={"Accept": accept},
|
|
74
|
-
timeout=
|
|
74
|
+
timeout=client.timeout,
|
|
75
75
|
)
|
|
76
76
|
_raise_for_status(response)
|
|
77
77
|
if fmt == OutputFormat.json:
|
|
@@ -98,7 +98,7 @@ def put_scim_mapping(
|
|
|
98
98
|
|
|
99
99
|
def _put_yaml_or_json(client, path: str, file: Path) -> None:
|
|
100
100
|
"""PUT a YAML or JSON payload from `file` to `path`, picking Content-Type by extension/content."""
|
|
101
|
-
from entropy_data.client import
|
|
101
|
+
from entropy_data.client import _raise_for_status
|
|
102
102
|
|
|
103
103
|
if str(file) == "-":
|
|
104
104
|
content = sys.stdin.read()
|
|
@@ -110,7 +110,7 @@ def _put_yaml_or_json(client, path: str, file: Path) -> None:
|
|
|
110
110
|
f"{client.base_url}{path}",
|
|
111
111
|
data=content.encode(),
|
|
112
112
|
headers={"Content-Type": content_type},
|
|
113
|
-
timeout=
|
|
113
|
+
timeout=client.timeout,
|
|
114
114
|
)
|
|
115
115
|
_raise_for_status(response)
|
|
116
116
|
|
|
@@ -121,12 +121,12 @@ def get_team_roles(
|
|
|
121
121
|
) -> None:
|
|
122
122
|
"""Show the team roles configuration (default roles or the custom catalog)."""
|
|
123
123
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
124
|
-
from entropy_data.client import
|
|
124
|
+
from entropy_data.client import _raise_for_status
|
|
125
125
|
|
|
126
126
|
fmt = output or get_output_format()
|
|
127
127
|
try:
|
|
128
128
|
client = get_client()
|
|
129
|
-
response = client.session.get(f"{client.base_url}/api/settings/team-roles", timeout=
|
|
129
|
+
response = client.session.get(f"{client.base_url}/api/settings/team-roles", timeout=client.timeout)
|
|
130
130
|
_raise_for_status(response)
|
|
131
131
|
data = response.json()
|
|
132
132
|
if fmt != OutputFormat.table:
|
|
@@ -164,7 +164,7 @@ def put_team_roles(
|
|
|
164
164
|
the listed roles replace the whole catalog; an empty list is rejected with 409.
|
|
165
165
|
"""
|
|
166
166
|
from entropy_data.cli import get_client, handle_error
|
|
167
|
-
from entropy_data.client import
|
|
167
|
+
from entropy_data.client import _raise_for_status
|
|
168
168
|
|
|
169
169
|
try:
|
|
170
170
|
body = read_body(file)
|
|
@@ -172,7 +172,7 @@ def put_team_roles(
|
|
|
172
172
|
response = client.session.put(
|
|
173
173
|
f"{client.base_url}/api/settings/team-roles",
|
|
174
174
|
json=body,
|
|
175
|
-
timeout=
|
|
175
|
+
timeout=client.timeout,
|
|
176
176
|
)
|
|
177
177
|
_raise_for_status(response)
|
|
178
178
|
mode = response.json().get("mode", "")
|
|
@@ -199,12 +199,12 @@ def get_email_templates(
|
|
|
199
199
|
document `put` takes.
|
|
200
200
|
"""
|
|
201
201
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
202
|
-
from entropy_data.client import
|
|
202
|
+
from entropy_data.client import _raise_for_status
|
|
203
203
|
|
|
204
204
|
fmt = output or get_output_format()
|
|
205
205
|
try:
|
|
206
206
|
client = get_client()
|
|
207
|
-
response = client.session.get(f"{client.base_url}/api/settings/email-templates", timeout=
|
|
207
|
+
response = client.session.get(f"{client.base_url}/api/settings/email-templates", timeout=client.timeout)
|
|
208
208
|
_raise_for_status(response)
|
|
209
209
|
data = response.json()
|
|
210
210
|
if fmt != OutputFormat.table:
|
|
@@ -243,7 +243,7 @@ def put_email_templates(
|
|
|
243
243
|
back unchanged customizes nothing.
|
|
244
244
|
"""
|
|
245
245
|
from entropy_data.cli import get_client, handle_error
|
|
246
|
-
from entropy_data.client import
|
|
246
|
+
from entropy_data.client import _raise_for_status
|
|
247
247
|
|
|
248
248
|
try:
|
|
249
249
|
body = read_body(file)
|
|
@@ -251,7 +251,7 @@ def put_email_templates(
|
|
|
251
251
|
response = client.session.put(
|
|
252
252
|
f"{client.base_url}/api/settings/email-templates",
|
|
253
253
|
json=body,
|
|
254
|
-
timeout=
|
|
254
|
+
timeout=client.timeout,
|
|
255
255
|
)
|
|
256
256
|
_raise_for_status(response)
|
|
257
257
|
templates = response.json().get("templates") or {}
|
|
@@ -16,7 +16,6 @@ from pathlib import Path
|
|
|
16
16
|
import yaml
|
|
17
17
|
|
|
18
18
|
from entropy_data.client import (
|
|
19
|
-
REQUEST_TIMEOUT,
|
|
20
19
|
ApiError,
|
|
21
20
|
EntropyDataClient,
|
|
22
21
|
_raise_for_status,
|
|
@@ -106,7 +105,7 @@ def _child_document_ids(source: Path, resources: list[Resource], parent_name: st
|
|
|
106
105
|
|
|
107
106
|
def _get_singleton(client: EntropyDataClient, resource: Resource) -> dict:
|
|
108
107
|
"""GET the singleton object at ``/api/{api_path}`` (returns ``{}`` when unset)."""
|
|
109
|
-
response = client.session.get(f"{client.base_url}/api/{resource.api_path}", timeout=
|
|
108
|
+
response = client.session.get(f"{client.base_url}/api/{resource.api_path}", timeout=client.timeout)
|
|
110
109
|
_raise_for_status(response)
|
|
111
110
|
body = response.json()
|
|
112
111
|
return body if isinstance(body, dict) else {}
|
|
@@ -114,7 +113,7 @@ def _get_singleton(client: EntropyDataClient, resource: Resource) -> dict:
|
|
|
114
113
|
|
|
115
114
|
def _put_singleton(client: EntropyDataClient, resource: Resource, body: dict) -> None:
|
|
116
115
|
"""PUT the singleton object at ``/api/{api_path}`` (no id segment)."""
|
|
117
|
-
response = client.session.put(f"{client.base_url}/api/{resource.api_path}", json=body, timeout=
|
|
116
|
+
response = client.session.put(f"{client.base_url}/api/{resource.api_path}", json=body, timeout=client.timeout)
|
|
118
117
|
_raise_for_status(response)
|
|
119
118
|
|
|
120
119
|
|
|
@@ -130,7 +129,7 @@ def _get_document(client: EntropyDataClient, resource: Resource, parent_id: str)
|
|
|
130
129
|
response = client.session.get(
|
|
131
130
|
f"{client.base_url}/api/{resource.path_for(parent_id)}",
|
|
132
131
|
headers={"Accept": "application/yaml"},
|
|
133
|
-
timeout=
|
|
132
|
+
timeout=client.timeout,
|
|
134
133
|
)
|
|
135
134
|
_raise_for_status(response)
|
|
136
135
|
return response.text
|
|
@@ -142,7 +141,7 @@ def _put_document(client: EntropyDataClient, resource: Resource, parent_id: str,
|
|
|
142
141
|
f"{client.base_url}/api/{resource.path_for(parent_id)}",
|
|
143
142
|
data=text.encode("utf-8"),
|
|
144
143
|
headers={"Content-Type": "application/yaml"},
|
|
145
|
-
timeout=
|
|
144
|
+
timeout=client.timeout,
|
|
146
145
|
)
|
|
147
146
|
_raise_for_status(response)
|
|
148
147
|
|
|
@@ -174,7 +173,7 @@ def _get_assigned_tags(client: EntropyDataClient, asset_id: str) -> list[str]:
|
|
|
174
173
|
_validate_resource_id(asset_id)
|
|
175
174
|
response = client.session.get(
|
|
176
175
|
f"{client.base_url}/api/assets/{asset_id}/assigned-tags",
|
|
177
|
-
timeout=
|
|
176
|
+
timeout=client.timeout,
|
|
178
177
|
)
|
|
179
178
|
_raise_for_status(response)
|
|
180
179
|
return response.json()
|
|
@@ -185,7 +184,7 @@ def _put_assigned_tag(client: EntropyDataClient, asset_id: str, tag_id: str) ->
|
|
|
185
184
|
# tag_id may be hierarchical ("governance/PII"); the server validates it.
|
|
186
185
|
response = client.session.put(
|
|
187
186
|
f"{client.base_url}/api/assets/{asset_id}/assigned-tags/{tag_id}",
|
|
188
|
-
timeout=
|
|
187
|
+
timeout=client.timeout,
|
|
189
188
|
)
|
|
190
189
|
_raise_for_status(response)
|
|
191
190
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Tests for the global --timeout option."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
import requests
|
|
5
|
+
import responses
|
|
6
|
+
from typer.testing import CliRunner
|
|
7
|
+
|
|
8
|
+
import entropy_data.config as cfg
|
|
9
|
+
from entropy_data.cli import app
|
|
10
|
+
|
|
11
|
+
runner = CliRunner()
|
|
12
|
+
BASE_URL = "https://api.entropy-data.com"
|
|
13
|
+
BRANCH = f"{BASE_URL}/api/semantics/experimental/namespaces/sales/branches/add-credit-limit"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.fixture(autouse=True)
|
|
17
|
+
def api_key(monkeypatch, tmp_path):
|
|
18
|
+
monkeypatch.setattr(cfg, "CONFIG_FILE", tmp_path / "config.toml")
|
|
19
|
+
monkeypatch.setenv("ENTROPY_DATA_API_KEY", "test-key")
|
|
20
|
+
monkeypatch.delenv("ENTROPY_DATA_TIMEOUT", raising=False)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.fixture
|
|
24
|
+
def timeouts(monkeypatch):
|
|
25
|
+
seen = []
|
|
26
|
+
send = requests.Session.send
|
|
27
|
+
|
|
28
|
+
def recording_send(self, request, **kwargs):
|
|
29
|
+
seen.append(kwargs.get("timeout"))
|
|
30
|
+
return send(self, request, **kwargs)
|
|
31
|
+
|
|
32
|
+
monkeypatch.setattr(requests.Session, "send", recording_send)
|
|
33
|
+
return seen
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@pytest.fixture
|
|
37
|
+
def document(tmp_path):
|
|
38
|
+
path = tmp_path / "sales.yaml"
|
|
39
|
+
path.write_text("ontology: []\n")
|
|
40
|
+
return str(path)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@responses.activate
|
|
44
|
+
def test_requests_wait_30_seconds_by_default(timeouts, document):
|
|
45
|
+
responses.add(responses.PUT, f"{BRANCH}/ontology.yaml", status=200)
|
|
46
|
+
result = runner.invoke(app, ["semantics", "branches", "put", "sales", "add-credit-limit", "-f", document])
|
|
47
|
+
assert result.exit_code == 0
|
|
48
|
+
assert timeouts == [30]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@responses.activate
|
|
52
|
+
def test_timeout_option_and_env_var(timeouts, document, monkeypatch):
|
|
53
|
+
responses.add(responses.PUT, f"{BRANCH}/ontology.yaml", status=200)
|
|
54
|
+
responses.add(responses.POST, f"{BRANCH}/merge", status=204)
|
|
55
|
+
|
|
56
|
+
result = runner.invoke(
|
|
57
|
+
app, ["--timeout", "300", "semantics", "branches", "put", "sales", "add-credit-limit", "-f", document]
|
|
58
|
+
)
|
|
59
|
+
assert result.exit_code == 0
|
|
60
|
+
monkeypatch.setenv("ENTROPY_DATA_TIMEOUT", "600")
|
|
61
|
+
result = runner.invoke(app, ["semantics", "branches", "merge", "sales", "add-credit-limit"])
|
|
62
|
+
assert result.exit_code == 0
|
|
63
|
+
|
|
64
|
+
assert timeouts == [300, 600]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@responses.activate
|
|
68
|
+
def test_timeout_overrides_a_commands_own_longer_wait(timeouts):
|
|
69
|
+
responses.add(responses.POST, f"{BASE_URL}/api/datacontracts/orders/test", json={"result": "passed"}, status=200)
|
|
70
|
+
|
|
71
|
+
assert runner.invoke(app, ["datacontracts", "test", "orders"]).exit_code == 0
|
|
72
|
+
assert runner.invoke(app, ["--timeout", "60", "datacontracts", "test", "orders"]).exit_code == 0
|
|
73
|
+
|
|
74
|
+
assert timeouts == [1800, 60]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_timeout_must_be_positive():
|
|
78
|
+
result = runner.invoke(app, ["--timeout", "0", "teams", "list"])
|
|
79
|
+
assert result.exit_code != 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|