githubtakeout 0.1.12__tar.gz → 0.1.14__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.
- {githubtakeout-0.1.12/src/githubtakeout.egg-info → githubtakeout-0.1.14}/PKG-INFO +5 -3
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/README.md +2 -1
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/pyproject.toml +4 -3
- {githubtakeout-0.1.12 → githubtakeout-0.1.14/src/githubtakeout.egg-info}/PKG-INFO +5 -3
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/src/githubtakeout.egg-info/requires.txt +1 -1
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/src/githubtakeout.py +27 -17
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/LICENSE +0 -0
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/setup.cfg +0 -0
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/src/githubtakeout.egg-info/SOURCES.txt +0 -0
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/src/githubtakeout.egg-info/dependency_links.txt +0 -0
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/src/githubtakeout.egg-info/entry_points.txt +0 -0
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/src/githubtakeout.egg-info/top_level.txt +0 -0
- {githubtakeout-0.1.12 → githubtakeout-0.1.14}/src/progress.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: githubtakeout
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.14
|
|
4
4
|
Summary: Backup and archive Git Repos and Gists from GitHub
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
@@ -15,12 +15,13 @@ Classifier: Programming Language :: Python
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
19
|
Requires-Python: >=3.12
|
|
19
20
|
Description-Content-Type: text/markdown
|
|
20
21
|
License-File: LICENSE
|
|
21
22
|
Requires-Dist: GitPython==3.1.45
|
|
22
23
|
Requires-Dist: PyGithub==2.8.1
|
|
23
|
-
Requires-Dist: rich==14.
|
|
24
|
+
Requires-Dist: rich==14.2.0
|
|
24
25
|
Dynamic: license-file
|
|
25
26
|
|
|
26
27
|
# githubtakeout
|
|
@@ -86,7 +87,7 @@ the `--token` argument.
|
|
|
86
87
|
## CLI Options:
|
|
87
88
|
|
|
88
89
|
```
|
|
89
|
-
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
90
|
+
usage: githubtakeout [-h] [--dir DIR] [--pattern PATTERN] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
90
91
|
|
|
91
92
|
positional arguments:
|
|
92
93
|
username github username
|
|
@@ -94,6 +95,7 @@ positional arguments:
|
|
|
94
95
|
options:
|
|
95
96
|
-h, --help show this help message and exit
|
|
96
97
|
--dir DIR output directory (default: .)
|
|
98
|
+
--pattern PATTERN regex matching repo names (default: .*)
|
|
97
99
|
--format {tar,zip,none} archive format (default: zip)
|
|
98
100
|
--gists include gists
|
|
99
101
|
--history include commit history and branches (.git directory)
|
|
@@ -61,7 +61,7 @@ the `--token` argument.
|
|
|
61
61
|
## CLI Options:
|
|
62
62
|
|
|
63
63
|
```
|
|
64
|
-
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
64
|
+
usage: githubtakeout [-h] [--dir DIR] [--pattern PATTERN] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
65
65
|
|
|
66
66
|
positional arguments:
|
|
67
67
|
username github username
|
|
@@ -69,6 +69,7 @@ positional arguments:
|
|
|
69
69
|
options:
|
|
70
70
|
-h, --help show this help message and exit
|
|
71
71
|
--dir DIR output directory (default: .)
|
|
72
|
+
--pattern PATTERN regex matching repo names (default: .*)
|
|
72
73
|
--format {tar,zip,none} archive format (default: zip)
|
|
73
74
|
--gists include gists
|
|
74
75
|
--history include commit history and branches (.git directory)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "githubtakeout"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.14"
|
|
8
8
|
description = "Backup and archive Git Repos and Gists from GitHub"
|
|
9
9
|
license = "MIT"
|
|
10
10
|
license-files = ["LICENSE"]
|
|
@@ -20,11 +20,12 @@ classifiers = [
|
|
|
20
20
|
"Programming Language :: Python :: 3",
|
|
21
21
|
"Programming Language :: Python :: 3.12",
|
|
22
22
|
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
23
24
|
]
|
|
24
25
|
dependencies = [
|
|
25
26
|
"GitPython==3.1.45",
|
|
26
27
|
"PyGithub==2.8.1",
|
|
27
|
-
"rich==14.
|
|
28
|
+
"rich==14.2.0",
|
|
28
29
|
]
|
|
29
30
|
|
|
30
31
|
[project.scripts]
|
|
@@ -55,7 +56,7 @@ package-dir = {"" = "src"}
|
|
|
55
56
|
[tool.black]
|
|
56
57
|
line-length = 120
|
|
57
58
|
target-version = [
|
|
58
|
-
"py312", "py313"
|
|
59
|
+
"py312", "py313", "py314"
|
|
59
60
|
]
|
|
60
61
|
|
|
61
62
|
[tool.ruff]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: githubtakeout
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.14
|
|
4
4
|
Summary: Backup and archive Git Repos and Gists from GitHub
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
@@ -15,12 +15,13 @@ Classifier: Programming Language :: Python
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
19
|
Requires-Python: >=3.12
|
|
19
20
|
Description-Content-Type: text/markdown
|
|
20
21
|
License-File: LICENSE
|
|
21
22
|
Requires-Dist: GitPython==3.1.45
|
|
22
23
|
Requires-Dist: PyGithub==2.8.1
|
|
23
|
-
Requires-Dist: rich==14.
|
|
24
|
+
Requires-Dist: rich==14.2.0
|
|
24
25
|
Dynamic: license-file
|
|
25
26
|
|
|
26
27
|
# githubtakeout
|
|
@@ -86,7 +87,7 @@ the `--token` argument.
|
|
|
86
87
|
## CLI Options:
|
|
87
88
|
|
|
88
89
|
```
|
|
89
|
-
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
90
|
+
usage: githubtakeout [-h] [--dir DIR] [--pattern PATTERN] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
90
91
|
|
|
91
92
|
positional arguments:
|
|
92
93
|
username github username
|
|
@@ -94,6 +95,7 @@ positional arguments:
|
|
|
94
95
|
options:
|
|
95
96
|
-h, --help show this help message and exit
|
|
96
97
|
--dir DIR output directory (default: .)
|
|
98
|
+
--pattern PATTERN regex matching repo names (default: .*)
|
|
97
99
|
--format {tar,zip,none} archive format (default: zip)
|
|
98
100
|
--gists include gists
|
|
99
101
|
--history include commit history and branches (.git directory)
|
|
@@ -8,6 +8,7 @@ import getpass
|
|
|
8
8
|
import logging
|
|
9
9
|
import math
|
|
10
10
|
import os
|
|
11
|
+
import re
|
|
11
12
|
import shutil
|
|
12
13
|
import stat
|
|
13
14
|
import sys
|
|
@@ -88,7 +89,7 @@ def clone(repo_url, local_repo_dir, include_history):
|
|
|
88
89
|
repo = git.Repo.clone_from(
|
|
89
90
|
url=repo_url,
|
|
90
91
|
to_path=local_repo_dir,
|
|
91
|
-
multi_options=["--depth=1"],
|
|
92
|
+
multi_options=["--single-branch", "--depth=1"],
|
|
92
93
|
progress=GitProgress(),
|
|
93
94
|
)
|
|
94
95
|
except git.GitCommandError as e:
|
|
@@ -194,6 +195,7 @@ def get_token(prompt_for_token):
|
|
|
194
195
|
def run(
|
|
195
196
|
username,
|
|
196
197
|
base_dir,
|
|
198
|
+
pattern,
|
|
197
199
|
archive_format,
|
|
198
200
|
include_gists,
|
|
199
201
|
include_history,
|
|
@@ -203,28 +205,30 @@ def run(
|
|
|
203
205
|
working_dir = os.path.join(base_dir, "backups")
|
|
204
206
|
token = get_token(prompt_for_token)
|
|
205
207
|
repos, gists = get_repos(username, token, include_gists)
|
|
206
|
-
num_repos = repos.
|
|
208
|
+
num_repos = len([repo for repo in repos if re.match(pattern, repo.name)])
|
|
207
209
|
if not list_only:
|
|
208
210
|
logger.info(f"creating archives in: {working_dir}\n")
|
|
209
|
-
logger.info(f"found {num_repos} repos for user '{username}'
|
|
211
|
+
logger.info(f"found {num_repos} repos for user '{username}':\n")
|
|
210
212
|
for repo in repos:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
if re.match(pattern, repo.name):
|
|
214
|
+
local_repo_dir = os.path.join(working_dir, repo.name)
|
|
215
|
+
url = add_creds(repo.clone_url, username, token)
|
|
216
|
+
if list_only:
|
|
217
|
+
logger.info(f"{username}/{repo.name}")
|
|
218
|
+
else:
|
|
219
|
+
clone_and_archive_repo(url, local_repo_dir, archive_format, include_history)
|
|
217
220
|
if gists is not None:
|
|
218
|
-
num_gists = gists.
|
|
221
|
+
num_gists = len([gist for gist in gists if re.match(pattern, gist.id)])
|
|
219
222
|
logger.info("")
|
|
220
|
-
logger.info(f"found {num_gists} gists for user '{username}'
|
|
223
|
+
logger.info(f"found {num_gists} gists for user '{username}':\n")
|
|
221
224
|
for gist in gists:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
if re.match(pattern, gist.id):
|
|
226
|
+
local_repo_dir = os.path.join(working_dir, gist.id)
|
|
227
|
+
url = add_creds(gist.git_pull_url, username, token)
|
|
228
|
+
if list_only:
|
|
229
|
+
logger.info(f"{username}/{gist.id}\n - {gist.description}")
|
|
230
|
+
else:
|
|
231
|
+
clone_and_archive_repo(url, local_repo_dir, archive_format, include_history, is_gist=True)
|
|
228
232
|
|
|
229
233
|
|
|
230
234
|
def main():
|
|
@@ -241,6 +245,11 @@ def main():
|
|
|
241
245
|
default=os.getcwd(),
|
|
242
246
|
help="output directory (default: .)",
|
|
243
247
|
)
|
|
248
|
+
parser.add_argument(
|
|
249
|
+
"--pattern",
|
|
250
|
+
default=".*",
|
|
251
|
+
help="regex matching repo names (default: .*)",
|
|
252
|
+
)
|
|
244
253
|
parser.add_argument(
|
|
245
254
|
"--format",
|
|
246
255
|
choices=ARCHIVE_FORMATS,
|
|
@@ -261,6 +270,7 @@ def main():
|
|
|
261
270
|
run(
|
|
262
271
|
username=args.username,
|
|
263
272
|
base_dir=args.dir,
|
|
273
|
+
pattern=args.pattern,
|
|
264
274
|
archive_format=args.format,
|
|
265
275
|
include_gists=args.gists,
|
|
266
276
|
include_history=args.history,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{githubtakeout-0.1.12 → githubtakeout-0.1.14}/src/githubtakeout.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|