-
Notifications
You must be signed in to change notification settings - Fork 2
feat: warn when NominalClient is created without a workspace RID #752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
cc88d17
a1c0a57
531a383
859484a
dd0eab9
bb6e865
e2312cd
631494b
b9239fd
cd2b1f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import enum | ||
| import logging | ||
| import uuid | ||
| import warnings | ||
| from dataclasses import dataclass, field | ||
| from datetime import datetime, timedelta | ||
| from io import TextIOBase | ||
|
|
@@ -171,6 +172,7 @@ def from_token( | |
| connect_timeout: timedelta | float = DEFAULT_CONNECT_TIMEOUT, | ||
| extra_headers: HeaderProvider | Mapping[str, str] | None = None, | ||
| _profile: str | None = None, | ||
| _workspace_warning_emitted: bool = False, | ||
| ) -> Self: | ||
| """Create a connection to the Nominal platform from a token. | ||
|
|
||
|
|
@@ -184,6 +186,13 @@ def from_token( | |
| connect_timeout: Request connection timeout. | ||
| extra_headers: Extra request headers, either as a mapping or HeaderProvider. | ||
| """ | ||
| if workspace_rid is None and not _workspace_warning_emitted: | ||
| warnings.warn( | ||
| "NominalClient will soon require a workspace RID. " | ||
| "Any client which doesn't have a workspace RID specified will fail.", | ||
| UserWarning, | ||
| stacklevel=2, | ||
| ) | ||
|
seanmreidy marked this conversation as resolved.
|
||
| trust_store_path = certifi.where() if trust_store_path is None else trust_store_path | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing Test Coverage: This warning functionality needs comprehensive tests to ensure it works correctly. Consider adding tests using
The warning should also be tested for the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems a bit excessive for just a warning message |
||
| timeout_seconds = connect_timeout.total_seconds() if isinstance(connect_timeout, timedelta) else connect_timeout | ||
| cfg = ServiceConfiguration( | ||
|
seanmreidy marked this conversation as resolved.
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.