borgapi 0.6.0__tar.gz → 0.7.0__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 (37) hide show
  1. {borgapi-0.6.0 → borgapi-0.7.0}/PKG-INFO +74 -41
  2. {borgapi-0.6.0 → borgapi-0.7.0}/README.md +53 -32
  3. {borgapi-0.6.0 → borgapi-0.7.0/borgapi}/borgapi.egg-info/PKG-INFO +74 -41
  4. borgapi-0.7.0/borgapi/borgapi.egg-info/SOURCES.txt +10 -0
  5. borgapi-0.7.0/borgapi/borgapi.egg-info/requires.txt +2 -0
  6. borgapi-0.7.0/borgapi/borgapi.egg-info/top_level.txt +1 -0
  7. borgapi-0.7.0/pyproject.toml +76 -0
  8. borgapi-0.7.0/setup.py +5 -0
  9. {borgapi-0.6.0 → borgapi-0.7.0}/test/test_00_options.py +6 -6
  10. borgapi-0.6.0/borgapi/__init__.py +0 -5
  11. borgapi-0.6.0/borgapi/borgapi.py +0 -1082
  12. borgapi-0.6.0/borgapi/options.py +0 -919
  13. borgapi-0.6.0/borgapi.egg-info/SOURCES.txt +0 -30
  14. borgapi-0.6.0/borgapi.egg-info/requires.txt +0 -2
  15. borgapi-0.6.0/borgapi.egg-info/top_level.txt +0 -2
  16. borgapi-0.6.0/setup.py +0 -33
  17. borgapi-0.6.0/test/__init__.py +0 -0
  18. borgapi-0.6.0/test/borgapi/__init__.py +0 -0
  19. borgapi-0.6.0/test/borgapi/test_01_borgapi.py +0 -226
  20. borgapi-0.6.0/test/borgapi/test_02_init.py +0 -78
  21. borgapi-0.6.0/test/borgapi/test_03_create.py +0 -136
  22. borgapi-0.6.0/test/borgapi/test_04_extract.py +0 -52
  23. borgapi-0.6.0/test/borgapi/test_05_rename.py +0 -32
  24. borgapi-0.6.0/test/borgapi/test_06_list.py +0 -59
  25. borgapi-0.6.0/test/borgapi/test_07_diff.py +0 -54
  26. borgapi-0.6.0/test/borgapi/test_08_delete.py +0 -68
  27. borgapi-0.6.0/test/borgapi/test_09_prune.py +0 -48
  28. borgapi-0.6.0/test/borgapi/test_10_info.py +0 -50
  29. borgapi-0.6.0/test/borgapi/test_11_mount.py +0 -50
  30. borgapi-0.6.0/test/borgapi/test_12_key.py +0 -81
  31. borgapi-0.6.0/test/borgapi/test_13_export_tar.py +0 -38
  32. borgapi-0.6.0/test/borgapi/test_14_config.py +0 -42
  33. borgapi-0.6.0/test/borgapi/test_15_benchmark_crud.py +0 -24
  34. borgapi-0.6.0/test/borgapi/test_16_compact.py +0 -33
  35. {borgapi-0.6.0 → borgapi-0.7.0}/LICENSE +0 -0
  36. {borgapi-0.6.0 → borgapi-0.7.0/borgapi}/borgapi.egg-info/dependency_links.txt +0 -0
  37. {borgapi-0.6.0 → borgapi-0.7.0}/setup.cfg +0 -0
@@ -1,25 +1,37 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: borgapi
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Wrapper for borgbackup to easily use in code
5
- Home-page: https://github.com/spslater/borgapi
6
- Author: Sean Slater
7
- Author-email: seanslater@whatno.io
8
- License: MIT License
9
- Keywords: borgbackup backup api
5
+ Author-email: Sean Slater <seanslater@whatno.io>
6
+ License: Copyright 2021 Sean Slater
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
+ Project-URL: homepage, https://github.com/spslater/borgapi
14
+ Project-URL: documentation, https://github.com/spslater/borgapi/blob/master/README.md
15
+ Project-URL: repository, https://github.com/spslater/borgapi.git
16
+ Project-URL: issues, https://github.com/spslater/borgapi/issues
17
+ Project-URL: changelog, https://github.com/spslater/borgapi/blob/master/CHANGELOG.md
18
+ Keywords: borgbackup,backup,api
10
19
  Classifier: Development Status :: 4 - Beta
