Skip to content

[Storage] [Named Keywords] [Blob] _container_client.py and aio #40692

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

Conversation

weirongw23-msft
Copy link
Member

No description provided.

@weirongw23-msft weirongw23-msft changed the base branch from main to feature/storage-blob-named-keywords April 23, 2025 21:39
@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Apr 23, 2025
@weirongw23-msft weirongw23-msft marked this pull request as ready for review April 23, 2025 21:40
@@ -264,3 +272,33 @@ def _generate_set_tiers_options(
reqs.append(req)

return reqs, kwargs


def _delete_container_options(**kwargs: Any) -> Dict[str, Any]:
Copy link
Member Author

Choose a reason for hiding this comment

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

Could theoretically get rid of this and do this in line like some of the APIs. We'll have to decide which one we like more in container client (and in blob generally) since there is not a lot for those options but it is cleaner.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 23, 2025

API Change Check

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

azure-storage-blob

@azure-sdk
Copy link
Collaborator

API change check

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

azure-storage-blob

@weirongw23-msft weirongw23-msft changed the base branch from feature/storage-blob-named-keywords to main April 24, 2025 15:31
@weirongw23-msft weirongw23-msft changed the base branch from main to feature/storage-blob-named-keywords April 24, 2025 15:31
@weirongw23-msft
Copy link
Member Author

TODO: Remove docstring-should-match-keywords only

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.

Looks mostly good to me, some nits on some consistency issues (I also didn't take as close of a look through async, so please apply any sync feedback <--> async when applicable)

Comment on lines +243 to +244
:keyword str secondary_hostname:
The hostname of the secondary endpoint.
Copy link
Member

Choose a reason for hiding this comment

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

nit: Could you move audience docstring up here? Not sure if it's worth doing a sweeping change (or if other APIs even follow this), but it would be cool if the docstrings could appear in the same order as the named keywords

Copy link
Member

Choose a reason for hiding this comment

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

Looking closer-- I also realized the other new docstrings you added are out of order as well. Could you order docstring to match the named keywords ordering? You may also want to retroactively apply this to Blobs.. (sorry for not catching this earlier)

Comment on lines +344 to +346
:keyword str secondary_hostname:
The hostname of the secondary endpoint.
:keyword int max_block_size: The maximum chunk size for uploading a block blob in chunks.
Copy link
Member

Choose a reason for hiding this comment

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

Same nit here, if we could move audience docstring between these two docstrings -- once again just to match named keywords appearing with docstring ordering
EDIT: And again, if you could order the other keyword docstrings to match the named keywords ordering

timeout = kwargs.pop('timeout', None)
headers.update(add_metadata_headers(metadata)) # type: ignore
container_cpk_scope_info = get_container_cpk_scope_info(kwargs)
headers.update(add_metadata_headers(metadata)) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

Is there any more specific ignores here we could apply instead of the all mighty 🔨 ? Fine to leave if there isn't a better alternative.

try:
return self._client.container.create( # type: ignore
return self._client.container.create( # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

Same comment here- is there a more specific ignore or is there multiple errors we are suppressing here?

@@ -473,10 +620,18 @@ def acquire_lease(
:dedent: 8
:caption: Acquiring a lease on the container.
"""
lease = BlobLeaseClient(self, lease_id=lease_id) # type: ignore
lease = BlobLeaseClient(self, lease_id=lease_id) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

nit: Any more specific ignores?

Comment on lines +625 to +626
if etag is not None:
kwargs['etag'] = etag
Copy link
Member

Choose a reason for hiding this comment

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

Is there a specific reason why we need etag to be populated in the kwargs bag and not passed directly as a named keyword?

Comment on lines +938 to +939
identifiers.append(SignedIdentifier(id=key, access_policy=value)) # type: ignore
signed_identifiers = identifiers # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

same nit: Any more specific ignores?

Comment on lines +142 to +150
secondary_hostname: Optional[str] = None,
audience: Optional[str] = None,
max_block_size: int = 4 * 1024 * 1024,
max_page_size: int = 4 * 1024 * 1024,
max_chunk_get_size: int = 4 * 1024 * 1024,
max_single_put_size: int = 64 * 1024 * 1024,
max_single_get_size: int = 32 * 1024 * 1024,
min_large_block_upload_threshold: int = 4 * 1024 * 1024 + 1,
use_byte_buffer: Optional[bool] = None,
Copy link
Member

Choose a reason for hiding this comment

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

same nit: If we could order the docstring to match the named keywords (or vice versa, just keep it consistent) and probably would be good to keep it consistent b/w sync and async clients, and this laundry list of options should appear in the same ordering if it appears in any other APIs

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.

3 participants