Skip to content

Commit a760193

Browse files
l0lawrenceannatischCopilotCopilotCopilot
authored
[Storage Files] Migrating to TypeSpec (#46929)
* Initial migration * Refactor * Update mock transport * pylint * adding accept sanitization to conftest * pin new version of azure-core * regen * prpoject version * remove * patch remove fix * fix client helpers * regen * pyproject * pylint * remove redudant lines * tests all passing * pylint * regen * pylint * regen * Apply suggestion from @l0lawrence * Apply suggestion from @l0lawrence * prproject * Apply suggestion from @l0lawrence * regen w new config * Fix pylint errors in azure-storage-file-share Move pylint disable comments to the correct lines where violations occur (protected-access, unused-argument) and fix implicit string concatenation in _parser.py. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix model subclasses to call super().__init__ and remove models _patch hacks Refactor the 10 custom subclasses in azure/storage/fileshare/_models.py (RetentionPolicy, Metrics, CorsRule, SmbMultichannel, SmbEncryptionInTransit, ShareSmbSettings, NfsEncryptionInTransit, ShareNfsSettings, ShareProtocolSettings, AccessPolicy) so they no longer shadow the parent _RestField descriptors and properly delegate to super().__init__(**kwargs). With the subclasses fixed at the source, the runtime monkey-patches in _generated/models/_patch.py (_patched_getattr/setattr/getattribute/new) are no longer needed; revert that file to the empty stock template. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * regen * mypy/pylint fix * regen * regen renamed a param Co-authored-by: Copilot <copilot@github.com> * Align _shared upload helpers with azure-storage-blob TSP migration Port changes from azure-storage-blob storageblob3 branch to keep _shared files consistent across Storage packages: - request_handlers.py: collapse split string literals - uploads.py / uploads_async.py: switch BlockBlob/PageBlob/AppendBlob ChunkUploader callers to keyword args and to the new etag / match_condition / append_position kwarg names; pop those kwargs in upload_data_chunks and upload_substream_blocks when running in parallel. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix FileProperty datetime fields: declare as str, not RFC7231 datetime The wire format for creationTime/lastAccessTime/lastWriteTime/changeTime is ISO 8601, not RFC 7231 (only Last-Modified is RFC 7231). Declaring them as Optional[datetime.datetime] with format="rfc7231" causes the XML deserializer to fail and leave a raw xml.etree.ElementTree.Element in _data, which crashes JSON serialization downstream (Azure CLI). Match the legacy SDK behavior by declaring these fields as Optional[str]. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * wip changes from running against azure cli Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * also patch here for backcompat * regen * Fix pylint: relocate disable comments in _models.py - Move 'protected-access' disables from closing-bracket lines onto the lines where '_from_generated' is actually accessed (Metrics, SharePropertiesPaged, HandlesPaged). - Use scoped 'disable/enable=protected-access' block in DirectoryPropertiesPaged._extract_data_cb (two accesses too long to carry inline disables under the 120-char limit). - Add 'unused-argument' disables to the backcompat **kwargs catch-all __init__ methods on SmbMultichannel, SmbEncryptionInTransit, ShareSmbSettings, NfsEncryptionInTransit, ShareNfsSettings, and ShareProtocolSettings. No logic changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * client docstring * todo * regen * fixing up backcompat models for api parity * update wrapper for iter_bytes * tests/samples w/o formatting changes * regen with newest emitter * update policies * regen * pylint * account for xml element * add 3.14 * updates to models * black * linting * blakc * missing impl * par with queue * patch operation upload_range for parity * map output to the public model * add _validation * add xml map name for backcompat * black * this * this * cleaning code * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * cleaning up * here * align _shared * update iterator wrapper * _shared parity * _shared align * pass metadata api check * nit * remove blob/datalake tsp changes * rangepolicy (need to add to queue _shared) * access_conditions -> lease_id * remove useless-suppression * dont need to strip here * dont do strip_url, just dont pass snapshot explicitly * regen * update changelog * changelog + readme 3.9 * api metadata * publicly expose signedIdentifier * simplify patch file * update changelogs to catalog leaking * clean up patches * add back conftest --------- Co-authored-by: antisch <antisch@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: l0lawrence <l0lawrence@users.noreply.github.com> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 0ad3d05 commit a760193

72 files changed

Lines changed: 20145 additions & 17281 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

sdk/storage/azure-storage-file-share/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
### Features Added
66

7+
### Bugs Fixed
8+
- Return type of get_share_access_policies is now the publicly exposed SignedIdentifier model containing the publicly exposed AccessPolicy model. Previously we were leaking the internal generated SignedIdentifier model without exposing it in the api.
9+
10+
11+
### Other Changes
12+
- Custom transports that use legacy azure-core Request/Response types will not be supported moving forward
13+
- Removed support for Python 3.9, Python 3.10 or later is required to use this package
14+
715
## 12.26.0 (2026-06-08)
816

917
### Features Added
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include *.md
2-
include azure/__init__.py
3-
include azure/storage/__init__.py
42
include LICENSE
3+
include azure/storage/fileshare/py.typed
54
recursive-include tests *.py
65
recursive-include samples *.py *.md
7-
include azure/storage/fileshare/py.typed
6+
include azure/__init__.py
7+
include azure/storage/__init__.py

sdk/storage/azure-storage-file-share/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Azure file shares can be used to:
1717
## Getting started
1818

1919
### Prerequisites
20-
* Python 3.9 or later is required to use this package. For more details, please read our page on [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/python_version_support_policy.md).
20+
* Python 3.10 or later is required to use this package. For more details, please read our page on [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/python_version_support_policy.md).
2121
* You must have an [Azure subscription](https://azure.microsoft.com/free/) and an
2222
[Azure storage account](https://learn.microsoft.com/azure/storage/common/storage-account-overview) to use this package.
2323

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"apiVersion": "2026-06-06",
3+
"apiVersions": {
4+
"Storage.File": "2026-06-06"
5+
}
6+
}

sdk/storage/azure-storage-file-share/api.md

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace azure.storage.fileshare
6464
) -> str: ...
6565

6666

67-
class azure.storage.fileshare.AccessPolicy(GenAccessPolicy):
67+
class azure.storage.fileshare.AccessPolicy(_BackCompatMixin):
6868
expiry: Optional[Union[datetime, str]]
6969
permission: Optional[Union[ShareSasPermissions, str]]
7070
start: Optional[Union[datetime, str]]
@@ -219,7 +219,7 @@ namespace azure.storage.fileshare
219219
def values(self): ...
220220

221221

222-
class azure.storage.fileshare.CorsRule(GeneratedCorsRule):
222+
class azure.storage.fileshare.CorsRule(_BackCompatMixin):
223223
allowed_headers: str
224224
allowed_methods: str
225225
allowed_origins: str
@@ -585,7 +585,7 @@ namespace azure.storage.fileshare
585585
SECONDARY = secondary
586586

587587

588-
class azure.storage.fileshare.Metrics(GeneratedMetrics):
588+
class azure.storage.fileshare.Metrics(_BackCompatMixin):
589589
enabled: bool = False
590590
include_apis: bool
591591
retention_policy: RetentionPolicy
@@ -674,7 +674,7 @@ namespace azure.storage.fileshare
674674
def from_string(cls, string: str) -> Self: ...
675675

676676

677-
class azure.storage.fileshare.NfsEncryptionInTransit(GeneratedNfsEncryptionInTransit):
677+
class azure.storage.fileshare.NfsEncryptionInTransit(_BackCompatMixin):
678678
required: bool
679679

680680
def __eq__(self, other: Any) -> bool: ...
@@ -743,7 +743,7 @@ namespace azure.storage.fileshare
743743
def from_string(cls, string: str) -> ResourceTypes: ...
744744

745745

746-
class azure.storage.fileshare.RetentionPolicy(GeneratedRetentionPolicy):
746+
class azure.storage.fileshare.RetentionPolicy(_BackCompatMixin):
747747
days: Optional[int]
748748
enabled: bool = False
749749

@@ -1710,7 +1710,7 @@ namespace azure.storage.fileshare
17101710
) -> None: ...
17111711