11
20
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
21
  Classifier: Programming Language :: Python :: 3.9
14
22
  Classifier: Programming Language :: Python :: 3.10
15
23
  Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
16
26
  Classifier: Operating System :: OS Independent
17
27
  Classifier: License :: OSI Approved :: MIT License
18
28
  Classifier: Topic :: Utilities
19
29
  Classifier: Topic :: System :: Archiving :: Backup
20
- Requires-Python: >=3.8
30
+ Requires-Python: >=3.9
21
31
  Description-Content-Type: text/markdown
22
32
  License-File: LICENSE
33
+ Requires-Dist: borgbackup[llfuse]~=1.4.0
34
+ Requires-Dist: python-dotenv~=1.0.0
23
35
 
24
36
  # BorgAPI
25
37
 
@@ -34,10 +46,10 @@ pip install borgapi
34
46
  ```
35
47
 
36
48
  Requires:
37
- * `borgbackup`: 1.2.3
38
- * `python-dotenv`: 1.0.0
49
+ * `borgbackup`: 1.4.0
50
+ * `python-dotenv`: 1.0.1
39
51
 
40
- Supports Python 3.8 to 3.11
52
+ Supports Python 3.9 to 3.13
41
53
 
42
54
  ## Usage
43
55
  ```python
@@ -46,12 +58,12 @@ import borgapi
46
58
  api = borgapi.BorgAPI(defaults={}, options={})
47
59
 
48
60
  # Initalize new repository
49
- api.init("/foo/bar", make_parent_dirs=True)
61
+ api.init("foo/bar", make_parent_dirs=True)
50
62
 
51
63
  # Create backup
52
- result = api.create("/foo/bar::backup", "/home", "/mnt/baz", json=True)
64
+ result = api.create("foo/bar::backup", "/home", "/mnt/baz", json=True)
53
65
  print(result['archive']["name"]) # backup
54
- print(result["repository"]["location"]) # /foo/bar
66
+ print(result["repository"]["location"]) # foo/bar
55
67
  ```
56
68
 
57
69
  ### BorgAPI Init arguments
@@ -60,7 +72,8 @@ class BorgAPI(
60
72
  defaults: dict = None,
61
73
  options: dict = None,
62
74
  log_level: str = "warning",
63
- log_json: bool = False
75
+ log_json: bool = False,
76
+ environ: dict = None,
64
77
  )
65
78
  ```
66
79
  * __defaults__: dictionary that has command names as keys and value that is a dict of
