rclone-api 1.1.32__tar.gz → 1.1.33__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 (87) hide show
  1. {rclone_api-1.1.32 → rclone_api-1.1.33}/PKG-INFO +1 -1
  2. {rclone_api-1.1.32 → rclone_api-1.1.33}/pyproject.toml +1 -1
  3. rclone_api-1.1.33/src/rclone_api/profiling/mount_copy_bytes.py +148 -0
  4. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api.egg-info/PKG-INFO +1 -1
  5. rclone_api-1.1.32/src/rclone_api/profiling/mount_copy_bytes.py +0 -146
  6. {rclone_api-1.1.32 → rclone_api-1.1.33}/.aiderignore +0 -0
  7. {rclone_api-1.1.32 → rclone_api-1.1.33}/.github/workflows/lint.yml +0 -0
  8. {rclone_api-1.1.32 → rclone_api-1.1.33}/.github/workflows/push_macos.yml +0 -0
  9. {rclone_api-1.1.32 → rclone_api-1.1.33}/.github/workflows/push_ubuntu.yml +0 -0
  10. {rclone_api-1.1.32 → rclone_api-1.1.33}/.github/workflows/push_win.yml +0 -0
  11. {rclone_api-1.1.32 → rclone_api-1.1.33}/.gitignore +0 -0
  12. {rclone_api-1.1.32 → rclone_api-1.1.33}/.pylintrc +0 -0
  13. {rclone_api-1.1.32 → rclone_api-1.1.33}/.vscode/launch.json +0 -0
  14. {rclone_api-1.1.32 → rclone_api-1.1.33}/.vscode/settings.json +0 -0
  15. {rclone_api-1.1.32 → rclone_api-1.1.33}/.vscode/tasks.json +0 -0
  16. {rclone_api-1.1.32 → rclone_api-1.1.33}/LICENSE +0 -0
  17. {rclone_api-1.1.32 → rclone_api-1.1.33}/MANIFEST.in +0 -0
  18. {rclone_api-1.1.32 → rclone_api-1.1.33}/README.md +0 -0
  19. {rclone_api-1.1.32 → rclone_api-1.1.33}/clean +0 -0
  20. {rclone_api-1.1.32 → rclone_api-1.1.33}/install +0 -0
  21. {rclone_api-1.1.32 → rclone_api-1.1.33}/lint +0 -0
  22. {rclone_api-1.1.32 → rclone_api-1.1.33}/requirements.testing.txt +0 -0
  23. {rclone_api-1.1.32 → rclone_api-1.1.33}/setup.cfg +0 -0
  24. {rclone_api-1.1.32 → rclone_api-1.1.33}/setup.py +0 -0
  25. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/__init__.py +0 -0
  26. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/assets/example.txt +0 -0
  27. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/cli.py +0 -0
  28. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/cmd/copy_large_s3.py +0 -0
  29. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/cmd/list_files.py +0 -0
  30. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/completed_process.py +0 -0
  31. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/config.py +0 -0
  32. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/convert.py +0 -0
  33. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/deprecated.py +0 -0
  34. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/diff.py +0 -0
  35. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/dir.py +0 -0
  36. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/dir_listing.py +0 -0
  37. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/exec.py +0 -0
  38. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/experimental/flags.py +0 -0
  39. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/experimental/flags_base.py +0 -0
  40. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/file.py +0 -0
  41. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/filelist.py +0 -0
  42. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/group_files.py +0 -0
  43. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/mount.py +0 -0
  44. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/process.py +0 -0
  45. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/rclone.py +0 -0
  46. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/remote.py +0 -0
  47. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/rpath.py +0 -0
  48. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/s3/api.py +0 -0
  49. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/s3/basic_ops.py +0 -0
  50. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/s3/chunk_file.py +0 -0
  51. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/s3/chunk_types.py +0 -0
  52. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/s3/create.py +0 -0
  53. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/s3/types.py +0 -0
  54. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/s3/upload_file_multipart.py +0 -0
  55. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/scan_missing_folders.py +0 -0
  56. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/types.py +0 -0
  57. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/util.py +0 -0
  58. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api/walk.py +0 -0
  59. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api.egg-info/SOURCES.txt +0 -0
  60. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api.egg-info/dependency_links.txt +0 -0
  61. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api.egg-info/entry_points.txt +0 -0
  62. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api.egg-info/requires.txt +0 -0
  63. {rclone_api-1.1.32 → rclone_api-1.1.33}/src/rclone_api.egg-info/top_level.txt +0 -0
  64. {rclone_api-1.1.32 → rclone_api-1.1.33}/test +0 -0
  65. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/archive/test_paramiko.py.disabled +0 -0
  66. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_cmd_list_files.py +0 -0
  67. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_copy.py +0 -0
  68. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_copy_bytes.py +0 -0
  69. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_copy_file_resumable_s3.py +0 -0
  70. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_copy_files.py +0 -0
  71. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_diff.py +0 -0
  72. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_group_files.py +0 -0
  73. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_is_synced.py +0 -0
  74. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_ls.py +0 -0
  75. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_mount.py +0 -0
  76. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_mount_s3.py +0 -0
  77. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_obscure.py +0 -0
  78. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_rclone_config.py +0 -0
  79. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_remote_control.py +0 -0
  80. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_remotes.py +0 -0
  81. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_s3.py +0 -0
  82. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_scan_missing_folders.py +0 -0
  83. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_size_files.py +0 -0
  84. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_size_suffix.py +0 -0
  85. {rclone_api-1.1.32 → rclone_api-1.1.33}/tests/test_walk.py +0 -0
  86. {rclone_api-1.1.32 → rclone_api-1.1.33}/tox.ini +0 -0
  87. {rclone_api-1.1.32 → rclone_api-1.1.33}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.1.32
3
+ Version: 1.1.33
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  License: BSD 3-Clause License
@@ -23,7 +23,7 @@ dependencies = [
23
23
  ]
24
24
 
25
25
  # Change this with the version number bump.
26
- version = "1.1.32"
26
+ version = "1.1.33"
27
27
 
28
28
  [tool.setuptools]
29
29
  package-dir = {"" = "src"}
@@ -0,0 +1,148 @@
1
+ """
2
+ Unit test file.
3
+ """
4
+
5
+ import os
6
+ import time
7
+
8
+ import psutil
9
+ from dotenv import load_dotenv
10
+
11
+ from rclone_api import Config, Rclone, SizeSuffix
12
+
13
+ load_dotenv()
14
+
15
+ BUCKET_NAME = os.getenv("BUCKET_NAME") # Default if not in .env
16
+
17
+
18
+ def _generate_rclone_config() -> Config:
19
+
20
+ # assert that .env exists for this test
21
+ assert os.path.exists(
22
+ ".env"
23
+ ), "this test requires that the secret .env file exists with the credentials"
24
+
25
+ # BUCKET_NAME = os.getenv("BUCKET_NAME", "TorrentBooks") # Default if not in .env
26
+
27
+ # Load additional environment variables
28
+ BUCKET_KEY_SECRET = os.getenv("BUCKET_KEY_SECRET")
29
+ BUCKET_KEY_PUBLIC = os.getenv("BUCKET_KEY_PUBLIC")
30
+ SRC_SFTP_HOST = os.getenv("SRC_SFTP_HOST")
31
+ SRC_SFTP_USER = os.getenv("SRC_SFTP_USER")
32
+ SRC_SFTP_PORT = os.getenv("SRC_SFTP_PORT")
33
+ SRC_SFTP_PASS = os.getenv("SRC_SFTP_PASS")
34
+ # BUCKET_URL = os.getenv("BUCKET_URL")
35
+ BUCKET_URL = "sfo3.digitaloceanspaces.com"
36
+
37
+ config_text = f"""
38
+ [dst]
39
+ type = s3
40
+ provider = DigitalOcean
41
+ access_key_id = {BUCKET_KEY_PUBLIC}
42
+ secret_access_key = {BUCKET_KEY_SECRET}
43
+ endpoint = {BUCKET_URL}
44
+ bucket = {BUCKET_NAME}
45
+
46
+ [src]
47
+ type = sftp
48
+ host = {SRC_SFTP_HOST}
49
+ user = {SRC_SFTP_USER}
50
+ port = {SRC_SFTP_PORT}
51
+ pass = {SRC_SFTP_PASS}
52
+
53
+ """
54
+ # _CONFIG_PATH.write_text(config_text, encoding="utf-8")
55
+ # print(f"Config file written to: {_CONFIG_PATH}")
56
+ return Config(config_text)
57
+
58
+
59
+ def _init() -> None:
60
+ """Check if all required environment variables are set before running tests."""
61
+ required_vars = [
62
+ "BUCKET_NAME",
63
+ "BUCKET_KEY_SECRET",
64
+ "BUCKET_KEY_PUBLIC",
65
+ "BUCKET_URL",
66
+ ]
67
+ missing = [var for var in required_vars if not os.getenv(var)]
68
+ if missing:
69
+ print(f"Missing required environment variables: {', '.join(missing)}")
70
+ os.environ["RCLONE_API_VERBOSE"] = "1"
71
+
72
+
73
+ def test_profile_copy_bytes() -> None:
74
+ print("Running test_profile_copy_bytes")
75
+ rclone = Rclone(_generate_rclone_config())
76
+ sizes = [
77
+ 1024 * 1024 * 1,
78
+ 1024 * 1024 * 2,
79
+ 1024 * 1024 * 4,
80
+ 1024 * 1024 * 8,
81
+ 1024 * 1024 * 16,
82
+ 1024 * 1024 * 32,
83
+ 1024 * 1024 * 64,
84
+ ]
85
+ # transfer_list = [1, 2, 4, 8, 16]
86
+ transfer_list = [1, 2, 4]
87
+
88
+ # src_file = "dst:rclone-api-unit-test/zachs_video/internaly_ai_alignment.mp4"
89
+ # sftp mount
90
+ src_file = "src:aa_misc_data/aa_misc_data/world_lending_library_2024_11.tar.zst"
91
+
92
+ for size in sizes:
93
+ for transfers in transfer_list:
94
+ print("\n\n")
95
+ print("#" * 80)
96
+ print(
97
+ f"# Started test download of {SizeSuffix(size)} with {transfers} transfers"
98
+ )
99
+ print("#" * 80)
100
+ net_io_start = psutil.net_io_counters()
101
+ start = time.time()
102
+ bytes_or_err: bytes | Exception = rclone.copy_bytes(
103
+ src=src_file,
104
+ offset=0,
105
+ length=size,
106
+ direct_io=True,
107
+ transfers=transfers,
108
+ )
109
+ diff = time.time() - start
110
+ net_io_end = psutil.net_io_counters()
111
+ if isinstance(bytes_or_err, Exception):
112
+ print(bytes_or_err)
113
+ assert False, f"Error: {bytes_or_err}"
114
+ assert isinstance(bytes_or_err, bytes)
115
+ # self.assertEqual(len(bytes_or_err), size)
116
+ assert len(bytes_or_err) == size, f"Length: {len(bytes_or_err)} != {size}"
117
+
118
+ # print io stats
119
+ bytes_sent = net_io_end.bytes_sent - net_io_start.bytes_sent
120
+ bytes_recv = net_io_end.bytes_recv - net_io_start.bytes_recv
121
+ packets_sent = net_io_end.packets_sent - net_io_start.packets_sent
122
+ efficiency = size / (bytes_recv)
123
+ efficiency_100 = efficiency * 100
124
+ efficiency_str = f"{efficiency_100:.2f}"
125
+
126
+ bytes_send_suffix = SizeSuffix(bytes_sent)
127
+ bytes_recv_suffix = SizeSuffix(bytes_recv)
128
+ range_size = SizeSuffix(size)
129
+
130
+ print(f"\nFinished downloading {range_size} with {transfers} transfers")
131
+ print("Net IO stats:")
132
+ print(f"Bytes sent: {bytes_send_suffix}")
133
+ print(f"Bytes received: {bytes_recv_suffix}")
134
+ print(f"Packets sent: {packets_sent}")
135
+ print(f"Efficiency: {efficiency_str}%")
136
+ print(f"Time: {diff:.1f} seconds")
137
+
138
+ print("done")
139
+
140
+
141
+ def main() -> None:
142
+ """Main entry point."""
143
+ _init()
144
+ test_profile_copy_bytes()
145
+
146
+
147
+ if __name__ == "__main__":
148
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.1.32
3
+ Version: 1.1.33
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  License: BSD 3-Clause License
@@ -1,146 +0,0 @@
1
- """
2
- Unit test file.
3
- """
4
-
5
- import os
6
- import time
7
- import unittest
8
-
9
- import psutil
10
- from dotenv import load_dotenv
11
-
12
- from rclone_api import Config, Rclone, SizeSuffix
13
-
14
- load_dotenv()
15
-
16
- BUCKET_NAME = os.getenv("BUCKET_NAME") # Default if not in .env
17
-
18
-
19
- def _generate_rclone_config() -> Config:
20
-
21
- # assert that .env exists for this test
22
- assert os.path.exists(
23
- ".env"
24
- ), "this test requires that the secret .env file exists with the credentials"
25
-
26
- # BUCKET_NAME = os.getenv("BUCKET_NAME", "TorrentBooks") # Default if not in .env
27
-
28
- # Load additional environment variables
29
- BUCKET_KEY_SECRET = os.getenv("BUCKET_KEY_SECRET")
30
- BUCKET_KEY_PUBLIC = os.getenv("BUCKET_KEY_PUBLIC")
31
- SRC_SFTP_HOST = os.getenv("SRC_SFTP_HOST")
32
- SRC_SFTP_USER = os.getenv("SRC_SFTP_USER")
33
- SRC_SFTP_PORT = os.getenv("SRC_SFTP_PORT")
34
- SRC_SFTP_PASS = os.getenv("SRC_SFTP_PASS")
35
- # BUCKET_URL = os.getenv("BUCKET_URL")
36
- BUCKET_URL = "sfo3.digitaloceanspaces.com"
37
-
38
- config_text = f"""
39
- [dst]
40
- type = s3
41
- provider = DigitalOcean
42
- access_key_id = {BUCKET_KEY_PUBLIC}
43
- secret_access_key = {BUCKET_KEY_SECRET}
44
- endpoint = {BUCKET_URL}
45
- bucket = {BUCKET_NAME}
46
-
47
- [src]
48
- type = sftp
49
- host = {SRC_SFTP_HOST}
50
- user = {SRC_SFTP_USER}
51
- port = {SRC_SFTP_PORT}
52
- pass = {SRC_SFTP_PASS}
53
-
54
- """
55
- # _CONFIG_PATH.write_text(config_text, encoding="utf-8")
56
- # print(f"Config file written to: {_CONFIG_PATH}")
57
- return Config(config_text)
58
-
59
-
60
- class RcloneProfileCopyBytes(unittest.TestCase):
61
- """Test rclone functionality."""
62
-
63
- def setUp(self) -> None:
64
- """Check if all required environment variables are set before running tests."""
65
- required_vars = [
66
- "BUCKET_NAME",
67
- "BUCKET_KEY_SECRET",
68
- "BUCKET_KEY_PUBLIC",
69
- "BUCKET_URL",
70
- ]
71
- missing = [var for var in required_vars if not os.getenv(var)]
72
- if missing:
73
- self.skipTest(
74
- f"Missing required environment variables: {', '.join(missing)}"
75
- )
76
- os.environ["RCLONE_API_VERBOSE"] = "1"
77
-
78
- def test_profile_copy_bytes(self) -> None:
79
- print("Running test_profile_copy_bytes")
80
- rclone = Rclone(_generate_rclone_config())
81
- sizes = [
82
- 1024 * 1024 * 1,
83
- 1024 * 1024 * 2,
84
- 1024 * 1024 * 4,
85
- 1024 * 1024 * 8,
86
- 1024 * 1024 * 16,
87
- 1024 * 1024 * 32,
88
- 1024 * 1024 * 64,
89
- ]
90
- # transfer_list = [1, 2, 4, 8, 16]
91
- transfer_list = [1, 2, 4]
92
-
93
- # src_file = "dst:rclone-api-unit-test/zachs_video/internaly_ai_alignment.mp4"
94
- # sftp mount
95
- src_file = "src:aa_misc_data/aa_misc_data/world_lending_library_2024_11.tar.zst"
96
-
97
- for size in sizes:
98
- for transfers in transfer_list:
99
- print("\n\n")
100
- print("#" * 80)
101
- print(
102
- f"# Started test download of {SizeSuffix(size)} with {transfers} transfers"
103
- )
104
- print("#" * 80)
105
- net_io_start = psutil.net_io_counters()
106
- start = time.time()
107
- bytes_or_err: bytes | Exception = rclone.copy_bytes(
108
- src=src_file,
109
- offset=0,
110
- length=size,
111
- direct_io=True,
112
- transfers=transfers,
113
- )
114
- diff = time.time() - start
115
- net_io_end = psutil.net_io_counters()
116
- if isinstance(bytes_or_err, Exception):
117
- print(bytes_or_err)
118
- self.fail(f"Error: {bytes_or_err}")
119
- assert isinstance(bytes_or_err, bytes)
120
- self.assertEqual(len(bytes_or_err), size)
121
-
122
- # print io stats
123
- bytes_sent = net_io_end.bytes_sent - net_io_start.bytes_sent
124
- bytes_recv = net_io_end.bytes_recv - net_io_start.bytes_recv
125
- packets_sent = net_io_end.packets_sent - net_io_start.packets_sent
126
- efficiency = size / (bytes_recv)
127
- efficiency_100 = efficiency * 100
128
- efficiency_str = f"{efficiency_100:.2f}"
129
-
130
- bytes_send_suffix = SizeSuffix(bytes_sent)
131
- bytes_recv_suffix = SizeSuffix(bytes_recv)
132
- range_size = SizeSuffix(size)
133
-
134
- print(f"\nFinished downloading {range_size} with {transfers} transfers")
135
- print("Net IO stats:")
136
- print(f"Bytes sent: {bytes_send_suffix}")
137
- print(f"Bytes received: {bytes_recv_suffix}")
138
- print(f"Packets sent: {packets_sent}")
139
- print(f"Efficiency: {efficiency_str}%")
140
- print(f"Time: {diff:.1f} seconds")
141
-
142
- print("done")
143
-
144
-
145
- if __name__ == "__main__":
146
- unittest.main()
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