17121712

1713-
class azure.storage.fileshare.ShareNfsSettings(GeneratedShareNfsSettings):
1713+
class azure.storage.fileshare.ShareNfsSettings(_BackCompatMixin):
17141714
encryption_in_transit: NfsEncryptionInTransit
17151715

17161716
def __eq__(self, other: Any) -> bool: ...
@@ -1833,7 +1833,7 @@ namespace azure.storage.fileshare
18331833
def values(self): ...
18341834

18351835

1836-
class azure.storage.fileshare.ShareProtocolSettings(GeneratedShareProtocolSettings):
1836+
class azure.storage.fileshare.ShareProtocolSettings(_BackCompatMixin):
18371837
nfs: Optional[ShareNfsSettings]
18381838
smb: Optional[ShareSmbSettings]
18391839

@@ -2034,7 +2034,7 @@ namespace azure.storage.fileshare
20342034
) -> ShareClient: ...
20352035

20362036

2037-
class azure.storage.fileshare.ShareSmbSettings(GeneratedShareSmbSettings):
2037+
class azure.storage.fileshare.ShareSmbSettings(_BackCompatMixin):
20382038
encryption_in_transit: Optional[SmbEncryptionInTransit]
20392039
multichannel: Optional[SmbMultichannel]
20402040

@@ -2087,7 +2087,60 @@ namespace azure.storage.fileshare
20872087
) -> JSON: ...
20882088

