Skip to content

[Storage] Data Lake Typing and API View Feedback #40096

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions sdk/storage/azure-storage-blob/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Release History

## 12.26.0b1 (Unreleased)
## 12.25.1 (Unreleased)

### Features Added
### Other Changes
- Updated dependency for `azure-storage-file-datalake` type hints.

## 12.25.0 (2025-03-11)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.26.0b1"
VERSION = "12.25.1"
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob',
keywords="azure, azure sdk",
classifiers=[
'Development Status :: 4 - Beta',
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
Expand Down
3 changes: 2 additions & 1 deletion sdk/storage/azure-storage-file-datalake/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Release History

## 12.20.0b1 (Unreleased)
## 12.20.0 (Unreleased)

### Features Added
- Updated type hints across the entire package and enabled MyPy to run during CI. Some public types may have been adjusted if they were previously erroneous or incomplete.

## 12.19.0 (2025-03-11)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def create_directory(
return self._create('directory', metadata=metadata, **kwargs)

@distributed_trace
def delete_directory(self, **kwargs: Any) -> Dict[str, Any]: # pylint: disable=delete-operation-wrong-return-type
def delete_directory(self, **kwargs: Any) -> None:
"""
Marks the specified directory for deletion.

Expand Down Expand Up @@ -270,7 +270,7 @@ def delete_directory(self, **kwargs: Any) -> Dict[str, Any]: # pylint: disable=
:dedent: 4
:caption: Delete directory.
"""
return self._delete(recursive=True, **kwargs)
return self._delete(recursive=True, **kwargs) # type: ignore [return-value]

@distributed_trace
def get_directory_properties(self, **kwargs: Any) -> DirectoryProperties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from datetime import datetime
from typing import (
Any, AnyStr, AsyncIterable, cast, Dict, IO, Iterable, Optional, Union,
Any, AnyStr, cast, Dict, IO, Iterable, Optional, Union,
TYPE_CHECKING
)
from urllib.parse import quote, unquote
Expand Down Expand Up @@ -240,7 +240,7 @@ def create_file(
return self._create('file', content_settings=content_settings, metadata=metadata, **kwargs)

@distributed_trace
def delete_file(self, **kwargs: Any) -> Dict[str, Any]: # pylint: disable=delete-operation-wrong-return-type
def delete_file(self, **kwargs: Any) -> None:
"""
Marks the specified file for deletion.

Expand Down Expand Up @@ -271,8 +271,8 @@ def delete_file(self, **kwargs: Any) -> Dict[str, Any]: # pylint: disable=delet
This value is not tracked or validated on the client. To configure client-side network timesouts
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
#other-client--per-operation-configuration>`_.
:returns: A dictionary of response headers.
:rtype: Dict[str, Any]
:returns: A dictionary of response headers or None.
:rtype: Dict[str, Any] or None

.. admonition:: Example:

Expand All @@ -283,7 +283,7 @@ def delete_file(self, **kwargs: Any) -> Dict[str, Any]: # pylint: disable=delet
:dedent: 4
:caption: Delete file.
"""
return self._delete(**kwargs)
return self._delete(**kwargs) # type: ignore [return-value]

@distributed_trace
def get_file_properties(self, **kwargs: Any) -> FileProperties:
Expand Down Expand Up @@ -379,7 +379,7 @@ def set_file_expiry(

@distributed_trace
def upload_data(
self, data: Union[bytes, str, Iterable[AnyStr], AsyncIterable[AnyStr], IO[AnyStr]],
self, data: Union[bytes, str, Iterable[AnyStr], IO[AnyStr]],
length: Optional[int] = None,
overwrite: Optional[bool] = False,
**kwargs: Any
Expand All @@ -388,7 +388,7 @@ def upload_data(
Upload data to a file.

:param data: Content to be uploaded to file
:type data: bytes, str, Iterable[AnyStr], AsyncIterable[AnyStr], or IO[AnyStr]
:type data: bytes, str, Iterable[AnyStr], or IO[AnyStr]
:param int length: Size of the data in bytes.
:param bool overwrite: to overwrite an existing file or not.
:keyword ~azure.storage.filedatalake.ContentSettings content_settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
elif hasattr(client, '_container_client'):
_client = client._container_client
else:
raise TypeError("Lease must use any of FileSystemClient DataLakeDirectoryClient, or DataLakeFileClient.")
raise TypeError("Lease must use any of FileSystemClient, DataLakeDirectoryClient, or DataLakeFileClient.")

self._blob_lease_client = BlobLeaseClient(_client, lease_id=lease_id)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.20.0b1"
VERSION = "12.20.0"
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async def exists(self, **kwargs: Any) -> bool:
return await self._exists(**kwargs)

@distributed_trace_async
async def delete_directory(self, **kwargs: Any) -> Dict[str, Any]:
async def delete_directory(self, **kwargs: Any) -> None:
"""
Marks the specified directory for deletion.

Expand Down Expand Up @@ -291,7 +291,7 @@ async def delete_directory(self, **kwargs: Any) -> Dict[str, Any]:
:dedent: 4
:caption: Delete directory.
"""
return await self._delete(recursive=True, **kwargs)
return await self._delete(recursive=True, **kwargs) # type: ignore [return-value]

@distributed_trace_async
async def get_directory_properties(self, **kwargs: Any) -> DirectoryProperties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from datetime import datetime
from typing import (
Any, AnyStr, AsyncIterable, cast, Dict, IO, Iterable, Optional, Union,
Any, AnyStr, AsyncIterable, cast, Dict, IO, Optional, Union,
TYPE_CHECKING
)
from urllib.parse import quote, unquote
Expand Down Expand Up @@ -256,7 +256,7 @@ async def exists(self, **kwargs: Any) -> bool:
return await self._exists(**kwargs)

@distributed_trace_async
async def delete_file(self, **kwargs: Any) -> Dict[str, Any]:
async def delete_file(self, **kwargs: Any) -> None:
"""
Marks the specified file for deletion.

Expand Down Expand Up @@ -299,7 +299,7 @@ async def delete_file(self, **kwargs: Any) -> Dict[str, Any]:
:dedent: 4
:caption: Delete file.
"""
return await self._delete(**kwargs)
return await self._delete(**kwargs) # type: ignore [return-value]

@distributed_trace_async
async def get_file_properties(self, **kwargs: Any) -> FileProperties:
Expand Down Expand Up @@ -395,7 +395,7 @@ async def set_file_expiry(

@distributed_trace_async
async def upload_data(
self, data: Union[bytes, str, Iterable[AnyStr], AsyncIterable[AnyStr], IO[AnyStr]],
self, data: Union[bytes, str, AsyncIterable[AnyStr], IO[AnyStr]],
length: Optional[int] = None,
overwrite: Optional[bool] = False,
**kwargs: Any
Expand All @@ -404,7 +404,7 @@ async def upload_data(
Upload data to a file.

:param data: Content to be uploaded to file
:type data: bytes, str, Iterable[AnyStr], AsyncIterable[AnyStr], or IO[AnyStr]
:type data: bytes, str, AsyncIterable[AnyStr], or IO[AnyStr]
:param int length: Size of the data in bytes.
:param bool overwrite: to overwrite an existing file or not.
:keyword ~azure.storage.filedatalake.ContentSettings content_settings:
Expand Down Expand Up @@ -489,15 +489,15 @@ async def upload_data(

@distributed_trace_async
async def append_data(
self, data: Union[bytes, str, Iterable[AnyStr], IO[AnyStr]],
self, data: Union[bytes, str, AsyncIterable[AnyStr], IO[AnyStr]],
offset: int,
length: Optional[int] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Append data to the file.

:param data: Content to be appended to file
:type data: bytes, str, Iterable[AnyStr], or IO[AnyStr]
:type data: bytes, str, AsyncIterable[AnyStr], or IO[AnyStr]
:param int offset: start position of the data to be appended to.
:param length: Size of the data in bytes.
:type length: int or None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
elif hasattr(client, '_container_client'):
_client = client._container_client
else:
raise TypeError("Lease must use any of FileSystemClient DataLakeDirectoryClient, or DataLakeFileClient.")
raise TypeError("Lease must use any of FileSystemClient, DataLakeDirectoryClient, or DataLakeFileClient.")

self._blob_lease_client = BlobLeaseClient(_client, lease_id=lease_id)

Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-file-datalake/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
url='https://github.com/Azure/azure-sdk-for-python',
keywords="azure, azure sdk",
classifiers=[
'Development Status :: 4 - Beta',
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
Expand All @@ -78,7 +78,7 @@
python_requires=">=3.8",
install_requires=[
"azure-core>=1.30.0",
"azure-storage-blob>=12.26.0b1",
"azure-storage-blob>=12.25.1",
"typing-extensions>=4.6.0",
"isodate>=0.6.1"
],
Expand Down