rclone-api 1.4.25__tar.gz → 1.4.27__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 (112) hide show
  1. rclone_api-1.4.27/PKG-INFO +555 -0
  2. rclone_api-1.4.27/README.md +534 -0
  3. {rclone_api-1.4.25 → rclone_api-1.4.27}/pyproject.toml +1 -1
  4. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/__init__.py +2 -29
  5. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/cmd/copy_large_s3.py +1 -1
  6. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/rclone_impl.py +1 -104
  7. rclone_api-1.4.27/src/rclone_api.egg-info/PKG-INFO +555 -0
  8. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_copy_file_resumable_s3.py +2 -32
  9. rclone_api-1.4.25/PKG-INFO +0 -154
  10. rclone_api-1.4.25/README.md +0 -133
  11. rclone_api-1.4.25/src/rclone_api.egg-info/PKG-INFO +0 -154
  12. {rclone_api-1.4.25 → rclone_api-1.4.27}/.aiderignore +0 -0
  13. {rclone_api-1.4.25 → rclone_api-1.4.27}/.github/workflows/lint.yml +0 -0
  14. {rclone_api-1.4.25 → rclone_api-1.4.27}/.github/workflows/push_macos.yml +0 -0
  15. {rclone_api-1.4.25 → rclone_api-1.4.27}/.github/workflows/push_ubuntu.yml +0 -0
  16. {rclone_api-1.4.25 → rclone_api-1.4.27}/.github/workflows/push_win.yml +0 -0
  17. {rclone_api-1.4.25 → rclone_api-1.4.27}/.gitignore +0 -0
  18. {rclone_api-1.4.25 → rclone_api-1.4.27}/.pylintrc +0 -0
  19. {rclone_api-1.4.25 → rclone_api-1.4.27}/.vscode/launch.json +0 -0
  20. {rclone_api-1.4.25 → rclone_api-1.4.27}/.vscode/settings.json +0 -0
  21. {rclone_api-1.4.25 → rclone_api-1.4.27}/.vscode/tasks.json +0 -0
  22. {rclone_api-1.4.25 → rclone_api-1.4.27}/LICENSE +0 -0
  23. {rclone_api-1.4.25 → rclone_api-1.4.27}/MANIFEST.in +0 -0
  24. {rclone_api-1.4.25 → rclone_api-1.4.27}/clean +0 -0
  25. {rclone_api-1.4.25 → rclone_api-1.4.27}/install +0 -0
  26. {rclone_api-1.4.25 → rclone_api-1.4.27}/lint +0 -0
  27. {rclone_api-1.4.25 → rclone_api-1.4.27}/requirements.testing.txt +0 -0
  28. {rclone_api-1.4.25 → rclone_api-1.4.27}/setup.cfg +0 -0
  29. {rclone_api-1.4.25 → rclone_api-1.4.27}/setup.py +0 -0
  30. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/assets/example.txt +0 -0
  31. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/cli.py +0 -0
  32. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/cmd/analyze.py +0 -0
  33. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/cmd/copy_large_s3_finish.py +0 -0
  34. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/cmd/list_files.py +0 -0
  35. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/cmd/save_to_db.py +0 -0
  36. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/completed_process.py +0 -0
  37. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/config.py +0 -0
  38. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/convert.py +0 -0
  39. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/db/__init__.py +0 -0
  40. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/db/db.py +0 -0
  41. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/db/models.py +0 -0
  42. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/deprecated.py +0 -0
  43. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/detail/copy_file_parts_resumable.py +0 -0
  44. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/detail/walk.py +0 -0
  45. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/diff.py +0 -0
  46. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/dir.py +0 -0
  47. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/dir_listing.py +0 -0
  48. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/exec.py +0 -0
  49. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/experimental/flags.py +0 -0
  50. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/experimental/flags_base.py +0 -0
  51. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/file.py +0 -0
  52. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/file_item.py +0 -0
  53. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/file_part.py +0 -0
  54. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/file_stream.py +0 -0
  55. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/filelist.py +0 -0
  56. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/group_files.py +0 -0
  57. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/http_server.py +0 -0
  58. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/log.py +0 -0
  59. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/mount.py +0 -0
  60. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/process.py +0 -0
  61. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/remote.py +0 -0
  62. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/rpath.py +0 -0
  63. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/api.py +0 -0
  64. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/basic_ops.py +0 -0
  65. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/chunk_task.py +0 -0
  66. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/create.py +0 -0
  67. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/file_info.py +0 -0
  68. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/finished_piece.py +0 -0
  69. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/info_json.py +0 -0
  70. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/merge_state.py +0 -0
  71. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/upload_info.py +0 -0
  72. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/upload_parts_inline.py +0 -0
  73. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/upload_parts_resumable.py +0 -0
  74. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/upload_parts_server_side_merge.py +0 -0
  75. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/multipart/upload_state.py +0 -0
  76. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/s3/types.py +0 -0
  77. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/scan_missing_folders.py +0 -0
  78. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/types.py +0 -0
  79. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api/util.py +0 -0
  80. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api.egg-info/SOURCES.txt +0 -0
  81. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api.egg-info/dependency_links.txt +0 -0
  82. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api.egg-info/entry_points.txt +0 -0
  83. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api.egg-info/requires.txt +0 -0
  84. {rclone_api-1.4.25 → rclone_api-1.4.27}/src/rclone_api.egg-info/top_level.txt +0 -0
  85. {rclone_api-1.4.25 → rclone_api-1.4.27}/test +0 -0
  86. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/archive/test_paramiko.py.disabled +0 -0
  87. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_cmd_list_files.py +0 -0
  88. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_copy.py +0 -0
  89. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_copy_bytes.py +0 -0
  90. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_copy_files.py +0 -0
  91. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_db.py +0 -0
  92. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_diff.py +0 -0
  93. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_file_item.py +0 -0
  94. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_group_files.py +0 -0
  95. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_is_synced.py +0 -0
  96. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_ls.py +0 -0
  97. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_ls_stream_files.py +0 -0
  98. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_mount.py +0 -0
  99. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_mount_s3.py +0 -0
  100. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_obscure.py +0 -0
  101. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_rclone_config.py +0 -0
  102. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_read_write_text.py +0 -0
  103. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_remote_control.py +0 -0
  104. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_remotes.py +0 -0
  105. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_s3.py +0 -0
  106. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_scan_missing_folders.py +0 -0
  107. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_serve_http.py +0 -0
  108. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_size_files.py +0 -0
  109. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_size_suffix.py +0 -0
  110. {rclone_api-1.4.25 → rclone_api-1.4.27}/tests/test_walk.py +0 -0
  111. {rclone_api-1.4.25 → rclone_api-1.4.27}/tox.ini +0 -0
  112. {rclone_api-1.4.25 → rclone_api-1.4.27}/upload_package.sh +0 -0
@@ -0,0 +1,555 @@
1
+ Metadata-Version: 2.2
2
+ Name: rclone_api
3
+ Version: 1.4.27
4
+ Summary: rclone api in python
5
+ Home-page: https://github.com/zackees/rclone-api
6
+ License: BSD 3-Clause License
7
+ Keywords: template-python-cmd
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: pyright>=1.1.393
13
+ Requires-Dist: python-dotenv>=1.0.0
14
+ Requires-Dist: certifi>=2025.1.31
15
+ Requires-Dist: psutil
16
+ Requires-Dist: boto3<=1.35.99,>=1.20.1
17
+ Requires-Dist: sqlmodel>=0.0.23
18
+ Requires-Dist: psycopg2-binary>=2.9.10
19
+ Requires-Dist: httpx>=0.28.1
20
+ Dynamic: home-page
21
+
22
+ # rclone-api
23
+
24
+
25
+ ![perpetualmaniac_faster_400fd528-df15-4a04-8ad3-3cca786d7bca (2)](https://github.com/user-attachments/assets/65138e38-b115-447c-849a-4adbd27e4b67)
26
+
27
+
28
+ <!--
29
+ [![Linting](https://github.com/zackees/rclone-api/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/rclone-api/actions/workflows/lint.yml)
30
+ [![MacOS_Tests](https://github.com/zackees/rclone-api/actions/workflows/push_macos.yml/badge.svg)](https://github.com/zackees/rclone-api/actions/workflows/push_macos.yml)
31
+ [![Ubuntu_Tests](https://github.com/zackees/rclone-api/actions/workflows/push_ubuntu.yml/badge.svg)](https://github.com/zackees/rclone-api/actions/workflows/push_ubuntu.yml)
32
+ [![Win_Tests](https://github.com/zackees/rclone-api/actions/workflows/push_win.yml/badge.svg)](https://github.com/zackees/rclone-api/actions/workflows/push_win.yml)
33
+ -->
34
+
35
+
36
+ Got a lot of data to transfer quickly? This package is for you.
37
+
38
+ This library was built out of necessity to transfer large amounts of AI training data. Aggressive default means this api will transfer faster than rclone does in stock settings.
39
+
40
+ You must have rclone in your path to use this library. You'd want this anyway because rclone is still under heavy developement.
41
+
42
+ # Install
43
+
44
+ `pip install rclone-api`
45
+
46
+ # Quick
47
+
48
+ In addition to providing easy python use for rclone, this package provides additional features:
49
+
50
+ * Resumable multi-part uploads when s3 is the destination.
51
+ * Diffing src/dst repos as a stream of `list[str]`.
52
+ * Efficient copying of byte ranges of a file.
53
+ * Aggressive default settings for copying / syncing operations for extreme performance.
54
+ * Some platform specific fixes.
55
+
56
+
57
+ ## Example
58
+
59
+ ```python
60
+
61
+ from rclone_api import Rclone, DirListing, Config
62
+
63
+ RCLONE_CONFIG = Config("""
64
+ [dst]
65
+ type = s3
66
+ account = *********
67
+ key = ************
68
+ """)
69
+
70
+
71
+ def test_ls_glob_png(self) -> None:
72
+ rclone = Rclone(RCLONE_CONFIG)
73
+ path = f"dst:{BUCKET_NAME}/my_data"
74
+ listing: DirListing = rclone.ls(path, glob="*.png")
75
+ self.assertGreater(len(listing.files), 0)
76
+ for file in listing.files:
77
+ self.assertIsInstance(file, File)
78
+ # test that it ends with .png
79
+ self.assertTrue(file.name.endswith(".png"))
80
+ # there should be no directories with this glob
81
+ self.assertEqual(len(listing.dirs), 0)
82
+ ```
83
+
84
+ ## API
85
+
86
+ ```python
87
+
88
+ # from rclone_api import Rclone
89
+ # Rclone is the main api entry point.
90
+ class Rclone:
91
+ def __init__(
92
+ self, rclone_conf: Path | Config, rclone_exe: Path | None = None
93
+ ) -> None:
94
+ from rclone_api.rclone_impl import RcloneImpl
95
+
96
+ self.impl: RcloneImpl = RcloneImpl(rclone_conf, rclone_exe)
97
+
98
+ def webgui(self, other_args: list[str] | None = None) -> Process:
99
+ """Launch the Rclone web GUI."""
100
+ return self.impl.webgui(other_args=other_args)
101
+
102
+ def launch_server(
103
+ self,
104
+ addr: str,
105
+ user: str | None = None,
106
+ password: str | None = None,
107
+ other_args: list[str] | None = None,
108
+ ) -> Process:
109
+ """Launch the Rclone server so it can receive commands"""
110
+ return self.impl.launch_server(
111
+ addr=addr, user=user, password=password, other_args=other_args
112
+ )
113
+
114
+ def remote_control(
115
+ self,
116
+ addr: str,
117
+ user: str | None = None,
118
+ password: str | None = None,
119
+ capture: bool | None = None,
120
+ other_args: list[str] | None = None,
121
+ ) -> CompletedProcess:
122
+ return self.impl.remote_control(
123
+ addr=addr,
124
+ user=user,
125
+ password=password,
126
+ capture=capture,
127
+ other_args=other_args,
128
+ )
129
+
130
+ def obscure(self, password: str) -> str:
131
+ """Obscure a password for use in rclone config files."""
132
+ return self.impl.obscure(password=password)
133
+
134
+ def ls_stream(
135
+ self,
136
+ path: str,
137
+ max_depth: int = -1,
138
+ fast_list: bool = False,
139
+ ) -> FilesStream:
140
+ """
141
+ List files in the given path
142
+
143
+ Args:
144
+ src: Remote path to list
145
+ max_depth: Maximum recursion depth (-1 for unlimited)
146
+ fast_list: Use fast list (only use when getting THE entire data repository from the root/bucket, or it's small)
147
+ """
148
+ return self.impl.ls_stream(path=path, max_depth=max_depth, fast_list=fast_list)
149
+
150
+ def save_to_db(
151
+ self,
152
+ src: str,
153
+ db_url: str,
154
+ max_depth: int = -1,
155
+ fast_list: bool = False,
156
+ ) -> None:
157
+ """
158
+ Save files to a database (sqlite, mysql, postgres)
159
+
160
+ Args:
161
+ src: Remote path to list, this will be used to populate an entire table, so always use the root-most path.
162
+ db_url: Database URL, like sqlite:///data.db or mysql://user:pass@localhost/db or postgres://user:pass@localhost/db
163
+ max_depth: Maximum depth to traverse (-1 for unlimited)
164
+ fast_list: Use fast list (only use when getting THE entire data repository from the root/bucket)
165
+
166
+ """
167
+ return self.impl.save_to_db(
168
+ src=src, db_url=db_url, max_depth=max_depth, fast_list=fast_list
169
+ )
170
+
171
+ def ls(
172
+ self,
173
+ path: Dir | Remote | str | None = None,
174
+ max_depth: int | None = None,
175
+ glob: str | None = None,
176
+ order: Order = Order.NORMAL,
177
+ listing_option: ListingOption = ListingOption.ALL,
178
+ ) -> DirListing:
179
+ return self.impl.ls(
180
+ path=path,
181
+ max_depth=max_depth,
182
+ glob=glob,
183
+ order=order,
184
+ listing_option=listing_option,
185
+ )
186
+
187
+ def listremotes(self) -> list[Remote]:
188
+ return self.impl.listremotes()
189
+
190
+ def diff(
191
+ self,
192
+ src: str,
193
+ dst: str,
194
+ min_size: (
195
+ str | None
196
+ ) = None, # e. g. "1MB" - see rclone documentation: https://rclone.org/commands/rclone_check/
197
+ max_size: (
198
+ str | None
199
+ ) = None, # e. g. "1GB" - see rclone documentation: https://rclone.org/commands/rclone_check/
200
+ diff_option: DiffOption = DiffOption.COMBINED,
201
+ fast_list: bool = True,
202
+ size_only: bool | None = None,
203
+ checkers: int | None = None,
204
+ other_args: list[str] | None = None,
205
+ ) -> Generator[DiffItem, None, None]:
206
+ """Be extra careful with the src and dst values. If you are off by one
207
+ parent directory, you will get a huge amount of false diffs."""
208
+ return self.impl.diff(
209
+ src=src,
210
+ dst=dst,
211
+ min_size=min_size,
212
+ max_size=max_size,
213
+ diff_option=diff_option,
214
+ fast_list=fast_list,
215
+ size_only=size_only,
216
+ checkers=checkers,
217
+ other_args=other_args,
218
+ )
219
+
220
+ def walk(
221
+ self,
222
+ path: Dir | Remote | str,
223
+ max_depth: int = -1,
224
+ breadth_first: bool = True,
225
+ order: Order = Order.NORMAL,
226
+ ) -> Generator[DirListing, None, None]:
227
+ """Walk through the given path recursively.
228
+
229
+ Args:
230
+ path: Remote path or Remote object to walk through
231
+ max_depth: Maximum depth to traverse (-1 for unlimited)
232
+
233
+ Yields:
234
+ DirListing: Directory listing for each directory encountered
235
+ """
236
+ return self.impl.walk(
237
+ path=path, max_depth=max_depth, breadth_first=breadth_first, order=order
238
+ )
239
+
240
+ def scan_missing_folders(
241
+ self,
242
+ src: Dir | Remote | str,
243
+ dst: Dir | Remote | str,
244
+ max_depth: int = -1,
245
+ order: Order = Order.NORMAL,
246
+ ) -> Generator[Dir, None, None]:
247
+ """Walk through the given path recursively.
248
+
249
+ WORK IN PROGRESS!!
250
+
251
+ Args:
252
+ src: Source directory or Remote to walk through
253
+ dst: Destination directory or Remote to walk through
254
+ max_depth: Maximum depth to traverse (-1 for unlimited)
255
+
256
+ Yields:
257
+ DirListing: Directory listing for each directory encountered
258
+ """
259
+ return self.impl.scan_missing_folders(
260
+ src=src, dst=dst, max_depth=max_depth, order=order
261
+ )
262
+
263
+ def cleanup(
264
+ self, path: str, other_args: list[str] | None = None
265
+ ) -> CompletedProcess:
266
+ """Cleanup any resources used by the Rclone instance."""
267
+ return self.impl.cleanup(path=path, other_args=other_args)
268
+
269
+ def copy_to(
270
+ self,
271
+ src: File | str,
272
+ dst: File | str,
273
+ check: bool | None = None,
274
+ verbose: bool | None = None,
275
+ other_args: list[str] | None = None,
276
+ ) -> CompletedProcess:
277
+ """Copy one file from source to destination.
278
+
279
+ Warning - slow.
280
+
281
+ """
282
+ return self.impl.copy_to(
283
+ src=src, dst=dst, check=check, verbose=verbose, other_args=other_args
284
+ )
285
+
286
+ def copy_files(
287
+ self,
288
+ src: str,
289
+ dst: str,
290
+ files: list[str] | Path,
291
+ check: bool | None = None,
292
+ max_backlog: int | None = None,
293
+ verbose: bool | None = None,
294
+ checkers: int | None = None,
295
+ transfers: int | None = None,
296
+ low_level_retries: int | None = None,
297
+ retries: int | None = None,
298
+ retries_sleep: str | None = None,
299
+ metadata: bool | None = None,
300
+ timeout: str | None = None,
301
+ max_partition_workers: int | None = None,
302
+ multi_thread_streams: int | None = None,
303
+ other_args: list[str] | None = None,
304
+ ) -> list[CompletedProcess]:
305
+ """Copy multiple files from source to destination.
306
+
307
+ Args:
308
+ payload: Dictionary of source and destination file paths
309
+ """
310
+ return self.impl.copy_files(
311
+ src=src,
312
+ dst=dst,
313
+ files=files,
314
+ check=check,
315
+ max_backlog=max_backlog,
316
+ verbose=verbose,
317
+ checkers=checkers,
318
+ transfers=transfers,
319
+ low_level_retries=low_level_retries,
320
+ retries=retries,
321
+ retries_sleep=retries_sleep,
322
+ metadata=metadata,
323
+ timeout=timeout,
324
+ max_partition_workers=max_partition_workers,
325
+ multi_thread_streams=multi_thread_streams,
326
+ other_args=other_args,
327
+ )
328
+
329
+ def copy(
330
+ self,
331
+ src: Dir | str,
332
+ dst: Dir | str,
333
+ check: bool | None = None,
334
+ transfers: int | None = None,
335
+ checkers: int | None = None,
336
+ multi_thread_streams: int | None = None,
337
+ low_level_retries: int | None = None,
338
+ retries: int | None = None,
339
+ other_args: list[str] | None = None,
340
+ ) -> CompletedProcess:
341
+ """Copy files from source to destination.
342
+
343
+ Args:
344
+ src: Source directory
345
+ dst: Destination directory
346
+ """
347
+ return self.impl.copy(
348
+ src=src,
349
+ dst=dst,
350
+ check=check,
351
+ transfers=transfers,
352
+ checkers=checkers,
353
+ multi_thread_streams=multi_thread_streams,
354
+ low_level_retries=low_level_retries,
355
+ retries=retries,
356
+ other_args=other_args,
357
+ )
358
+
359
+ def purge(self, path: Dir | str) -> CompletedProcess:
360
+ """Purge a directory"""
361
+ return self.impl.purge(path=path)
362
+
363
+ def delete_files(
364
+ self,
365
+ files: str | File | list[str] | list[File],
366
+ check: bool | None = None,
367
+ rmdirs=False,
368
+ verbose: bool | None = None,
369
+ max_partition_workers: int | None = None,
370
+ other_args: list[str] | None = None,
371
+ ) -> CompletedProcess:
372
+ """Delete a directory"""
373
+ return self.impl.delete_files(
374
+ files=files,
375
+ check=check,
376
+ rmdirs=rmdirs,
377
+ verbose=verbose,
378
+ max_partition_workers=max_partition_workers,
379
+ other_args=other_args,
380
+ )
381
+
382
+ def exists(self, path: Dir | Remote | str | File) -> bool:
383
+ """Check if a file or directory exists."""
384
+ return self.impl.exists(path=path)
385
+
386
+ def is_synced(self, src: str | Dir, dst: str | Dir) -> bool:
387
+ """Check if two directories are in sync."""
388
+ return self.impl.is_synced(src=src, dst=dst)
389
+
390
+ def modtime(self, src: str) -> str | Exception:
391
+ """Get the modification time of a file or directory."""
392
+ return self.impl.modtime(src=src)
393
+
394
+ def modtime_dt(self, src: str) -> datetime | Exception:
395
+ """Get the modification time of a file or directory."""
396
+ return self.impl.modtime_dt(src=src)
397
+
398
+ def write_text(
399
+ self,
400
+ text: str,
401
+ dst: str,
402
+ ) -> Exception | None:
403
+ """Write text to a file."""
404
+ return self.impl.write_text(text=text, dst=dst)
405
+
406
+ def write_bytes(
407
+ self,
408
+ data: bytes,
409
+ dst: str,
410
+ ) -> Exception | None:
411
+ """Write bytes to a file."""
412
+ return self.impl.write_bytes(data=data, dst=dst)
413
+
414
+ def read_bytes(self, src: str) -> bytes | Exception:
415
+ """Read bytes from a file."""
416
+ return self.impl.read_bytes(src=src)
417
+
418
+ def read_text(self, src: str) -> str | Exception:
419
+ """Read text from a file."""
420
+ return self.impl.read_text(src=src)
421
+
422
+ def copy_bytes(
423
+ self,
424
+ src: str,
425
+ offset: int | SizeSuffix,
426
+ length: int | SizeSuffix,
427
+ outfile: Path,
428
+ other_args: list[str] | None = None,
429
+ ) -> Exception | None:
430
+ """Copy a slice of bytes from the src file to dst."""
431
+ return self.impl.copy_bytes(
432
+ src=src,
433
+ offset=offset,
434
+ length=length,
435
+ outfile=outfile,
436
+ other_args=other_args,
437
+ )
438
+
439
+ def copy_dir(
440
+ self, src: str | Dir, dst: str | Dir, args: list[str] | None = None
441
+ ) -> CompletedProcess:
442
+ """Copy a directory from source to destination."""
443
+ # convert src to str, also dst
444
+ return self.impl.copy_dir(src=src, dst=dst, args=args)
445
+
446
+ def copy_remote(
447
+ self, src: Remote, dst: Remote, args: list[str] | None = None
448
+ ) -> CompletedProcess:
449
+ """Copy a remote to another remote."""
450
+ return self.impl.copy_remote(src=src, dst=dst, args=args)
451
+
452
+ def copy_file_s3_resumable(
453
+ self,
454
+ src: str, # src:/Bucket/path/myfile.large.zst
455
+ dst_dir: str, # dst:/Bucket/path/myfile.large.zst-parts/part.{part_number:05d}.start-end
456
+ part_infos: list[PartInfo] | None = None,
457
+ upload_threads: int = 8, # Number of reader and writer threads to use
458
+ merge_threads: int = 4, # Number of threads to use for merging the parts
459
+ ) -> Exception | None:
460
+ """Copy a file in parts."""
461
+ return self.impl.copy_file_s3_resumable(
462
+ src=src,
463
+ dst_dir=dst_dir,
464
+ part_infos=part_infos,
465
+ upload_threads=upload_threads,
466
+ merge_threads=merge_threads,
467
+ )
468
+
469
+ def mount(
470
+ self,
471
+ src: Remote | Dir | str,
472
+ outdir: Path,
473
+ allow_writes: bool | None = False,
474
+ use_links: bool | None = None,
475
+ vfs_cache_mode: str | None = None,
476
+ verbose: bool | None = None,
477
+ cache_dir: Path | None = None,
478
+ cache_dir_delete_on_exit: bool | None = None,
479
+ log: Path | None = None,
480
+ other_args: list[str] | None = None,
481
+ ) -> Mount:
482
+ """Mount a remote or directory to a local path.
483
+
484
+ Args:
485
+ src: Remote or directory to mount
486
+ outdir: Local path to mount to
487
+
488
+ Returns:
489
+ CompletedProcess from the mount command execution
490
+
491
+ Raises:
492
+ subprocess.CalledProcessError: If the mount operation fails
493
+ """
494
+ return self.impl.mount(
495
+ src=src,
496
+ outdir=outdir,
497
+ allow_writes=allow_writes,
498
+ use_links=use_links,
499
+ vfs_cache_mode=vfs_cache_mode,
500
+ verbose=verbose,
501
+ cache_dir=cache_dir,
502
+ cache_dir_delete_on_exit=cache_dir_delete_on_exit,
503
+ log=log,
504
+ other_args=other_args,
505
+ )
506
+
507
+ def serve_http(
508
+ self,
509
+ src: str,
510
+ addr: str = "localhost:8080",
511
+ other_args: list[str] | None = None,
512
+ ) -> HttpServer:
513
+ """Serve a remote or directory via HTTP. The returned HttpServer has a client which can be used to
514
+ fetch files or parts.
515
+
516
+ Args:
517
+ src: Remote or directory to serve
518
+ addr: Network address and port to serve on (default: localhost:8080)
519
+ """
520
+ return self.impl.serve_http(src=src, addr=addr, other_args=other_args)
521
+
522
+ def size_files(
523
+ self,
524
+ src: str,
525
+ files: list[str],
526
+ fast_list: bool = False, # Recommend that this is False
527
+ other_args: list[str] | None = None,
528
+ check: bool | None = False,
529
+ verbose: bool | None = None,
530
+ ) -> SizeResult | Exception:
531
+ """Get the size of a list of files. Example of files items: "remote:bucket/to/file"."""
532
+ return self.impl.size_files(
533
+ src=src,
534
+ files=files,
535
+ fast_list=fast_list,
536
+ other_args=other_args,
537
+ check=check,
538
+ verbose=verbose,
539
+ )
540
+
541
+ def size_file(self, src: str) -> SizeSuffix | Exception:
542
+ """Get the size of a file."""
543
+ return self.impl.size_file(src=src)
544
+ ```
545
+
546
+
547
+ To develop software, run `. ./activate`
548
+
549
+ # Windows
550
+
551
+ This environment requires you to use `git-bash`.
552
+
553
+ # Linting
554
+
555
+ Run `./lint`