asanypath 2.6.0__tar.gz → 2.6.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 (85) hide show
  1. {asanypath-2.6.0 → asanypath-2.6.1}/.github/workflows/publish.yml +5 -5
  2. {asanypath-2.6.0 → asanypath-2.6.1}/.github/workflows/unittests.yml +2 -2
  3. {asanypath-2.6.0 → asanypath-2.6.1}/PKG-INFO +6 -2
  4. {asanypath-2.6.0 → asanypath-2.6.1}/README.md +4 -0
  5. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/_version.py +2 -2
  6. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/artifactory.py +2 -2
  7. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_auth_errors.py +83 -1
  8. {asanypath-2.6.0 → asanypath-2.6.1}/.copilot/skills/async-python-lib/SKILL.md +0 -0
  9. {asanypath-2.6.0 → asanypath-2.6.1}/.copilot/skills/gitguro/SKILL.md +0 -0
  10. {asanypath-2.6.0 → asanypath-2.6.1}/.github/CODEOWNERS +0 -0
  11. {asanypath-2.6.0 → asanypath-2.6.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  12. {asanypath-2.6.0 → asanypath-2.6.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  13. {asanypath-2.6.0 → asanypath-2.6.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  14. {asanypath-2.6.0 → asanypath-2.6.1}/.github/dependabot.yml +0 -0
  15. {asanypath-2.6.0 → asanypath-2.6.1}/.gitignore +0 -0
  16. {asanypath-2.6.0 → asanypath-2.6.1}/.pre-commit-config.yaml +0 -0
  17. {asanypath-2.6.0 → asanypath-2.6.1}/CODE_OF_CONDUCT.md +0 -0
  18. {asanypath-2.6.0 → asanypath-2.6.1}/CONTRIBUTING.md +0 -0
  19. {asanypath-2.6.0 → asanypath-2.6.1}/LICENSE +0 -0
  20. {asanypath-2.6.0 → asanypath-2.6.1}/asanypath.png +0 -0
  21. {asanypath-2.6.0 → asanypath-2.6.1}/compose.yml +0 -0
  22. {asanypath-2.6.0 → asanypath-2.6.1}/hatch_build.py +0 -0
  23. {asanypath-2.6.0 → asanypath-2.6.1}/pyproject.toml +0 -0
  24. {asanypath-2.6.0 → asanypath-2.6.1}/scripts/bench.py +0 -0
  25. {asanypath-2.6.0 → asanypath-2.6.1}/scripts/bench_rmtree.py +0 -0
  26. {asanypath-2.6.0 → asanypath-2.6.1}/scripts/bench_upload.py +0 -0
  27. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/__init__.py +0 -0
  28. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/__init__.pyi +0 -0
  29. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/_backend_opts.py +0 -0
  30. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/_credstore.py +0 -0
  31. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/_prompt.py +0 -0
  32. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/_resume.py +0 -0
  33. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/_transfer.py +0 -0
  34. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/asanypath.py +0 -0
  35. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/asanypath.pyi +0 -0
  36. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/azure.py +0 -0
  37. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/batcher.py +0 -0
  38. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/cache.py +0 -0
  39. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/cli.py +0 -0
  40. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/click.py +0 -0
  41. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/cloud.py +0 -0
  42. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/common.py +0 -0
  43. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/exceptions.py +0 -0
  44. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/ftp.py +0 -0
  45. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/gcs.py +0 -0
  46. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/http.py +0 -0
  47. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/local.py +0 -0
  48. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/options.py +0 -0
  49. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/py.typed +0 -0
  50. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/s3.py +0 -0
  51. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/ssh.py +0 -0
  52. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/sync.py +0 -0
  53. {asanypath-2.6.0 → asanypath-2.6.1}/src/asanypath/unsupported.py +0 -0
  54. {asanypath-2.6.0 → asanypath-2.6.1}/tests/__init__.py +0 -0
  55. {asanypath-2.6.0 → asanypath-2.6.1}/tests/conftest.py +0 -0
  56. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_artifactory.py +0 -0
  57. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_asanypath.py +0 -0
  58. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_azure.py +0 -0
  59. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_backend_options.py +0 -0
  60. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_batcher.py +0 -0
  61. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_cache.py +0 -0
  62. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_cli.py +0 -0
  63. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_click.py +0 -0
  64. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_cloudpathmixin.py +0 -0
  65. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_commonpathmixin.py +0 -0
  66. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_credstore.py +0 -0
  67. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_endpoints.py +0 -0
  68. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_ftp.py +0 -0
  69. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_gcs.py +0 -0
  70. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_http.py +0 -0
  71. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_http_auth.py +0 -0
  72. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_isolation.py +0 -0
  73. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_local.py +0 -0
  74. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_options.py +0 -0
  75. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_py_typed.py +0 -0
  76. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_resume.py +0 -0
  77. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_s3.py +0 -0
  78. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_scandir.py +0 -0
  79. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_ssh.py +0 -0
  80. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_ssh_hostkeys.py +0 -0
  81. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_sync.py +0 -0
  82. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_syncpath.py +0 -0
  83. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_transport_hardening.py +0 -0
  84. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_unsupported_path.py +0 -0
  85. {asanypath-2.6.0 → asanypath-2.6.1}/tests/test_upload.py +0 -0
@@ -71,7 +71,7 @@ jobs:
71
71
  # macOS and Windows build against the runner's.
72
72
  - name: Set up Python interpreters
73
73
  if: runner.os != 'Linux'
74
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
74
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
75
75
  with:
76
76
  python-version: |
77
77
  3.10
@@ -116,7 +116,7 @@ jobs:
116
116
  rm rust/Cargo.toml.bak
117
117
 
118
118
  - name: Set up uv
119
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
119
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
120
120
  with:
121
121
  enable-cache: false
122
122
 
@@ -142,7 +142,7 @@ jobs:
142
142
  persist-credentials: false
143
143
 
144
144
  - name: Set up uv
145
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
145
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
146
146
  with:
147
147
  enable-cache: false
148
148
 
@@ -179,7 +179,7 @@ jobs:
179
179
  merge-multiple: true
180
180
 
181
181
  - name: Publish native distribution
182
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
182
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
183
183
  with:
184
184
  packages-dir: dist
185
185
 
@@ -199,6 +199,6 @@ jobs:
199
199
  path: dist
200
200
 
201
201
  - name: Publish Python distribution
202
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
202
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
203
203
  with:
204
204
  packages-dir: dist
@@ -39,12 +39,12 @@ jobs:
39
39
  persist-credentials: false
40
40
 
41
41
  - name: Set up Python
42
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
42
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
43
43
  with:
44
44
  python-version: ${{ matrix.python-version }}
45
45
 
46
46
  - name: Set up uv
47
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
47
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
48
48
 
49
49
  - name: Ruff checks
50
50
  run: uvx ruff check src tests && uvx ruff format --check src tests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: asanypath
3
- Version: 2.6.0
3
+ Version: 2.6.1
4
4
  Summary: Async pathlib for local and cloud storage
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -20,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.15
20
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
21
  Requires-Python: >=3.10
22
22
  Requires-Dist: anyio>=4
23
- Requires-Dist: asanypath-native~=2.6.0
23
+ Requires-Dist: asanypath-native~=2.6.1
24
24
  Requires-Dist: msgspec>=0.22.0
25
25
  Requires-Dist: yarl>=1.2
26
26
  Provides-Extra: all
@@ -187,6 +187,10 @@ anonymous, which is enough for repositories open to anonymous reads. A
187
187
  configured token is always sent: an expired one fails instead of falling back
188
188
  to anonymous access.
189
189
 
190
+ Artifactory `exists()`, `is_file()` and `is_dir()` return `False` for missing
191
+ paths, but propagate authentication and permission errors. CLI source checks
192
+ report those errors rather than claiming the file does not exist.
193
+
190
194
  ### Copy and recursive delete
191
195
 
192
196
  ```python
@@ -130,6 +130,10 @@ anonymous, which is enough for repositories open to anonymous reads. A
130
130
  configured token is always sent: an expired one fails instead of falling back
131
131
  to anonymous access.
132
132
 
133
+ Artifactory `exists()`, `is_file()` and `is_dir()` return `False` for missing
134
+ paths, but propagate authentication and permission errors. CLI source checks
135
+ report those errors rather than claiming the file does not exist.
136
+
133
137
  ### Copy and recursive delete
134
138
 
135
139
  ```python
@@ -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.6.0'
22
- __version_tuple__ = version_tuple = (2, 6, 0)
21
+ __version__ = version = '2.6.1'
22
+ __version_tuple__ = version_tuple = (2, 6, 1)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -330,7 +330,7 @@ class ArtifactoryPath(CloudPathMixin, ServiceEndpointMixin):
330
330
  info = await self._storage_info()
331
331
  self._is_folder = "children" in info
332
332
  return self._is_folder
333
- except (FileNotFoundError, PermissionError):
333
+ except FileNotFoundError:
334
334
  return False
335
335
 
336
336
  async def is_file(self) -> bool:
@@ -340,7 +340,7 @@ class ArtifactoryPath(CloudPathMixin, ServiceEndpointMixin):
340
340
  info = await self._storage_info()
341
341
  self._is_folder = "children" in info
342
342
  return not self._is_folder
343
- except (FileNotFoundError, PermissionError):
343
+ except FileNotFoundError:
344
344
  return False
345
345
 
346
346
  async def _list_entries(self, *, stat: bool = False, fresh: bool = False) -> list[DirEntry]:
@@ -43,7 +43,14 @@ def server():
43
43
  pass
44
44
 
45
45
  def do_GET(self):
46
- status, body = (403, S3_403) if self.path == "/denied" else (401, ARTIFACTORY_401)
46
+ if self.path.endswith("/denied"):
47
+ status, body = 403, S3_403
48
+ elif self.path.endswith("/missing"):
49
+ status, body = 404, b"{}"
50
+ elif self.path.endswith("/present"):
51
+ status, body = 200, b'{"size": "1"}'
52
+ else:
53
+ status, body = 401, ARTIFACTORY_401
47
54
  self.send_response(status)
48
55
  self.send_header("Content-Length", str(len(body)))
49
56
  self.end_headers()
@@ -55,6 +62,81 @@ def server():
55
62
  srv.shutdown()
56
63
 
57
64
 
65
+ @pytest.mark.parametrize("operation", ["exists", "is_dir", "is_file", "cli_source_check"])
66
+ @pytest.mark.parametrize(
67
+ "name,error",
68
+ [("unauthorized", AuthenticationError), ("denied", PermissionError)],
69
+ )
70
+ async def test_artifactory_source_checks_preserve_auth_errors(
71
+ server, monkeypatch, operation, name, error
72
+ ):
73
+ path = ArtifactoryPath(
74
+ f"art://{server.removeprefix('http://')}/artifactory/repo/{name}", token="invalid"
75
+ )
76
+ monkeypatch.setattr(path, "_endpoint_url", f"{server}/artifactory")
77
+ if operation == "cli_source_check":
78
+ from asanypath.cli import _exists_or_virtual_dir
79
+
80
+ check = _exists_or_virtual_dir(path)
81
+ else:
82
+ check = getattr(path, operation)()
83
+ with pytest.raises(error):
84
+ await check
85
+
86
+
87
+ @pytest.mark.parametrize("operation", ["exists", "is_dir", "is_file", "cli_source_check"])
88
+ @pytest.mark.parametrize("name", ["missing", "present"])
89
+ async def test_artifactory_source_checks_distinguish_missing_files(
90
+ server, monkeypatch, operation, name
91
+ ):
92
+ path = ArtifactoryPath(
93
+ f"art://{server.removeprefix('http://')}/artifactory/repo/{name}", token="invalid"
94
+ )
95
+ monkeypatch.setattr(path, "_endpoint_url", f"{server}/artifactory")
96
+ present = name == "present"
97
+ if operation == "cli_source_check":
98
+ from asanypath.cli import _exists_or_virtual_dir
99
+
100
+ assert await _exists_or_virtual_dir(path) == (present, False)
101
+ else:
102
+ assert await getattr(path, operation)() == (present and operation != "is_dir")
103
+
104
+
105
+ @pytest.mark.parametrize(
106
+ "name,message",
107
+ [("unauthorized", "Authentication failed"), ("denied", "Permission denied")],
108
+ )
109
+ def test_artifactory_cp_reports_auth_errors(server, monkeypatch, tmp_path, name, message):
110
+ from click.testing import CliRunner
111
+
112
+ import asanypath.cli as cli_module
113
+
114
+ base = f"{server.removeprefix('http://')}/artifactory"
115
+ monkeypatch.setenv("ARTIFACTORY_BASE_URL", base)
116
+ monkeypatch.setenv("ARTIFACTORY_IDENTITY_TOKEN", "sdf")
117
+ make_path = cli_module._make_path
118
+
119
+ def local_http_path(*args, **kwargs):
120
+ path = make_path(*args, **kwargs)
121
+ if isinstance(path, ArtifactoryPath):
122
+ assert path._token == "sdf"
123
+ path._endpoint_url = f"{server}/artifactory"
124
+ return path
125
+
126
+ monkeypatch.setattr(cli_module, "_make_path", local_http_path)
127
+ destination = tmp_path / "model.bin"
128
+ result = CliRunner().invoke(
129
+ cli_module.cli, ["cp", "-vv", f"art://repo/{name}", str(destination)]
130
+ )
131
+ assert result.exit_code == 2
132
+ assert message in result.output
133
+ assert "No such file or directory" not in result.output
134
+ if name == "unauthorized":
135
+ assert "Props Authentication Token not found" in result.output
136
+ assert "ARTIFACTORY_IDENTITY_TOKEN" in result.output
137
+ assert not destination.exists()
138
+
139
+
58
140
  async def test_401_is_an_authentication_error_with_the_reason(server):
59
141
  uri = f"{server}/artifactory/repo/model.bin"
60
142
  with pytest.raises(AuthenticationError) as info:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes