Skip to content

[Storage] [Named Keywords] File Share Package #42100

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

weirongw23-msft
Copy link
Member

No description provided.

@weirongw23-msft weirongw23-msft marked this pull request as ready for review July 18, 2025 18:39
@Copilot Copilot AI review requested due to automatic review settings July 18, 2025 18:39
@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Jul 18, 2025
Copy link
Contributor

@Copilot 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 pull request merges the File Share Named Keywords branch into main, introducing comprehensive type stubs (.pyi files) for the Azure Storage File Share SDK's async client components and updating the synchronous lease client implementation. The changes enhance type safety and developer experience through improved type annotations and code quality improvements.

Key changes include:

  • Addition of complete type stub files for async client classes
  • Type safety improvements in the lease client implementation
  • Enhanced code formatting and consistency across the codebase

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
aio/_share_service_client_async.pyi New type stub for async share service client with comprehensive method signatures
aio/_share_client_async.pyi New type stub for async share client with all share management operations
aio/_lease_async.pyi New type stub for async lease client operations
aio/_lease_async.py Updated implementation with improved formatting and type safety
aio/_file_client_async.pyi New type stub for async file client with file operations
aio/_directory_client_async.pyi New type stub for async directory client with directory operations
_share_service_client.pyi New type stub for sync share service client
_share_client.pyi New type stub for sync share client
_lease.pyi New type stub for sync lease client
_lease.py Updated implementation with type safety improvements
_file_client.pyi New type stub for sync file client
_directory_client.pyi New type stub for sync directory client
Comments suppressed due to low confidence (2)

sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.pyi:276

  • Parameter naming inconsistency: sync version uses 'if_modified_since' while async version uses 'source_if_modified_since'. This could cause confusion for developers switching between sync and async versions.
        if_modified_since: Optional[datetime] = None,


if TYPE_CHECKING:
from datetime import datetime
from azure.storage.fileshare import ShareClient, ShareFileClient


class ShareLeaseClient(object): # pylint: disable=client-accepts-api-version-keyword
class ShareLeaseClient: # pylint: disable=client-accepts-api-version-keyword
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

Removing '(object)' inheritance is good for Python 3, but ensure this change is consistent across the entire codebase.

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

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

Good suggestion!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

self, *, lease: Optional[Union[ShareLeaseClient, str]] = None, timeout: Optional[int] = None, **kwargs: Any
) -> None: ...
@distributed_trace
def rename_file(
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

The sync version of rename_file has different keyword-only parameter structure compared to the async version. The async version uses '*,' before timeout while sync version doesn't. This inconsistency could confuse API consumers.

Copilot uses AI. Check for mistakes.

Copy link
Member

@vincenttran-msft vincenttran-msft Jul 22, 2025

Choose a reason for hiding this comment

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

Yeah, that ^ I think you are missing the *, but also, the parameters are different i.e. missing timeout?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a really good catch, turns out the * was missing to separate positional and keyword arguments. There is currently no timeout documented. However, to stay consistent with other APIs we'll put it here because it is technically accepted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed!

@weirongw23-msft weirongw23-msft changed the title [Storage] [Named Keywords] [File Share] Merge File Share NK Branch into Main [Storage] [Named Keywords] File Share Package Jul 18, 2025
Copy link

github-actions bot commented Jul 18, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure-storage-file-share

) -> None:
self.id = lease_id or str(uuid.uuid4())
self.last_modified = None
self.etag = None
if hasattr(client, 'file_name'):
if hasattr(client, "file_name"):
Copy link
Member

Choose a reason for hiding this comment

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

Same broadly applicable comment here-- seems like you only ran black formatter on async? Just be consistent between sync and async (all or nothing)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah again this was weird so I'll revert the changes for lease. The other files all look fine. Don't know why only lease got formatted (or I thought it was a good idea :))

Will do the black formatting in a separate PR!

Copy link
Member

@vincenttran-msft vincenttran-msft left a comment

Choose a reason for hiding this comment

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

Same comments about consistency between lease sync and async.

Also need to correct the keywords for rename_file it seems?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants