asanypath 2.0.1__tar.gz → 2.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. {asanypath-2.0.1 → asanypath-2.1.1}/.github/workflows/publish.yml +2 -2
  2. {asanypath-2.0.1 → asanypath-2.1.1}/.github/workflows/unittests.yml +1 -1
  3. {asanypath-2.0.1 → asanypath-2.1.1}/.gitignore +1 -0
  4. {asanypath-2.0.1 → asanypath-2.1.1}/PKG-INFO +51 -40
  5. {asanypath-2.0.1 → asanypath-2.1.1}/README.md +47 -33
  6. {asanypath-2.0.1 → asanypath-2.1.1}/hatch_build.py +1 -1
  7. {asanypath-2.0.1 → asanypath-2.1.1}/pyproject.toml +6 -3
  8. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/_transfer.py +13 -5
  9. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/_version.py +2 -2
  10. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/artifactory.py +17 -9
  11. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/asanypath.py +1 -1
  12. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/asanypath.pyi +1 -1
  13. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/azure.py +7 -3
  14. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/cli.py +3 -3
  15. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/cloud.py +90 -27
  16. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/ftp.py +1 -1
  17. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/gcs.py +7 -3
  18. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/http.py +18 -13
  19. asanypath-2.1.1/src/asanypath/py.typed +0 -0
  20. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/s3.py +78 -64
  21. asanypath-2.1.1/src/asanypath/ssh.py +650 -0
  22. asanypath-2.1.1/src/asanypath/unsupported.py +64 -0
  23. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_cli.py +5 -17
  24. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_cloudpathmixin.py +2 -2
  25. asanypath-2.1.1/tests/test_py_typed.py +14 -0
  26. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_s3.py +80 -54
  27. asanypath-2.1.1/tests/test_ssh.py +574 -0
  28. asanypath-2.1.1/uv.lock +2831 -0
  29. asanypath-2.0.1/src/asanypath/ssh.py +0 -776
  30. asanypath-2.0.1/src/asanypath/unsupported.py +0 -202
  31. asanypath-2.0.1/src/asanypath_native.pyi +0 -97
  32. asanypath-2.0.1/tests/test_ssh.py +0 -995
  33. asanypath-2.0.1/uv.lock +0 -2804
  34. {asanypath-2.0.1 → asanypath-2.1.1}/.copilot/skills/async-python-lib/SKILL.md +0 -0
  35. {asanypath-2.0.1 → asanypath-2.1.1}/.copilot/skills/gitguro/SKILL.md +0 -0
  36. {asanypath-2.0.1 → asanypath-2.1.1}/.github/CODEOWNERS +0 -0
  37. {asanypath-2.0.1 → asanypath-2.1.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  38. {asanypath-2.0.1 → asanypath-2.1.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  39. {asanypath-2.0.1 → asanypath-2.1.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  40. {asanypath-2.0.1 → asanypath-2.1.1}/.github/dependabot.yml +0 -0
  41. {asanypath-2.0.1 → asanypath-2.1.1}/.pre-commit-config.yaml +0 -0
  42. {asanypath-2.0.1 → asanypath-2.1.1}/CODE_OF_CONDUCT.md +0 -0
  43. {asanypath-2.0.1 → asanypath-2.1.1}/CONTRIBUTING.md +0 -0
  44. {asanypath-2.0.1 → asanypath-2.1.1}/LICENSE +0 -0
  45. {asanypath-2.0.1 → asanypath-2.1.1}/SECURITY.md +0 -0
  46. {asanypath-2.0.1 → asanypath-2.1.1}/asanypath.png +0 -0
  47. {asanypath-2.0.1 → asanypath-2.1.1}/compose.yml +0 -0
  48. {asanypath-2.0.1 → asanypath-2.1.1}/scripts/bench.py +0 -0
  49. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/__init__.py +0 -0
  50. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/__init__.pyi +0 -0
  51. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/_credstore.py +0 -0
  52. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/batcher.py +0 -0
  53. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/common.py +0 -0
  54. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/exceptions.py +0 -0
  55. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/local.py +0 -0
  56. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/options.py +0 -0
  57. {asanypath-2.0.1 → asanypath-2.1.1}/src/asanypath/sync.py +0 -0
  58. {asanypath-2.0.1 → asanypath-2.1.1}/tests/__init__.py +0 -0
  59. {asanypath-2.0.1 → asanypath-2.1.1}/tests/conftest.py +0 -0
  60. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_artifactory.py +0 -0
  61. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_asanypath.py +0 -0
  62. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_azure.py +0 -0
  63. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_batcher.py +0 -0
  64. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_commonpathmixin.py +0 -0
  65. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_credstore.py +0 -0
  66. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_ftp.py +0 -0
  67. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_gcs.py +0 -0
  68. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_http.py +0 -0
  69. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_http_auth.py +0 -0
  70. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_local.py +0 -0
  71. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_sync.py +0 -0
  72. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_syncpath.py +0 -0
  73. {asanypath-2.0.1 → asanypath-2.1.1}/tests/test_unsupported_path.py +0 -0
@@ -102,7 +102,7 @@ jobs:
102
102
  rm rust/Cargo.toml.bak
103
103
 
104
104
  - name: Set up uv
105
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
105
+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
106
106
  with:
107
107
  enable-cache: false
108
108
 
@@ -128,7 +128,7 @@ jobs:
128
128
  persist-credentials: false
129
129
 
130
130
  - name: Set up uv
131
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
131
+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
132
132
  with:
133
133
  enable-cache: false
134
134
 
@@ -44,7 +44,7 @@ jobs:
44
44
  python-version: ${{ matrix.python-version }}
45
45
 
46
46
  - name: Set up uv
47
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
47
+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
48
48
 
49
49
  - name: Ruff checks
50
50
  run: uvx ruff check src tests && uvx ruff format --check src tests
@@ -15,6 +15,7 @@ __pycache__
15
15
  !.github/**
16
16
  !*.py
17
17
  !*.pyi
18
+ !py.typed
18
19
  !asanypath.png
19
20
  # auto-generated by hatch-vcs
20
21
  _version.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: asanypath
3
- Version: 2.0.1
3
+ Version: 2.1.1
4
4
  Summary: Async pathlib for local and cloud storage
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -19,17 +19,17 @@ Classifier: Programming Language :: Python :: 3.14
19
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
20
  Requires-Python: >=3.10
21
21
  Requires-Dist: anyio>=4
22
- Requires-Dist: asanypath-native~=2.0.0
23
- Requires-Dist: msgspec>=0.21.1
22
+ Requires-Dist: asanypath-native~=2.1.0
23
+ Requires-Dist: msgspec>=0.22.0
24
24
  Requires-Dist: yarl>=1.2
25
25
  Provides-Extra: all
26
26
  Requires-Dist: aioftp>=0.21; extra == 'all'
27
- Requires-Dist: asyncssh>=2.14; extra == 'all'
28
27
  Requires-Dist: keyring>=24; extra == 'all'
29
28
  Provides-Extra: bench
30
29
  Requires-Dist: adlfs; extra == 'bench'
31
30
  Requires-Dist: aiobotocore; extra == 'bench'
32
31
  Requires-Dist: aiofiles; extra == 'bench'
32
+ Requires-Dist: asyncssh>=2.14; extra == 'bench'
33
33
  Requires-Dist: azure-storage-blob; extra == 'bench'
34
34
  Requires-Dist: cloudpathlib[all]; extra == 'bench'
35
35
  Requires-Dist: fsspec; extra == 'bench'
@@ -43,7 +43,6 @@ Provides-Extra: credstore
43
43
  Requires-Dist: keyring>=24; extra == 'credstore'
44
44
  Provides-Extra: dev
45
45
  Requires-Dist: aioftp>=0.21; extra == 'dev'
46
- Requires-Dist: asyncssh>=2.14; extra == 'dev'
47
46
  Requires-Dist: keyring>=24; extra == 'dev'
48
47
  Requires-Dist: pre-commit>=4; extra == 'dev'
49
48
  Requires-Dist: pytest-asyncio>=1.3; extra == 'dev'
@@ -52,8 +51,6 @@ Requires-Dist: pytest>=8; extra == 'dev'
52
51
  Requires-Dist: rich-click>=1.9.7; extra == 'dev'
53
52
  Provides-Extra: ftp
54
53
  Requires-Dist: aioftp>=0.21; extra == 'ftp'
55
- Provides-Extra: ssh
56
- Requires-Dist: asyncssh>=2.14; extra == 'ssh'
57
54
  Description-Content-Type: text/markdown
58
55
 
59
56
  ©2026 Axis Communications AB. AXIS COMMUNICATIONS, AXIS, ARTPEC and VAPIX are registered trademarks of Axis AB in various jurisdictions. All other trademarks are the property of their respective owners.
@@ -76,6 +73,9 @@ locally before connecting to a cloud account.
76
73
 
77
74
  - Python 3.10 through 3.14.
78
75
  - Access credentials for each cloud service that your application uses.
76
+
77
+ S3 authentication accepts explicit keys or uses the AWS SDK credential provider
78
+ chain (including shared profiles and IAM roles) when keys are not supplied.
79
79
  - A POSIX-compatible shell such as Bash or Zsh for the terminal commands below.
80
80
  Windows users can use Windows Subsystem for Linux or adapt the commands for
81
81
  PowerShell.
@@ -182,8 +182,8 @@ uv sync
182
182
  # With CLI
183
183
  uv sync --extra cli
184
184
 
185
- # With SSH, FTP backend support
186
- uv sync --extra ssh --extra ftp
185
+ # With FTP backend support (SSH/SFTP is built in — no extra needed)
186
+ uv sync --extra ftp
187
187
 
188
188
  # With OS keyring-backed credential cache
189
189
  uv sync --extra credstore
@@ -343,63 +343,66 @@ uv run --extra bench python scripts/bench.py --backend art --rounds 3 --concurre
343
343
 
344
344
  | Operation | asanypath | s3fs | aiobotocore | cloudpathlib |
345
345
  |-----------|-----------|------|-------------|--------------|
346
- | write | 8.47 ms | 9.52 ms | 43.39 ms | 48.02 ms |
347
- | read | 4.03 ms | 9.43 ms | 20.16 ms | 13.30 ms |
348
- | exists | 3.58 ms | 4.54 ms | 20.49 ms | 4.48 ms |
349
- | iterdir | 38.91 ms | 39.33 ms | 57.76 ms | 41.95 ms |
346
+ | write | **8.80 ms** | 12.67 ms | 28.07 ms | 41.75 ms |
347
+ | read | **3.78 ms** | 9.10 ms | 23.15 ms | 12.83 ms |
348
+ | exists | **3.57 ms** | 4.25 ms | 21.92 ms | 4.02 ms |
349
+ | iterdir | 40.55 ms | 39.16 ms | 56.49 ms | **39.07 ms** |
350
350
 
351
351
  ### Azure — Azurite emulator (median of 20 rounds, 10 objects, c=1)
352
352
 
353
353
  | Operation | asanypath | azure-sdk | adlfs | cloudpathlib |
354
354
  |-----------|-----------|-----------|-------|--------------|
355
- | write | 1.77 ms | 1.86 ms | 1.93 ms | 8.29 ms |
356
- | read | 0.68 ms | 1.15 ms | 2.50 ms | 3.46 ms |
357
- | exists | 0.56 ms | 0.83 ms | 1.04 ms | 1.02 ms |
358
- | iterdir | 1.34 ms | 2.21 ms | 4.37 ms | 2.59 ms |
355
+ | write | **1.24 ms** | 1.79 ms | 2.34 ms | 7.88 ms |
356
+ | read | **0.51 ms** | 1.15 ms | 2.44 ms | 3.19 ms |
357
+ | exists | **0.35 ms** | 0.95 ms | 0.98 ms | 1.04 ms |
358
+ | iterdir | **0.88 ms** | 2.40 ms | 4.11 ms | 2.72 ms |
359
359
 
360
360
  ### GCS — fake-gcs-server emulator (median of 20 rounds, 10 objects, c=1)
361
361
 
362
362
  | Operation | asanypath | gcloud-aio | cloudpathlib | gcsfs |
363
363
  |-----------|-----------|------------|--------------|-------|
364
- | write | 0.22 ms | 0.24 ms | 2.88 ms | 0.33 ms |
365
- | read | 0.12 ms | 0.14 ms | 1.34 ms | 0.19 ms |
366
- | exists | 0.12 ms | 0.14 ms | 0.44 ms | 0.41 ms |
367
- | iterdir | 0.20 ms | 0.16 ms | 0.55 ms | 0.24 ms |
364
+ | write | **0.45 ms** | 0.51 ms | 3.53 ms | 0.58 ms |
365
+ | read | 0.22 ms | **0.18 ms** | 1.48 ms | 0.30 ms |
366
+ | exists | **0.15 ms** | 0.18 ms | 0.50 ms | 0.46 ms |
367
+ | iterdir | **0.19 ms** | 0.25 ms | 0.69 ms | 0.33 ms |
368
368
 
369
369
  ### Artifactory — live server (median of 20 rounds, 10 objects, c=1)
370
370
 
371
371
  | Operation | asanypath | aiohttp | requests |
372
372
  |-----------|-----------|---------|----------|
373
- | write | 39.77 ms | 38.00 ms | 36.67 ms |
374
- | read | 4.29 ms | 4.75 ms | 5.43 ms |
375
- | exists | 2.97 ms | 3.02 ms | 4.52 ms |
376
- | iterdir | 4.59 ms | 4.18 ms | 6.26 ms |
373
+ | write | **54.49 ms** | 54.75 ms | 57.57 ms |
374
+ | read | **2.83 ms** | 3.09 ms | 12.01 ms |
375
+ | exists | 2.33 ms | **2.18 ms** | 4.61 ms |
376
+ | iterdir | **2.85 ms** | 3.07 ms | 7.88 ms |
377
377
 
378
378
  ### SSH / SFTP — localhost emulator (median of 20 rounds, 10 objects, c=1)
379
379
 
380
+ asanypath uses a built-in native russh SFTP transport (off-GIL); `asyncssh` is
381
+ shown only as a benchmark baseline.
382
+
380
383
  | Operation | asanypath | asyncssh |
381
384
  |-----------|-----------|----------|
382
- | write | 0.32 ms | 0.27 ms |
383
- | read | 0.34 ms | 0.33 ms |
384
- | exists | 0.11 ms | 0.11 ms |
385
- | iterdir | 0.52 ms | 0.40 ms |
385
+ | write | **0.16 ms** | 0.33 ms |
386
+ | read | **0.21 ms** | 0.36 ms |
387
+ | exists | **0.07 ms** | 0.11 ms |
388
+ | iterdir | **0.23 ms** | 0.44 ms |
386
389
 
387
390
  ### FTP — localhost emulator (median of 20 rounds, 10 objects, c=1)
388
391
 
389
392
  | Operation | asanypath | aioftp |
390
393
  |-----------|-----------|--------|
391
- | write | 0.40 ms | 0.34 ms |
392
- | read | 0.36 ms | 0.32 ms |
393
- | exists | 1.12 ms | 0.92 ms |
394
- | iterdir | 1.10 ms | 0.92 ms |
394
+ | write | **0.35 ms** | 0.41 ms |
395
+ | read | **0.35 ms** | 0.40 ms |
396
+ | exists | **1.00 ms** | 1.13 ms |
397
+ | iterdir | 1.09 ms | **1.04 ms** |
395
398
 
396
399
  Latencies are per-operation medians over 20 rounds. S3 and Artifactory ran
397
400
  against live services; Azure, GCS, SSH/SFTP, and FTP against local emulators
398
401
  (Azurite, fake-gcs-server, and localhost sftp/ftp), so those figures reflect
399
- client-library overhead, not WAN latency. (A direct live-remote SSH run confirms
400
- the tie — asanypath vs asyncssh within noise.) asanypath matches or beats
401
- dedicated client libraries on most operations while providing a single unified
402
- API across all backends.
402
+ client-library overhead, not WAN latency. The SSH/SFTP transport is a built-in
403
+ native russh backend that runs SFTP off-GIL and beats asyncssh on every
404
+ operation. asanypath matches or beats dedicated client libraries on most
405
+ operations while providing a single unified API across all backends.
403
406
 
404
407
  ## How It Works
405
408
 
@@ -413,9 +416,17 @@ API across all backends.
413
416
  | `az://`, `azure://` | `AzurePath` | reqwest + SharedKey |
414
417
  | `art://` | `ArtifactoryPath` | reqwest + Bearer |
415
418
  | `http://`, `https://` | `HTTPPath` / `HTTPSPath` | reqwest |
416
-
417
- All network I/O is handled by `asanypath-native` (Rust/PyO3 + reqwest) with
418
- jittered exponential backoff retry for transient errors.
419
+ | `ssh://` | `SSHPath` | native russh (SFTP) |
420
+ | `ftp://` | `FTPPath` | `aioftp` |
421
+ | `ftps://` | `FTPSPath` | `aioftp` + TLS |
422
+ | any other scheme | `UnsupportedProtocolPath` | none — pure-path only |
423
+
424
+ Cloud and HTTP network I/O is handled by `asanypath-native` (Rust/PyO3 + reqwest)
425
+ with jittered exponential backoff retry for transient errors. SSH/SFTP uses a
426
+ built-in off-GIL native russh transport (no Python SSH dependency); FTP/FTPS use
427
+ `aioftp`. Unknown schemes construct an `UnsupportedProtocolPath`: pure-path
428
+ operations (`.name`, `.parent`, joins) work, while any backend operation raises
429
+ `UnsupportedProtocolError`.
419
430
 
420
431
  ## API Reference
421
432
 
@@ -18,6 +18,9 @@ locally before connecting to a cloud account.
18
18
 
19
19
  - Python 3.10 through 3.14.
20
20
  - Access credentials for each cloud service that your application uses.
21
+
22
+ S3 authentication accepts explicit keys or uses the AWS SDK credential provider
23
+ chain (including shared profiles and IAM roles) when keys are not supplied.
21
24
  - A POSIX-compatible shell such as Bash or Zsh for the terminal commands below.
22
25
  Windows users can use Windows Subsystem for Linux or adapt the commands for
23
26
  PowerShell.
@@ -124,8 +127,8 @@ uv sync
124
127
  # With CLI
125
128
  uv sync --extra cli
126
129
 
127
- # With SSH, FTP backend support
128
- uv sync --extra ssh --extra ftp
130
+ # With FTP backend support (SSH/SFTP is built in — no extra needed)
131
+ uv sync --extra ftp
129
132
 
130
133
  # With OS keyring-backed credential cache
131
134
  uv sync --extra credstore
@@ -285,63 +288,66 @@ uv run --extra bench python scripts/bench.py --backend art --rounds 3 --concurre
285
288
 
286
289
  | Operation | asanypath | s3fs | aiobotocore | cloudpathlib |
287
290
  |-----------|-----------|------|-------------|--------------|
288
- | write | 8.47 ms | 9.52 ms | 43.39 ms | 48.02 ms |
289
- | read | 4.03 ms | 9.43 ms | 20.16 ms | 13.30 ms |
290
- | exists | 3.58 ms | 4.54 ms | 20.49 ms | 4.48 ms |
291
- | iterdir | 38.91 ms | 39.33 ms | 57.76 ms | 41.95 ms |
291
+ | write | **8.80 ms** | 12.67 ms | 28.07 ms | 41.75 ms |
292
+ | read | **3.78 ms** | 9.10 ms | 23.15 ms | 12.83 ms |
293
+ | exists | **3.57 ms** | 4.25 ms | 21.92 ms | 4.02 ms |
294
+ | iterdir | 40.55 ms | 39.16 ms | 56.49 ms | **39.07 ms** |
292
295
 
293
296
  ### Azure — Azurite emulator (median of 20 rounds, 10 objects, c=1)
294
297
 
295
298
  | Operation | asanypath | azure-sdk | adlfs | cloudpathlib |
296
299
  |-----------|-----------|-----------|-------|--------------|
297
- | write | 1.77 ms | 1.86 ms | 1.93 ms | 8.29 ms |
298
- | read | 0.68 ms | 1.15 ms | 2.50 ms | 3.46 ms |
299
- | exists | 0.56 ms | 0.83 ms | 1.04 ms | 1.02 ms |
300
- | iterdir | 1.34 ms | 2.21 ms | 4.37 ms | 2.59 ms |
300
+ | write | **1.24 ms** | 1.79 ms | 2.34 ms | 7.88 ms |
301
+ | read | **0.51 ms** | 1.15 ms | 2.44 ms | 3.19 ms |
302
+ | exists | **0.35 ms** | 0.95 ms | 0.98 ms | 1.04 ms |
303
+ | iterdir | **0.88 ms** | 2.40 ms | 4.11 ms | 2.72 ms |
301
304
 
302
305
  ### GCS — fake-gcs-server emulator (median of 20 rounds, 10 objects, c=1)
303
306
 
304
307
  | Operation | asanypath | gcloud-aio | cloudpathlib | gcsfs |
305
308
  |-----------|-----------|------------|--------------|-------|
306
- | write | 0.22 ms | 0.24 ms | 2.88 ms | 0.33 ms |
307
- | read | 0.12 ms | 0.14 ms | 1.34 ms | 0.19 ms |
308
- | exists | 0.12 ms | 0.14 ms | 0.44 ms | 0.41 ms |
309
- | iterdir | 0.20 ms | 0.16 ms | 0.55 ms | 0.24 ms |
309
+ | write | **0.45 ms** | 0.51 ms | 3.53 ms | 0.58 ms |
310
+ | read | 0.22 ms | **0.18 ms** | 1.48 ms | 0.30 ms |
311
+ | exists | **0.15 ms** | 0.18 ms | 0.50 ms | 0.46 ms |
312
+ | iterdir | **0.19 ms** | 0.25 ms | 0.69 ms | 0.33 ms |
310
313
 
311
314
  ### Artifactory — live server (median of 20 rounds, 10 objects, c=1)
312
315
 
313
316
  | Operation | asanypath | aiohttp | requests |
314
317
  |-----------|-----------|---------|----------|
315
- | write | 39.77 ms | 38.00 ms | 36.67 ms |
316
- | read | 4.29 ms | 4.75 ms | 5.43 ms |
317
- | exists | 2.97 ms | 3.02 ms | 4.52 ms |
318
- | iterdir | 4.59 ms | 4.18 ms | 6.26 ms |
318
+ | write | **54.49 ms** | 54.75 ms | 57.57 ms |
319
+ | read | **2.83 ms** | 3.09 ms | 12.01 ms |
320
+ | exists | 2.33 ms | **2.18 ms** | 4.61 ms |
321
+ | iterdir | **2.85 ms** | 3.07 ms | 7.88 ms |
319
322
 
320
323
  ### SSH / SFTP — localhost emulator (median of 20 rounds, 10 objects, c=1)
321
324
 
325
+ asanypath uses a built-in native russh SFTP transport (off-GIL); `asyncssh` is
326
+ shown only as a benchmark baseline.
327
+
322
328
  | Operation | asanypath | asyncssh |
323
329
  |-----------|-----------|----------|
324
- | write | 0.32 ms | 0.27 ms |
325
- | read | 0.34 ms | 0.33 ms |
326
- | exists | 0.11 ms | 0.11 ms |
327
- | iterdir | 0.52 ms | 0.40 ms |
330
+ | write | **0.16 ms** | 0.33 ms |
331
+ | read | **0.21 ms** | 0.36 ms |
332
+ | exists | **0.07 ms** | 0.11 ms |
333
+ | iterdir | **0.23 ms** | 0.44 ms |
328
334
 
329
335
  ### FTP — localhost emulator (median of 20 rounds, 10 objects, c=1)
330
336
 
331
337
  | Operation | asanypath | aioftp |
332
338
  |-----------|-----------|--------|
333
- | write | 0.40 ms | 0.34 ms |
334
- | read | 0.36 ms | 0.32 ms |
335
- | exists | 1.12 ms | 0.92 ms |
336
- | iterdir | 1.10 ms | 0.92 ms |
339
+ | write | **0.35 ms** | 0.41 ms |
340
+ | read | **0.35 ms** | 0.40 ms |
341
+ | exists | **1.00 ms** | 1.13 ms |
342
+ | iterdir | 1.09 ms | **1.04 ms** |
337
343
 
338
344
  Latencies are per-operation medians over 20 rounds. S3 and Artifactory ran
339
345
  against live services; Azure, GCS, SSH/SFTP, and FTP against local emulators
340
346
  (Azurite, fake-gcs-server, and localhost sftp/ftp), so those figures reflect
341
- client-library overhead, not WAN latency. (A direct live-remote SSH run confirms
342
- the tie — asanypath vs asyncssh within noise.) asanypath matches or beats
343
- dedicated client libraries on most operations while providing a single unified
344
- API across all backends.
347
+ client-library overhead, not WAN latency. The SSH/SFTP transport is a built-in
348
+ native russh backend that runs SFTP off-GIL and beats asyncssh on every
349
+ operation. asanypath matches or beats dedicated client libraries on most
350
+ operations while providing a single unified API across all backends.
345
351
 
346
352
  ## How It Works
347
353
 
@@ -355,9 +361,17 @@ API across all backends.
355
361
  | `az://`, `azure://` | `AzurePath` | reqwest + SharedKey |
356
362
  | `art://` | `ArtifactoryPath` | reqwest + Bearer |
357
363
  | `http://`, `https://` | `HTTPPath` / `HTTPSPath` | reqwest |
358
-
359
- All network I/O is handled by `asanypath-native` (Rust/PyO3 + reqwest) with
360
- jittered exponential backoff retry for transient errors.
364
+ | `ssh://` | `SSHPath` | native russh (SFTP) |
365
+ | `ftp://` | `FTPPath` | `aioftp` |
366
+ | `ftps://` | `FTPSPath` | `aioftp` + TLS |
367
+ | any other scheme | `UnsupportedProtocolPath` | none — pure-path only |
368
+
369
+ Cloud and HTTP network I/O is handled by `asanypath-native` (Rust/PyO3 + reqwest)
370
+ with jittered exponential backoff retry for transient errors. SSH/SFTP uses a
371
+ built-in off-GIL native russh transport (no Python SSH dependency); FTP/FTPS use
372
+ `aioftp`. Unknown schemes construct an `UnsupportedProtocolPath`: pure-path
373
+ operations (`.name`, `.parent`, joins) work, while any backend operation raises
374
+ `UnsupportedProtocolError`.
361
375
 
362
376
  ## API Reference
363
377
 
@@ -15,6 +15,6 @@ class PinNativeHook(MetadataHookInterface):
15
15
  metadata["dependencies"] = [
16
16
  "anyio>=4",
17
17
  f"asanypath-native~={major}.{minor}.0",
18
- "msgspec>=0.21.1",
18
+ "msgspec>=0.22.0",
19
19
  "yarl>=1.2",
20
20
  ]
@@ -57,9 +57,9 @@ dev = [
57
57
  ]
58
58
  cli = ["rich-click>=1.9.7"]
59
59
  ftp = ["aioftp>=0.21"]
60
- ssh = ["asyncssh>=2.14"]
61
60
  credstore = ["keyring>=24"]
62
61
  bench = [
62
+ "asyncssh>=2.14",
63
63
  "fsspec",
64
64
  "s3fs",
65
65
  "adlfs",
@@ -71,7 +71,7 @@ bench = [
71
71
  "aiofiles",
72
72
  "requests",
73
73
  ]
74
- all = ["asanypath[ssh,credstore,ftp]"]
74
+ all = ["asanypath[credstore,ftp]"]
75
75
  [project.scripts]
76
76
  asanypath = "asanypath.cli:main"
77
77
 
@@ -88,6 +88,9 @@ python_version = "3.10"
88
88
  warn_return_any = true
89
89
  warn_unused_configs = true
90
90
  disallow_untyped_defs = true
91
+ # asanypath_native.pyi lives in rust/ (its canonical home, shipped in the native
92
+ # wheel by maturin); keep it resolvable for dev type-checking.
93
+ mypy_path = ["src", "rust"]
91
94
 
92
95
  [[tool.mypy.overrides]]
93
96
  module = "asanypath.cli"
@@ -111,7 +114,7 @@ disable_error_code = ["arg-type", "assignment", "misc", "attr-defined"]
111
114
  module = "asanypath.http"
112
115
  disallow_untyped_defs = false
113
116
  warn_return_any = false
114
- disable_error_code = ["override", "type-arg", "return-value", "assignment"]
117
+ disable_error_code = ["override", "type-arg", "return-value", "assignment", "attr-defined"]
115
118
 
116
119
  [[tool.mypy.overrides]]
117
120
  module = ["asanypath.s3", "asanypath.gcs", "asanypath.azure", "asanypath.artifactory"]
@@ -15,6 +15,8 @@ from hashlib import sha256
15
15
  from pathlib import Path
16
16
  from typing import Any
17
17
 
18
+ from asanypath.exceptions import UnsupportedProtocolError
19
+
18
20
  _CHECKSUM_PREFERENCE = ("sha256", "sha1", "md5")
19
21
 
20
22
  # Default streaming chunk size for chunk_size=None ("auto").
@@ -79,19 +81,25 @@ def _normalized_checksums(checksums: dict[str, str]) -> dict[str, str]:
79
81
  def is_remote_destination(dst: Any) -> bool:
80
82
  protocol = getattr(dst, "protocol", None)
81
83
  if protocol is not None:
82
- return protocol != "file"
84
+ return bool(protocol != "file")
83
85
  value = str(dst)
84
86
  return "://" in value and not value.startswith("file:")
85
87
 
86
88
 
87
89
  def has_async_transfer_api(dst: Any) -> bool:
88
- return inspect.iscoroutinefunction(
89
- getattr(dst, "exists", None)
90
- ) and inspect.iscoroutinefunction(getattr(dst, "write_bytes", None))
90
+ try:
91
+ exists = getattr(dst, "exists", None)
92
+ write_bytes = getattr(dst, "write_bytes", None)
93
+ except UnsupportedProtocolError:
94
+ return False
95
+ return inspect.iscoroutinefunction(exists) and inspect.iscoroutinefunction(write_bytes)
91
96
 
92
97
 
93
98
  def has_write_api(dst: Any) -> bool:
94
- return callable(getattr(dst, "write_bytes", None))
99
+ try:
100
+ return callable(getattr(dst, "write_bytes", None))
101
+ except UnsupportedProtocolError:
102
+ return False
95
103
 
96
104
 
97
105
  def run_sync_maybe(value: Any) -> Any:
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '2.0.1'
22
- __version_tuple__ = version_tuple = (2, 0, 1)
21
+ __version__ = version = '2.1.1'
22
+ __version_tuple__ = version_tuple = (2, 1, 1)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -21,8 +21,6 @@ import msgspec
21
21
  if TYPE_CHECKING:
22
22
  from typing import Self
23
23
 
24
- from asanypath.cloud import CloudPathMixin
25
- from asanypath.options import AccessGrant, AccessPolicy, AccessPolicyPatch, BackendOptions
26
24
  from asanypath_native import (
27
25
  art_copy_batch,
28
26
  art_delete_batch,
@@ -36,6 +34,9 @@ from asanypath_native import (
36
34
  art_storage_info,
37
35
  )
38
36
 
37
+ from asanypath.cloud import CloudPathMixin
38
+ from asanypath.options import AccessGrant, AccessPolicy, AccessPolicyPatch, BackendOptions
39
+
39
40
 
40
41
  def _jfrog_conf_token(base_url: str) -> str | None:
41
42
  """Return an access token from the JFrog CLI config matching ``base_url``.
@@ -170,6 +171,18 @@ class ArtifactoryPath(CloudPathMixin):
170
171
  def _item_path(self) -> str:
171
172
  return self._repo_path
172
173
 
174
+ def _bind_path_attrs(self) -> None:
175
+ raw = str(self)[len("art://") :]
176
+ idx = raw.find("/artifactory/")
177
+ if idx >= 0:
178
+ self._base_url = raw[: idx + len("/artifactory")]
179
+ self._repo_path = raw[idx + len("/artifactory/") :]
180
+ else:
181
+ self._base_url = raw.split("/")[0]
182
+ self._repo_path = "/".join(raw.split("/")[1:])
183
+ self._is_folder = None
184
+ self._cached_info = None
185
+
173
186
  @property
174
187
  def _native_kwargs(self) -> dict:
175
188
  return {
@@ -234,9 +247,7 @@ class ArtifactoryPath(CloudPathMixin):
234
247
  containers = await self._list_containers()
235
248
  if containers is not None:
236
249
  for uri in containers:
237
- child = type(self)(uri)
238
- child._token = self._token
239
- yield child
250
+ yield self._child(uri)
240
251
  return
241
252
  batcher = self._get_batcher()
242
253
  results = await batcher.list(
@@ -247,10 +258,7 @@ class ArtifactoryPath(CloudPathMixin):
247
258
  base = str(self).rstrip("/")
248
259
  for uri, is_folder in results:
249
260
  child_name = uri.rsplit("/", 1)[-1]
250
- child_path = type(self)(f"{base}/{child_name}")
251
- child_path._token = self._token
252
- child_path._is_folder = is_folder
253
- yield child_path
261
+ yield self._child(f"{base}/{child_name}", _is_folder=is_folder)
254
262
 
255
263
  async def _list_containers(self) -> list[str] | None:
256
264
  """List repositories when at the server root (``art://<host>/artifactory/``).
@@ -447,7 +447,7 @@ class AsAnyPath(AsAnyPurePath):
447
447
  pass
448
448
 
449
449
  @abstractmethod
450
- async def rmdir(self) -> None:
450
+ async def rmdir(self, *, recursive: bool = False) -> None:
451
451
  pass
452
452
 
453
453
  @abstractmethod
@@ -185,7 +185,7 @@ class AsAnyPath(AsAnyPurePath):
185
185
  async def rglob(
186
186
  self, pattern: str, *, case_sensitive: bool | None = None
187
187
  ) -> AsyncIterator[Self]: ...
188
- async def rmdir(self) -> None: ...
188
+ async def rmdir(self, *, recursive: bool = False) -> None: ...
189
189
  def samefile(self, other_path: str | PathLike[str]) -> bool: ...
190
190
  async def stat(self, *, follow_symlinks: bool = True) -> stat_result: ...
191
191
  def symlink_to(
@@ -18,9 +18,6 @@ from os import getenv
18
18
  from types import SimpleNamespace
19
19
 
20
20
  import msgspec
21
-
22
- from asanypath.cloud import CloudPathMixin
23
- from asanypath.options import AccessGrant, AccessPolicy, AccessPolicyPatch, BackendOptions
24
21
  from asanypath_native import (
25
22
  az_copy_batch,
26
23
  az_delete_batch,
@@ -37,6 +34,9 @@ from asanypath_native import (
37
34
  az_put_container_acl,
38
35
  )
39
36
 
37
+ from asanypath.cloud import CloudPathMixin
38
+ from asanypath.options import AccessGrant, AccessPolicy, AccessPolicyPatch, BackendOptions
39
+
40
40
  AZURE_API_VERSION = "2023-11-03"
41
41
 
42
42
 
@@ -162,6 +162,10 @@ class AzurePath(CloudPathMixin):
162
162
  def _item_path(self) -> str:
163
163
  return self._blob_path
164
164
 
165
+ def _bind_path_attrs(self) -> None:
166
+ self._container = self._path.host or ""
167
+ self._blob_path = self._path.path.lstrip("/")
168
+
165
169
  @property
166
170
  def _native_kwargs(self) -> dict:
167
171
  return {
@@ -504,7 +504,7 @@ def _maybe_rewrite_scp_style(value: str, check_config: bool = True) -> str:
504
504
  return value
505
505
  if not _discover_ssh_config():
506
506
  return value
507
- resolved_host, _, _ = _resolve_alias(host, None, None)
507
+ resolved_host, _, _, _ = _resolve_alias(host, None, None)
508
508
  if resolved_host == host:
509
509
  # No Host block matched — leave alone (don't probe DNS).
510
510
  return value
@@ -1383,8 +1383,8 @@ def ls(
1383
1383
  found_any = bool(rows)
1384
1384
 
1385
1385
  if not found_any:
1386
- console.print("[dim](empty)[/dim]")
1387
- return 0
1386
+ # No results is a non-match: exit non-zero like grep/aws s3 ls.
1387
+ return 1
1388
1388
 
1389
1389
  if simple:
1390
1390
  for row in rows: