[Fix] Use correct optional typing in WorkspaceClient for mypy#760
Merged
mgyucht merged 1 commit intodatabricks:mainfrom Sep 13, 2024
Merged
[Fix] Use correct optional typing in WorkspaceClient for mypy#760mgyucht merged 1 commit intodatabricks:mainfrom
WorkspaceClient for mypy#760mgyucht merged 1 commit intodatabricks:mainfrom
Conversation
Without this change, the SDK is not very `mypy`-compatible. This PR fixes `arg-type` check: ``` cmd [3] | mypy --disable-error-code 'annotation-unchecked' --exclude 'tests/resources/*' --exclude dist . error: Argument "auth_type" to "WorkspaceClient" has incompatible type "str | None"; expected "str" [arg-type] error: Argument "token" to "WorkspaceClient" has incompatible type "str | None"; expected "str" [arg-type] ``` `Optional[X]` is py3.8 and py3.9 way of expressing optional types, but in py3.10+ it gets transformed into a union type of `X | None`, which is not supported by py3.9. py3.9 EOL is 31 Oct 2025, so we have to deal with it somehow until then.
mgyucht
approved these changes
Sep 13, 2024
tanmay-db
added a commit
that referenced
this pull request
Sep 16, 2024
### New Features and Improvements * Support Models in `dbutils.fs` operations ([#750](#750)). ### Bug Fixes * Do not specify --tenant flag when fetching managed identity access token from the CLI ([#748](#748)). * Fix deserialization of 401/403 errors ([#758](#758)). * Use correct optional typing in `WorkspaceClient` for `mypy` ([#760](#760)).
github-merge-queue bot
pushed a commit
that referenced
this pull request
Sep 17, 2024
### New Features and Improvements * Support Models in `dbutils.fs` operations ([#750](#750)). ### Bug Fixes * Do not specify --tenant flag when fetching managed identity access token from the CLI ([#748](#748)). * Fix deserialization of 401/403 errors ([#758](#758)). * Use correct optional typing in `WorkspaceClient` for `mypy` ([#760](#760)).
aravind-segu
pushed a commit
to aravind-segu/databricks-sdk-py
that referenced
this pull request
Sep 18, 2024
…tabricks#760) Without this change, the SDK is not very `mypy`-compatible. This PR fixes `arg-type` check: ``` cmd [3] | mypy --disable-error-code 'annotation-unchecked' --exclude 'tests/resources/*' --exclude dist . error: Argument "auth_type" to "WorkspaceClient" has incompatible type "str | None"; expected "str" [arg-type] error: Argument "token" to "WorkspaceClient" has incompatible type "str | None"; expected "str" [arg-type] ``` `Optional[X]` is py3.8 and py3.9 way of expressing optional types, but in py3.10+ it gets transformed into a union type of `X | None`, which is not supported by py3.9. py3.9 EOL is 31 Oct 2025, so we have to deal with it somehow until then.
aravind-segu
pushed a commit
to aravind-segu/databricks-sdk-py
that referenced
this pull request
Sep 18, 2024
### New Features and Improvements * Support Models in `dbutils.fs` operations ([databricks#750](databricks#750)). ### Bug Fixes * Do not specify --tenant flag when fetching managed identity access token from the CLI ([databricks#748](databricks#748)). * Fix deserialization of 401/403 errors ([databricks#758](databricks#758)). * Use correct optional typing in `WorkspaceClient` for `mypy` ([databricks#760](databricks#760)).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without this change, the SDK is not very
mypy-compatible. This PR fixesarg-typecheck:Optional[X]is py3.8 and py3.9 way of expressing optional types, but in py3.10+ it gets transformed into a union type ofX | None, which is not supported by py3.9. py3.9 EOL is 31 Oct 2025, so we have to deal with it somehow until then.