Skip to content

Commit 80b589a

Browse files
Fix missing kwargs injection on put calls
1 parent 6a0c944 commit 80b589a

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Unreleased
66
* Respect `AzureBlobFileSystem.protocol` tuple when removing protocols from fully-qualified
77
paths provided to `AzureBlobFileSystem` methods.
88
* Added `AzureBlobFileSystem.rm_file()`
9+
* Keyword arguments for `put` and `put_file` are now proxied to the Azure Blob SDK client to
10+
support specifying content settings, tags, and more.
911

1012
2025.8.0
1113
--------

adlfs/spec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,7 @@ async def _put_file(
17441744
),
17451745
max_concurrency=max_concurrency or self.max_concurrency,
17461746
**self._timeout_kwargs,
1747+
**kwargs,
17471748
)
17481749
self.invalidate_cache()
17491750
except ResourceExistsError:

adlfs/tests/test_spec.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,38 @@ def test_put_file(storage, tmp_path):
14401440
assert f3 == f4
14411441

14421442

1443+
@pytest.mark.parametrize("put_method", ["put", "put_file"])
1444+
def test_put_methods_with_content_settings(storage, put_method, tmp_path):
1445+
from azure.storage.blob import ContentSettings
1446+
1447+
fs = AzureBlobFileSystem(
1448+
account_name=storage.account_name, connection_string=CONN_STR
1449+
)
1450+
1451+
src = tmp_path / "sample"
1452+
src.write_bytes(b"data")
1453+
1454+
content_settings = {"content_type": "application/json", "content_encoding": "UTF-8"}
1455+
1456+
container = "putdir-with-kwargs"
1457+
fs.mkdir(container)
1458+
getattr(fs, put_method)(
1459+
str(src),
1460+
f"{container}/sample.json",
1461+
content_settings=ContentSettings(**content_settings),
1462+
)
1463+
1464+
blob_info = fs.info(f"{container}/sample.json")
1465+
assert (
1466+
blob_info["content_settings"]["content_type"]
1467+
== content_settings["content_type"]
1468+
)
1469+
assert (
1470+
blob_info["content_settings"]["content_encoding"]
1471+
== content_settings["content_encoding"]
1472+
)
1473+
1474+
14431475
def test_isdir(storage):
14441476
fs = AzureBlobFileSystem(
14451477
account_name=storage.account_name, connection_string=CONN_STR

0 commit comments

Comments
 (0)