@@ -94,12 +107,35 @@ class BorgAPI(
94
107
  level as and keyword argument
95
108
  * __log_json__: log lines written by logger are formatted as json lines, passed into the
96
109
  logging setup
110
+ * __environ__: dictionary that contains environmental variables that should be set before running
111
+ any commands. Useful for setting the passphrase or passcommand for the repository or other
112
+ settings like that. See [Environment Variables](#Setting-Environment-Variables) section for
113
+ how to set environmental variables after initalization or what the defaults are.
114
+ ```python
115
+ {
116
+ "BORG_CHECK_I_KNOW_WHAT_I_AM_DOING": "YES",
117
+ "BORG_PASSCOMMAND": "cat ~/.borg/password",
118
+ }
119
+ ```
97
120
 
98
121
  ### Setting Environment Variables
99
122
  You are able to manage the environment variables used by borg to be able to use different settings
100
123
  for different repositories.
101
124
 
102
- There are 3 ways you can set the variables:
125
+ When initialzing the `BorgAPI` object, you can include a dictionary with the `environ` argument.
126
+
127
+ The following are the defaults that BorgAPI will always load so that user input does not hold up
128
+ the app from progressing.
129
+ ```ini
130
+ BORG_EXIT_CODES=modern,
131
+ BORG_PASSPHRASE="",
132
+ BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no,
133
+ BORG_RELOCATED_REPO_ACCESS_IS_OK=no,
134
+ BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=NO,
135
+ BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO,
136
+ ```
137
+
138
+ There are 3 ways you can set the variables after initialization:
103
139
  1. `filename`: Path to a file that contains the variables and their values. See the
104
140
  [python-dotenv README](https://github.com/theskumar/python-dotenv/blob/master/README.md#file-format)
105
141
  for more information.
@@ -122,14 +158,6 @@ will be used, which is searching for a ".env" file somewhere above in the curren
122
158
  [Environment Variables](https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables)
123
159
  used by `borgbackup`.
124
160
 
125
- #### IMPORTANT
126
- For commands that borg requires a confirmation on if no environment variable is given, the api will
127
- become stuck as it waits for a `yes` or `no` answer.
128
- * BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK
129
- * BORG_RELOCATED_REPO_ACCESS_IS_OK
130
- * BORG_CHECK_I_KNOW_WHAT_I_AM_DOING
131
- * BORG_DELETE_I_KNOW_WHAT_I_AM_DOING
132
-
133
161
  ### Removing Environment Variables
134
162
  If you want to unset a variable so it doesn't get used for another command you can use the
135
163
  `unset_environ` method. It'll remove any variables passed in from the current environment.
@@ -156,7 +184,7 @@ So the `--storage-quota` argument in `init` gets turned into the keyword argumen
156
184
 
157
185
  ```python
158
186
  api.init(
159
- repository="/foor/bar",
187
+ repository="foor/bar",
160
188
  encryption="repokey",
161
189
  append_only=True,
162
190
  storage_quota="5G",
@@ -173,9 +201,9 @@ diff_args = {
173
201
  }
174
202
 
175
203
  api.diff(
176
- "/foo/bar::tuesday",
204
+ "foo/bar::tuesday",
177
205
  "friday",
178
- "/foo/bar",
206
+ "foo/bar",
179
207
  "/baz",
180
208
  **diff_args,
181
209
  )
@@ -195,20 +223,18 @@ api.diff(
195
223
  * info
196
224
  * mount
197
225
  * umount
198
- * key_change_passphrase (key change-passphrase)
199
- * key_export (key export)
200
- * key_import (key import)
226
+ * key change-passphrase (key_change_passphrase)
227
+ * key export (key_export)
228
+ * key import (key_import)
201
229
  * upgrade
202
- * export_tar
230
+ * recreate
231
+ * immport-tar (immport_tar)
232
+ * export-tar (export_tar)
203
233
  * serve
204
234
  * config
205
- * with-lock
206
- * break-lock
207
- * benchmark crud
208
-
209
- ### Unavailable Borg Commands
210
- * recreate
211
- * Since this is an experimental feature there are no current plans to implament this.
235
+ * with-lock (with_lock)
236
+ * break-lock (break_lock)
237
+ * benchmark crud (benchmark_crud)
212
238
 
213
239
  ### Command Quirks
214
240
  Things that were changed from the way the default borg commands work to make things a bit
@@ -233,7 +259,8 @@ which outputs the stats info as a json object, it gets written to stdout.
233
259
 
234
260
  If either `json` or `log_json` is set, it'll try to convert the tuple output to json.
235
261
  If it is unable and there is output that is captured it'll return the plaintext value.
236
- If no output is captured, it returns `None`.
262
+ If no output is captured, it returns `None` if expecting a string or `{}` (an empty
263
+ dictionary) if expection some kind of JSON output.
237
264
 
238
265
  If multiple outputs are requested at the same time (like `--stats` and `--list`) the command
239
266
  will return a dictionary with aptly named keys (`--list` key is "list"). If only one output
@@ -265,6 +292,12 @@ Commands not listed return no output (None)
265
292
  - info: `--info`
266
293
  - info
267
294
  - always returns bare value
295
+ - recreate:
296
+ - list: `--list`, `--log-json`
297
+ - stats: `--stats`
298
+ - import tar
299
+ - list: `--list`
300
+ - stats: `--stats`, `--json`
268
301
  - export tar
269
302
  - list: `--list`, `--log-json`
270
303
  - tar: filename == "-"
@@ -275,7 +308,7 @@ Commands not listed return no output (None)
275
308
  - always returns bare value
276
309
 
277
310
  ## Roadmap
278
- - Start work on Borg's beta branch chagnes and keeping up with those
311
+ - Start work on Borg's beta branch again and keeping up with those
279
312
 
280
313
  ## Links
281
314
  * [PyPi Project](https://pypi.org/project/borgapi)
@@ -11,10 +11,10 @@ pip install borgapi
11
11
  ```
12
12
 
13
13
  Requires:
14
- * `borgbackup`: 1.2.3
15
- * `python-dotenv`: 1.0.0
14
+ * `borgbackup`: 1.4.0
15
+ * `python-dotenv`: 1.0.1
16
16
 
17
- Supports Python 3.8 to 3.11
17
+ Supports Python 3.9 to 3.13
18
18
 
19
19
  ## Usage
20
20
  ```python
@@ -23,12 +23,12 @@ import borgapi
23
23
  api = borgapi.BorgAPI(defaults={}, options={})
24
24
 
25
25
  # Initalize new repository
26
- api.init("/foo/bar", make_parent_dirs=True)
26
+ api.init("foo/bar", make_parent_dirs=True)
27
27
 
28
28
  # Create backup
29
- result = api.create("/foo/bar::backup", "/home", "/mnt/baz", json=True)
29
+ result = api.create("foo/bar::backup", "/home", "/mnt/baz", json=True)
30
30
  print(result['archive']["name"]) # backup
31
- print(result["repository"]["location"]) # /foo/bar
31
+ print(result["repository"]["location"]) # foo/bar
32
32
  ```
33
33
 
34
34
  ### BorgAPI Init arguments
@@ -37,7 +37,8 @@ class BorgAPI(
37
37
  defaults: dict = None,
38
38
  options: dict = None,
39
39
  log_level: str = "warning",
40
- log_json: bool = False
40
+ log_json: bool = False,
41
+ environ: dict = None,
41
42
  )
42
43
  ```
43
44
  * __defaults__: dictionary that has command names as keys and value that is a dict of
@@ -71,12 +72,35 @@ class BorgAPI(
71
72
  level as and keyword argument
72
73
  * __log_json__: log lines written by logger are formatted as json lines, passed into the
73
74
  logging setup
75
+ * __environ__: dictionary that contains environmental variables that should be set before running
76
+ any commands. Useful for setting the passphrase or passcommand for the repository or other
77
+ settings like that. See [Environment Variables](#Setting-Environment-Variables) section for
78
+ how to set environmental variables after initalization or what the defaults are.
79
+ ```python
80
+ {
81
+ "BORG_CHECK_I_KNOW_WHAT_I_AM_DOING": "YES",
82
+ "BORG_PASSCOMMAND": "cat ~/.borg/password",
83
+ }
84
+ ```
74
85
 
75
86
  ### Setting Environment Variables
76
87
  You are able to manage the environment variables used by borg to be able to use different settings
77
88
  for different repositories.
78
89
 
79
- There are 3 ways you can set the variables:
90
+ When initialzing the `BorgAPI` object, you can include a dictionary with the `environ` argument.
91
+
92
+ The following are the defaults that BorgAPI will always load so that user input does not hold up
93
+ the app from progressing.
94
+ ```ini
95
+ BORG_EXIT_CODES=modern,
96
+ BORG_PASSPHRASE="",
97
+ BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no,
98
+ BORG_RELOCATED_REPO_ACCESS_IS_OK=no,
99
+ BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=NO,
100
+ BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO,
101
+ ```
102
+
103
+ There are 3 ways you can set the variables after initialization:
80
104
  1. `filename`: Path to a file that contains the variables and their values. See the
81
105
  [python-dotenv README](https://github.com/theskumar/python-dotenv/blob/master/README.md#file-format)
82
106
  for more information.
@@ -99,14 +123,6 @@ will be used, which is searching for a ".env" file somewhere above in the curren
99
123
  [Environment Variables](https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables)
100
124
  used by `borgbackup`.
101
125
 
102
- #### IMPORTANT
103
- For commands that borg requires a confirmation on if no environment variable is given, the api will
104
- become stuck as it waits for a `yes` or `no` answer.
105
- * BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK
106
- * BORG_RELOCATED_REPO_ACCESS_IS_OK
107
- * BORG_CHECK_I_KNOW_WHAT_I_AM_DOING
108
- * BORG_DELETE_I_KNOW_WHAT_I_AM_DOING
109
-
110
126
  ### Removing Environment Variables
111
127
  If you want to unset a variable so it doesn't get used for another command you can use the
112
128
  `unset_environ` method. It'll remove any variables passed in from the current environment.
@@ -133,7 +149,7 @@ So the `--storage-quota` argument in `init` gets turned into the keyword argumen
133
149
 
134
150
  ```python
135
151
  api.init(
136
- repository="/foor/bar",
152
+ repository="foor/bar",
137
153
  encryption="repokey",
138
154
  append_only=True,
139
155
  storage_quota="5G",
@@ -150,9 +166,9 @@ diff_args = {
150
166
  }
151
167
 
152
168
  api.diff(
153
- "/foo/bar::tuesday",
169
+ "foo/bar::tuesday",
154
170
  "friday",
155
- "/foo/bar",
171
+ "foo/bar",
156
172
  "/baz",
157
173
  **diff_args,
158
174
  )
@@ -172,20 +188,18 @@ api.diff(
172
188
  * info
173
189
  * mount
174
190
  * umount
175
- * key_change_passphrase (key change-passphrase)
176
- * key_export (key export)
177
- * key_import (key import)
191
+ * key change-passphrase (key_change_passphrase)
192
+ * key export (key_export)
193
+ * key import (key_import)
178
194
  * upgrade
179
- * export_tar
195
+ * recreate
196
+ * immport-tar (immport_tar)
197
+ * export-tar (export_tar)
180
198
  * serve
181
199
  * config
182
- * with-lock
183
- * break-lock
184
- * benchmark crud
185
-
186
- ### Unavailable Borg Commands
187
- * recreate
188
- * Since this is an experimental feature there are no current plans to implament this.
200
+ * with-lock (with_lock)
201
+ * break-lock (break_lock)
202
+ * benchmark crud (benchmark_crud)
189
203
 
190
204
  ### Command Quirks
191
205
  Things that were changed from the way the default borg commands work to make things a bit
@@ -210,7 +224,8 @@ which outputs the stats info as a json object, it gets written to stdout.
210
224
 
211
225
  If either `json` or `log_json` is set, it'll try to convert the tuple output to json.
212
226
  If it is unable and there is output that is captured it'll return the plaintext value.
213
- If no output is captured, it returns `None`.
227
+ If no output is captured, it returns `None` if expecting a string or `{}` (an empty
228
+ dictionary) if expection some kind of JSON output.
214
229
 
215
230
  If multiple outputs are requested at the same time (like `--stats` and `--list`) the command
216
231
  will return a dictionary with aptly named keys (`--list` key is "list"). If only one output
@@ -242,6 +257,12 @@ Commands not listed return no output (None)
242
257
  - info: `--info`
243
258
  - info
244
259
  - always returns bare value
260
+ - recreate:
261
+ - list: `--list`, `--log-json`
262
+ - stats: `--stats`
263
+ - import tar
264
+ - list: `--list`
265
+ - stats: `--stats`, `--json`
245
266
  - export tar
246
267
  - list: `--list`, `--log-json`
247
268
  - tar: filename == "-"
@@ -252,7 +273,7 @@ Commands not listed return no output (None)
252
273
  - always returns bare value
253
274
 
254
275
  ## Roadmap
255
- - Start work on Borg's beta branch chagnes and keeping up with those
276
+ - Start work on Borg's beta branch again and keeping up with those
256
277
 
257
278
  ## Links
258
279
  * [PyPi Project](https://pypi.org/project/borgapi)
@@ -1,25 +1,37 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: borgapi
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Wrapper for borgbackup to easily use in code
5
- Home-page: https://github.com/spslater/borgapi
6
- Author: Sean Slater
7
- Author-email: seanslater@whatno.io
8
- License: MIT License
9
- Keywords: borgbackup backup api
5
+ Author-email: Sean Slater <seanslater@whatno.io>
6
+ License: Copyright 2021 Sean Slater
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
+ Project-URL: homepage, https://github.com/spslater/borgapi
14
+ Project-URL: documentation, https://github.com/spslater/borgapi/blob/master/README.md
15
+ Project-URL: repository, https://github.com/spslater/borgapi.git
16
+ Project-URL: issues, https://github.com/spslater/borgapi/issues
17
+ Project-URL: changelog, https://github.com/spslater/borgapi/blob/master/CHANGELOG.md
18
+ Keywords: borgbackup,backup,api
10
19
  Classifier: Development Status :: 4 - Beta
11
20
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
21
  Classifier: Programming Language :: Python :: 3.9
14
22
  Classifier: Programming Language :: Python :: 3.10
15
23
  Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
16
26
  Classifier: Operating System :: OS Independent
17
27
  Classifier: License :: OSI Approved :: MIT License
18
28
  Classifier: Topic :: Utilities
19
29
  Classifier: Topic :: System :: Archiving :: Backup
20
- Requires-Python: >=3.8
30
+ Requires-Python: >=3.9
21
31
  Description-Content-Type: text/markdown
22
32
  License-File: LICENSE
33
+ Requires-Dist: borgbackup[llfuse]~=1.4.0
34
+ Requires-Dist: python-dotenv~=1.0.0
23
35
 
24
36
  # BorgAPI
25
37
 
@@ -34,10 +46,10 @@ pip install borgapi
34
46
  ```
35
47
 
36
48
  Requires:
37
- * `borgbackup`: 1.2.3
38
- * `python-dotenv`: 1.0.0
49
+ * `borgbackup`: 1.4.0
50
+ * `python-dotenv`: 1.0.1
39
51
 
40
- Supports Python 3.8 to 3.11
52
+ Supports Python 3.9 to 3.13
41
53
 
42
54
  ## Usage
43
55
  ```python
@@ -46,12 +58,12 @@ import borgapi
46
58
  api = borgapi.BorgAPI(defaults={}, options={})
47
59
 
48
60
  # Initalize new repository
49
- api.init("/foo/bar", make_parent_dirs=True)
61
+ api.init("foo/bar", make_parent_dirs=True)
50
62
 
51
63
  # Create backup
52
- result = api.create("/foo/bar::backup", "/home", "/mnt/baz", json=True)
64
+ result = api.create("foo/bar::backup", "/home", "/mnt/baz", json=True)
53
65
  print(result['archive']["name"]) # backup
54
- print(result["repository"]["location"]) # /foo/bar
66
+ print(result["repository"]["location"]) # foo/bar
55
67
  ```
56
68
 
57
69
  ### BorgAPI Init arguments
@@ -60,7 +72,8 @@ class BorgAPI(
60
72
  defaults: dict = None,
61
73
  options: dict = None,
62
74
  log_level: str = "warning",
63
- log_json: bool = False
75
+ log_json: bool = False,
76
+ environ: dict = None,
64
77
  )
65
78
  ```
66
79
  * __defaults__: dictionary that has command names as keys and value that is a dict of
@@ -94,12 +107,35 @@ class BorgAPI(
94
107
  level as and keyword argument
95
108
  * __log_json__: log lines written by logger are formatted as json lines, passed into the
96
109
  logging setup
110
+ * __environ__: dictionary that contains environmental variables that should be set before running
111
+ any commands. Useful for setting the passphrase or passcommand for the repository or other
112
+ settings like that. See [Environment Variables](#Setting-Environment-Variables) section for
113
+ how to set environmental variables after initalization or what the defaults are.
114
+ ```python
115
+ {
116
+ "BORG_CHECK_I_KNOW_WHAT_I_AM_DOING": "YES",
117
+ "BORG_PASSCOMMAND": "cat ~/.borg/password",
118
+ }
119
+ ```
97
120
 
98
121
  ### Setting Environment Variables
99
122
  You are able to manage the environment variables used by borg to be able to use different settings
100
123
  for different repositories.
101
124
 
102
- There are 3 ways you can set the variables:
125
+ When initialzing the `BorgAPI` object, you can include a dictionary with the `environ` argument.
126
+
127
+ The following are the defaults that BorgAPI will always load so that user input does not hold up
128
+ the app from progressing.
129
+ ```ini
130
+ BORG_EXIT_CODES=modern,
131
+ BORG_PASSPHRASE="",
132
+ BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no,
133
+ BORG_RELOCATED_REPO_ACCESS_IS_OK=no,
134
+ BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=NO,
135
+ BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO,
136
+ ```
137
+
138
+ There are 3 ways you can set the variables after initialization:
103
139
  1. `filename`: Path to a file that contains the variables and their values. See the
104
140
  [python-dotenv README](https://github.com/theskumar/python-dotenv/blob/master/README.md#file-format)
105
141
  for more information.
@@ -122,14 +158,6 @@ will be used, which is searching for a ".env" file somewhere above in the curren
122
158
  [Environment Variables](https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables)
123
159
  used by `borgbackup`.
124
160
 
125
- #### IMPORTANT
126
- For commands that borg requires a confirmation on if no environment variable is given, the api will
127
- become stuck as it waits for a `yes` or `no` answer.
128
- * BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK
129
- * BORG_RELOCATED_REPO_ACCESS_IS_OK
130
- * BORG_CHECK_I_KNOW_WHAT_I_AM_DOING
131
- * BORG_DELETE_I_KNOW_WHAT_I_AM_DOING
132
-
133
161
  ### Removing Environment Variables
134
162
  If you want to unset a variable so it doesn't get used for another command you can use the
135
163
  `unset_environ` method. It'll remove any variables passed in from the current environment.
@@ -156,7 +184,7 @@ So the `--storage-quota` argument in `init` gets turned into the keyword argumen
156
184
 
157
185
  ```python
158
186
  api.init(
159
- repository="/foor/bar",
187
+ repository="foor/bar",
160
188
  encryption="repokey",
161
189
  append_only=True,
162
190
  storage_quota="5G",
@@ -173,9 +201,9 @@ diff_args = {
173
201
  }
174
202
 
175
203
  api.diff(
176
- "/foo/bar::tuesday",
204
+ "foo/bar::tuesday",
177
205
  "friday",
178
- "/foo/bar",
206
+ "foo/bar",
179
207
  "/baz",
180
208
  **diff_args,
181
209
  )
@@ -195,20 +223,18 @@ api.diff(
195
223
  * info
196
224
  * mount
197
225
  * umount
198
- * key_change_passphrase (key change-passphrase)
199
- * key_export (key export)
200
- * key_import (key import)
226
+ * key change-passphrase (key_change_passphrase)
227
+ * key export (key_export)
228
+ * key import (key_import)
201
229
  * upgrade
202
- * export_tar
230
+ * recreate
231
+ * immport-tar (immport_tar)
232
+ * export-tar (export_tar)
203
233
  * serve
204
234
  * config
205
- * with-lock
206
- * break-lock
207
- * benchmark crud
208
-
209
- ### Unavailable Borg Commands
210
- * recreate
211
- * Since this is an experimental feature there are no current plans to implament this.
235
+ * with-lock (with_lock)
236
+ * break-lock (break_lock)
237
+ * benchmark crud (benchmark_crud)
212
238
 
213
239
  ### Command Quirks
214
240
  Things that were changed from the way the default borg commands work to make things a bit
@@ -233,7 +259,8 @@ which outputs the stats info as a json object, it gets written to stdout.
233
259
 
234
260
  If either `json` or `log_json` is set, it'll try to convert the tuple output to json.
235
261
  If it is unable and there is output that is captured it'll return the plaintext value.
236
- If no output is captured, it returns `None`.
262
+ If no output is captured, it returns `None` if expecting a string or `{}` (an empty
263
+ dictionary) if expection some kind of JSON output.
237
264
 
238
265
  If multiple outputs are requested at the same time (like `--stats` and `--list`) the command
239
266
  will return a dictionary with aptly named keys (`--list` key is "list"). If only one output
@@ -265,6 +292,12 @@ Commands not listed return no output (None)
265
292
  - info: `--info`
266
293
  - info
267
294
  - always returns bare value
295
+ - recreate:
296
+ - list: `--list`, `--log-json`
297
+ - stats: `--stats`
298
+ - import tar
299
+ - list: `--list`
300
+ - stats: `--stats`, `--json`
268
301
  - export tar
269
302
  - list: `--list`, `--log-json`
270
303
  - tar: filename == "-"
@@ -275,7 +308,7 @@ Commands not listed return no output (None)
275
308
  - always returns bare value
276
309
 
277
310
  ## Roadmap
278
- - Start work on Borg's beta branch chagnes and keeping up with those
311
+ - Start work on Borg's beta branch again and keeping up with those
279
312
 
280
313
  ## Links
281
314
  * [PyPi Project](https://pypi.org/project/borgapi)
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ borgapi/borgapi.egg-info/PKG-INFO
6
+ borgapi/borgapi.egg-info/SOURCES.txt
7
+ borgapi/borgapi.egg-info/dependency_links.txt
8
+ borgapi/borgapi.egg-info/requires.txt
9
+ borgapi/borgapi.egg-info/top_level.txt
10
+ test/test_00_options.py
@@ -0,0 +1,2 @@
1
+ borgbackup[llfuse]~=1.4.0
2
+ python-dotenv~=1.0.0