20892089

2090-
class azure.storage.fileshare.SmbEncryptionInTransit(GeneratedSmbEncryptionInTransit):
2090+
class azure.storage.fileshare.SignedIdentifier(DictMixin):
2091+
access_policy: Optional[AccessPolicy]
2092+
id: str
2093+
2094+
def __contains__(self, key): ...
2095+
2096+
def __delitem__(self, key): ...
2097+
2098+
def __eq__(self, other): ...
2099+
2100+
def __getitem__(self, key): ...
2101+
2102+
def __init__(
2103+
self,
2104+
id: str,
2105+
access_policy: Optional[AccessPolicy] = None
2106+
) -> None: ...
2107+
2108+
def __len__(self): ...
2109+
2110+
def __ne__(self, other): ...
2111+
2112+
def __repr__(self): ...
2113+
2114+
def __setitem__(
2115+
self,
2116+
key,
2117+
item
2118+
): ...
2119+
2120+
def __str__(self): ...
2121+
2122+
def get(
2123+
self,
2124+
key,
2125+
default = None
2126+
): ...
2127+
2128+
def has_key(self, k): ...
2129+
2130+
def items(self): ...
2131+
2132+
def keys(self): ...
2133+
2134+
def update(
2135+
self,
2136+
*args,
2137+
**kwargs
2138+
): ...
2139+
2140+
def values(self): ...
2141+
2142+
2143+
class azure.storage.fileshare.SmbEncryptionInTransit(_BackCompatMixin):
20912144
required: bool
20922145

20932146
def __eq__(self, other: Any) -> bool: ...
@@ -2138,7 +2191,7 @@ namespace azure.storage.fileshare
21382191
) -> JSON: ...
21392192

21402193

2141-
class azure.storage.fileshare.SmbMultichannel(GeneratedSmbMultichannel):
2194+
class azure.storage.fileshare.SmbMultichannel(_BackCompatMixin):
21422195
enabled: bool
21432196

21442197
def __eq__(self, other: Any) -> bool: ...
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
apiMdSha256: 3c2f71c139d0f1e3430e1f6802e9b27f9940c011b1da95748721350c53a0c6f8
1+
apiMdSha256: e5365af6aa894d319fb5d7552c4c61d2a91ec7bc761597ebc5b7bdb24049cf5e
22
parserVersion: 0.3.28
3-
pythonVersion: 3.13.14
3+
pythonVersion: 3.10.20

0 commit comments

Comments
 (0)