Skip to content

Users/zhaodongwang/remove default credentail#26

Merged
tpellissier-msft merged 2 commits intomainfrom
users/zhaodongwang/removeDefaultCredentail
Nov 3, 2025
Merged

Users/zhaodongwang/remove default credentail#26
tpellissier-msft merged 2 commits intomainfrom
users/zhaodongwang/removeDefaultCredentail

Conversation

@zhaodongwang-msft
Copy link
Copy Markdown
Contributor

This pull request updates the authentication approach for the Dataverse SDK to require an explicit Azure Identity credential, rather than defaulting to DefaultAzureCredential when none is provided. This change improves clarity and control over authentication, ensuring that developers must always specify the credential they wish to use.

Authentication changes:

  • The SDK now requires an explicit azure.core.credentials.TokenCredential credential for authentication; automatic fallback to DefaultAzureCredential has been removed. (README.md, src/dataverse_sdk/auth.py, src/dataverse_sdk/client.py) [1] [2] [3] [4]
  • The AuthManager class constructor now enforces that the credential argument implements TokenCredential, raising a TypeError otherwise.

Documentation updates:

  • All references in README.md and example code have been updated to show explicit credential usage, removing examples that previously relied on automatic credential selection.

Code cleanup:

  • Removed unnecessary imports and Optional typing related to the credential argument, reflecting the new requirement for explicit credentials. [1] [2]

Copilot AI review requested due to automatic review settings November 3, 2025 18:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the optional credential default behavior in favor of requiring explicit credential provision. The SDK no longer falls back to DefaultAzureCredential when no credential is provided.

  • Changed credential parameter from optional to required in DataverseClient and AuthManager
  • Added runtime type checking for credential in AuthManager
  • Updated documentation to reflect the mandatory credential requirement

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/dataverse_sdk/client.py Changed credential parameter from Optional[TokenCredential] with default None to required TokenCredential
src/dataverse_sdk/auth.py Removed DefaultAzureCredential fallback and added explicit isinstance check; changed credential parameter to required
README.md Updated Auth section and examples to show explicit credential creation instead of defaulting behavior
Comments suppressed due to low confidence (1)

src/dataverse_sdk/client.py:36

  • The docstring's Raises section is incomplete. It should document that TypeError can be raised from AuthManager.__init__() when an invalid credential is provided (based on the isinstance check in auth.py line 18-21).
    Raises
    ------
    ValueError
        If ``base_url`` is missing or empty after trimming.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/dataverse_sdk/auth.py
@tpellissier-msft tpellissier-msft merged commit 81d2c8f into main Nov 3, 2025
9 checks passed
@zhaodongwang-msft zhaodongwang-msft deleted the users/zhaodongwang/removeDefaultCredentail branch February 13, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants