githubtakeout 0.1.11__tar.gz → 0.1.12__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.11/src/githubtakeout.egg-info → githubtakeout-0.1.12}/PKG-INFO +35 -39
- githubtakeout-0.1.12/README.md +103 -0
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/pyproject.toml +26 -3
- {githubtakeout-0.1.11 → githubtakeout-0.1.12/src/githubtakeout.egg-info}/PKG-INFO +35 -39
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/src/githubtakeout.py +19 -12
- githubtakeout-0.1.11/README.md +0 -107
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/LICENSE +0 -0
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/setup.cfg +0 -0
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/src/githubtakeout.egg-info/SOURCES.txt +0 -0
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/src/githubtakeout.egg-info/dependency_links.txt +0 -0
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/src/githubtakeout.egg-info/entry_points.txt +0 -0
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/src/githubtakeout.egg-info/requires.txt +0 -0
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/src/githubtakeout.egg-info/top_level.txt +0 -0
- {githubtakeout-0.1.11 → githubtakeout-0.1.12}/src/progress.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: githubtakeout
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.12
|
|
4
|
+
Summary: Backup and archive Git Repos and Gists from GitHub
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
7
7
|
License-Expression: MIT
|
|
@@ -25,7 +25,7 @@ Dynamic: license-file
|
|
|
25
25
|
|
|
26
26
|
# githubtakeout
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Backup and archive Git Repos and Gists from GitHub
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
@@ -38,32 +38,30 @@ Dynamic: license-file
|
|
|
38
38
|
|
|
39
39
|
## About:
|
|
40
40
|
|
|
41
|
-
`githubtakeout` is a data export tool for
|
|
42
|
-
It clones a user's repos and creates an archive
|
|
41
|
+
`githubtakeout` is a data export tool for backing up and archiving Git
|
|
42
|
+
repositories hosted on GitHub. It clones a user's repos and creates an archive
|
|
43
|
+
of each.
|
|
43
44
|
|
|
44
|
-
It supports public/private repos and public/secret gists. By default, it
|
|
45
|
-
commit history or branches (`.git` directory), or Gist
|
|
46
|
-
with command line options).
|
|
45
|
+
It supports public/private repos and public/secret gists. By default, it
|
|
46
|
+
doesn't save commit history or branches (`.git` directory), or Gist
|
|
47
|
+
repositories (both can be enabled with command line options).
|
|
47
48
|
|
|
48
|
-
When you run the program, archives of your repos will be saved in a directory
|
|
49
|
-
`backups` inside your current working directory, unless a different
|
|
50
|
-
using the `--dir` option.
|
|
49
|
+
When you run the program, archives of your repos will be saved in a directory
|
|
50
|
+
named `backups` inside your current working directory, unless a different
|
|
51
|
+
location is specified using the `--dir` option.
|
|
51
52
|
|
|
52
|
-
Archives are saved in compressed zip format (`.zip`) by default
|
|
53
|
-
as tarballs (`.tar.gz`) using the `--format=tar` option
|
|
53
|
+
Archives are saved in compressed zip format (`.zip`) by default. You can also
|
|
54
|
+
save as tarballs (`.tar.gz`) using the `--format=tar` option, or skip archiving
|
|
55
|
+
using the `--format=none` option.
|
|
54
56
|
|
|
55
57
|
## Requirements:
|
|
56
58
|
|
|
57
59
|
- Python 3.12+
|
|
58
60
|
- Git 1.7+
|
|
59
|
-
- Python packages:
|
|
60
|
-
- [GitPython][pypi-gitpython]
|
|
61
|
-
- [PyGithub][pypi-pygithub]
|
|
62
|
-
- [rich][pypi-rich]
|
|
63
61
|
|
|
64
62
|
## Installation:
|
|
65
63
|
|
|
66
|
-
Install from [PyPI][
|
|
64
|
+
#### Install from [PyPI][pypi-githubtakeout]:
|
|
67
65
|
|
|
68
66
|
```
|
|
69
67
|
pip install githubtakeout
|
|
@@ -71,46 +69,48 @@ pip install githubtakeout
|
|
|
71
69
|
|
|
72
70
|
## Authentication:
|
|
73
71
|
|
|
74
|
-
By default, `githubtakeout` will only retrieve an account's public repos. To
|
|
75
|
-
you need to authenticate.
|
|
72
|
+
By default, `githubtakeout` will only retrieve an account's public repos. To
|
|
73
|
+
access private repos and secret gists, you need to authenticate.
|
|
76
74
|
|
|
77
|
-
First, you must create a [personal access token][github-pat] on Github (either
|
|
78
|
-
access token). Once you have a token, you
|
|
75
|
+
First, you must create a [personal access token][github-pat] on Github (either
|
|
76
|
+
a fine-grained or classic personal access token). Once you have a token, you
|
|
77
|
+
can set the `GITHUB_TOKEN` environment variable:
|
|
79
78
|
|
|
80
79
|
```
|
|
81
80
|
$ export GITHUB_TOKEN=<access token>
|
|
82
81
|
```
|
|
83
82
|
|
|
84
|
-
If you prefer to be prompted for your token each time you run the program, use
|
|
83
|
+
If you prefer to be prompted for your token each time you run the program, use
|
|
84
|
+
the `--token` argument.
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
## CLI Options:
|
|
87
87
|
|
|
88
88
|
```
|
|
89
|
-
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip}] [--gists] [--history] [--list] [--token] username
|
|
89
|
+
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
90
90
|
|
|
91
91
|
positional arguments:
|
|
92
|
-
username
|
|
92
|
+
username github username
|
|
93
93
|
|
|
94
94
|
options:
|
|
95
|
-
-h, --help
|
|
96
|
-
--dir DIR
|
|
97
|
-
--format {tar,zip} archive format (default: zip)
|
|
98
|
-
--gists
|
|
99
|
-
--history
|
|
100
|
-
--list
|
|
101
|
-
--token
|
|
95
|
+
-h, --help show this help message and exit
|
|
96
|
+
--dir DIR output directory (default: .)
|
|
97
|
+
--format {tar,zip,none} archive format (default: zip)
|
|
98
|
+
--gists include gists
|
|
99
|
+
--history include commit history and branches (.git directory)
|
|
100
|
+
--list list repos only
|
|
101
|
+
--token prompt for auth token
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
## Usage Examples:
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
#### Install from PyPI with pipx, Run:
|
|
107
107
|
|
|
108
108
|
```
|
|
109
109
|
pipx install githubtakeout
|
|
110
110
|
githubtakeout <github username>
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
#### Clone Repo, Create/Activate Virtual Environment, Install from Source, Run:
|
|
114
114
|
|
|
115
115
|
```
|
|
116
116
|
git clone git@github.com:cgoldberg/githubtakeout.git
|
|
@@ -121,12 +121,8 @@ pip install .
|
|
|
121
121
|
githubtakeout <github username>
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
|
|
125
124
|
[github-home]: https://github.com/cgoldberg
|
|
126
125
|
[github-repo]: https://github.com/cgoldberg/sudokubot
|
|
127
126
|
[github-pat]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
|
|
128
127
|
[pypi-githubtakeout]: https://pypi.org/project/githubtakeout
|
|
129
|
-
[pypi-gitpython]: https://pypi.org/project/GitPython
|
|
130
|
-
[pypi-pygithub]: https://pypi.org/project/PyGithub
|
|
131
|
-
[pypi-rich]: https://pypi.org/project/rich
|
|
132
128
|
[mit-license]: https://raw.githubusercontent.com/cgoldberg/githubtakeout/refs/heads/master/LICENSE
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# githubtakeout
|
|
2
|
+
|
|
3
|
+
## Backup and archive Git Repos and Gists from GitHub
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
- Copyright (c) 2015-2025 [Corey Goldberg][github-home]
|
|
8
|
+
- Development: [GitHub][github-repo]
|
|
9
|
+
- Download/Install: [PyPI][pypi-githubtakeout]
|
|
10
|
+
- License: [MIT][mit-license]
|
|
11
|
+
|
|
12
|
+
----
|
|
13
|
+
|
|
14
|
+
## About:
|
|
15
|
+
|
|
16
|
+
`githubtakeout` is a data export tool for backing up and archiving Git
|
|
17
|
+
repositories hosted on GitHub. It clones a user's repos and creates an archive
|
|
18
|
+
of each.
|
|
19
|
+
|
|
20
|
+
It supports public/private repos and public/secret gists. By default, it
|
|
21
|
+
doesn't save commit history or branches (`.git` directory), or Gist
|
|
22
|
+
repositories (both can be enabled with command line options).
|
|
23
|
+
|
|
24
|
+
When you run the program, archives of your repos will be saved in a directory
|
|
25
|
+
named `backups` inside your current working directory, unless a different
|
|
26
|
+
location is specified using the `--dir` option.
|
|
27
|
+
|
|
28
|
+
Archives are saved in compressed zip format (`.zip`) by default. You can also
|
|
29
|
+
save as tarballs (`.tar.gz`) using the `--format=tar` option, or skip archiving
|
|
30
|
+
using the `--format=none` option.
|
|
31
|
+
|
|
32
|
+
## Requirements:
|
|
33
|
+
|
|
34
|
+
- Python 3.12+
|
|
35
|
+
- Git 1.7+
|
|
36
|
+
|
|
37
|
+
## Installation:
|
|
38
|
+
|
|
39
|
+
#### Install from [PyPI][pypi-githubtakeout]:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
pip install githubtakeout
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Authentication:
|
|
46
|
+
|
|
47
|
+
By default, `githubtakeout` will only retrieve an account's public repos. To
|
|
48
|
+
access private repos and secret gists, you need to authenticate.
|
|
49
|
+
|
|
50
|
+
First, you must create a [personal access token][github-pat] on Github (either
|
|
51
|
+
a fine-grained or classic personal access token). Once you have a token, you
|
|
52
|
+
can set the `GITHUB_TOKEN` environment variable:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
$ export GITHUB_TOKEN=<access token>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If you prefer to be prompted for your token each time you run the program, use
|
|
59
|
+
the `--token` argument.
|
|
60
|
+
|
|
61
|
+
## CLI Options:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
65
|
+
|
|
66
|
+
positional arguments:
|
|
67
|
+
username github username
|
|
68
|
+
|
|
69
|
+
options:
|
|
70
|
+
-h, --help show this help message and exit
|
|
71
|
+
--dir DIR output directory (default: .)
|
|
72
|
+
--format {tar,zip,none} archive format (default: zip)
|
|
73
|
+
--gists include gists
|
|
74
|
+
--history include commit history and branches (.git directory)
|
|
75
|
+
--list list repos only
|
|
76
|
+
--token prompt for auth token
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Usage Examples:
|
|
80
|
+
|
|
81
|
+
#### Install from PyPI with pipx, Run:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
pipx install githubtakeout
|
|
85
|
+
githubtakeout <github username>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Clone Repo, Create/Activate Virtual Environment, Install from Source, Run:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
git clone git@github.com:cgoldberg/githubtakeout.git
|
|
92
|
+
cd ./githubtakeout
|
|
93
|
+
python3 -m venv venv
|
|
94
|
+
source venv/bin/activate
|
|
95
|
+
pip install .
|
|
96
|
+
githubtakeout <github username>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
[github-home]: https://github.com/cgoldberg
|
|
100
|
+
[github-repo]: https://github.com/cgoldberg/sudokubot
|
|
101
|
+
[github-pat]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
|
|
102
|
+
[pypi-githubtakeout]: https://pypi.org/project/githubtakeout
|
|
103
|
+
[mit-license]: https://raw.githubusercontent.com/cgoldberg/githubtakeout/refs/heads/master/LICENSE
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "githubtakeout"
|
|
7
|
-
version = "0.1.
|
|
8
|
-
description = "
|
|
7
|
+
version = "0.1.12"
|
|
8
|
+
description = "Backup and archive Git Repos and Gists from GitHub"
|
|
9
9
|
license = "MIT"
|
|
10
10
|
license-files = ["LICENSE"]
|
|
11
11
|
authors = [{name = "Corey Goldberg"}]
|
|
@@ -35,12 +35,28 @@ homepage = "https://github.com/cgoldberg/githubtakeout"
|
|
|
35
35
|
source = "https://github.com/cgoldberg/githubtakeout"
|
|
36
36
|
download = "https://pypi.org/project/githubtakeout"
|
|
37
37
|
|
|
38
|
+
[dependency-groups]
|
|
39
|
+
dev = [
|
|
40
|
+
"tox",
|
|
41
|
+
]
|
|
42
|
+
lint = [
|
|
43
|
+
"black",
|
|
44
|
+
"refurb",
|
|
45
|
+
"ruff",
|
|
46
|
+
]
|
|
47
|
+
validate = [
|
|
48
|
+
"packaging",
|
|
49
|
+
"validate-pyproject",
|
|
50
|
+
]
|
|
51
|
+
|
|
38
52
|
[tool.setuptools]
|
|
39
53
|
package-dir = {"" = "src"}
|
|
40
54
|
|
|
41
55
|
[tool.black]
|
|
42
56
|
line-length = 120
|
|
43
|
-
target-version = [
|
|
57
|
+
target-version = [
|
|
58
|
+
"py312", "py313"
|
|
59
|
+
]
|
|
44
60
|
|
|
45
61
|
[tool.ruff]
|
|
46
62
|
line-length = 120
|
|
@@ -60,3 +76,10 @@ fixable = ["ALL"]
|
|
|
60
76
|
[tool.ruff.format]
|
|
61
77
|
docstring-code-format = true
|
|
62
78
|
docstring-code-line-length = 120
|
|
79
|
+
|
|
80
|
+
[tool.refurb]
|
|
81
|
+
python_version = "3.9"
|
|
82
|
+
enable_all = true
|
|
83
|
+
disable = [
|
|
84
|
+
"FURB104", "FURB107", "FURB147", "FURB173", "FURB183", "FURB184"
|
|
85
|
+
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: githubtakeout
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.12
|
|
4
|
+
Summary: Backup and archive Git Repos and Gists from GitHub
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
7
7
|
License-Expression: MIT
|
|
@@ -25,7 +25,7 @@ Dynamic: license-file
|
|
|
25
25
|
|
|
26
26
|
# githubtakeout
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Backup and archive Git Repos and Gists from GitHub
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
@@ -38,32 +38,30 @@ Dynamic: license-file
|
|
|
38
38
|
|
|
39
39
|
## About:
|
|
40
40
|
|
|
41
|
-
`githubtakeout` is a data export tool for
|
|
42
|
-
It clones a user's repos and creates an archive
|
|
41
|
+
`githubtakeout` is a data export tool for backing up and archiving Git
|
|
42
|
+
repositories hosted on GitHub. It clones a user's repos and creates an archive
|
|
43
|
+
of each.
|
|
43
44
|
|
|
44
|
-
It supports public/private repos and public/secret gists. By default, it
|
|
45
|
-
commit history or branches (`.git` directory), or Gist
|
|
46
|
-
with command line options).
|
|
45
|
+
It supports public/private repos and public/secret gists. By default, it
|
|
46
|
+
doesn't save commit history or branches (`.git` directory), or Gist
|
|
47
|
+
repositories (both can be enabled with command line options).
|
|
47
48
|
|
|
48
|
-
When you run the program, archives of your repos will be saved in a directory
|
|
49
|
-
`backups` inside your current working directory, unless a different
|
|
50
|
-
using the `--dir` option.
|
|
49
|
+
When you run the program, archives of your repos will be saved in a directory
|
|
50
|
+
named `backups` inside your current working directory, unless a different
|
|
51
|
+
location is specified using the `--dir` option.
|
|
51
52
|
|
|
52
|
-
Archives are saved in compressed zip format (`.zip`) by default
|
|
53
|
-
as tarballs (`.tar.gz`) using the `--format=tar` option
|
|
53
|
+
Archives are saved in compressed zip format (`.zip`) by default. You can also
|
|
54
|
+
save as tarballs (`.tar.gz`) using the `--format=tar` option, or skip archiving
|
|
55
|
+
using the `--format=none` option.
|
|
54
56
|
|
|
55
57
|
## Requirements:
|
|
56
58
|
|
|
57
59
|
- Python 3.12+
|
|
58
60
|
- Git 1.7+
|
|
59
|
-
- Python packages:
|
|
60
|
-
- [GitPython][pypi-gitpython]
|
|
61
|
-
- [PyGithub][pypi-pygithub]
|
|
62
|
-
- [rich][pypi-rich]
|
|
63
61
|
|
|
64
62
|
## Installation:
|
|
65
63
|
|
|
66
|
-
Install from [PyPI][
|
|
64
|
+
#### Install from [PyPI][pypi-githubtakeout]:
|
|
67
65
|
|
|
68
66
|
```
|
|
69
67
|
pip install githubtakeout
|
|
@@ -71,46 +69,48 @@ pip install githubtakeout
|
|
|
71
69
|
|
|
72
70
|
## Authentication:
|
|
73
71
|
|
|
74
|
-
By default, `githubtakeout` will only retrieve an account's public repos. To
|
|
75
|
-
you need to authenticate.
|
|
72
|
+
By default, `githubtakeout` will only retrieve an account's public repos. To
|
|
73
|
+
access private repos and secret gists, you need to authenticate.
|
|
76
74
|
|
|
77
|
-
First, you must create a [personal access token][github-pat] on Github (either
|
|
78
|
-
access token). Once you have a token, you
|
|
75
|
+
First, you must create a [personal access token][github-pat] on Github (either
|
|
76
|
+
a fine-grained or classic personal access token). Once you have a token, you
|
|
77
|
+
can set the `GITHUB_TOKEN` environment variable:
|
|
79
78
|
|
|
80
79
|
```
|
|
81
80
|
$ export GITHUB_TOKEN=<access token>
|
|
82
81
|
```
|
|
83
82
|
|
|
84
|
-
If you prefer to be prompted for your token each time you run the program, use
|
|
83
|
+
If you prefer to be prompted for your token each time you run the program, use
|
|
84
|
+
the `--token` argument.
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
## CLI Options:
|
|
87
87
|
|
|
88
88
|
```
|
|
89
|
-
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip}] [--gists] [--history] [--list] [--token] username
|
|
89
|
+
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip,none}] [--gists] [--history] [--list] [--token] username
|
|
90
90
|
|
|
91
91
|
positional arguments:
|
|
92
|
-
username
|
|
92
|
+
username github username
|
|
93
93
|
|
|
94
94
|
options:
|
|
95
|
-
-h, --help
|
|
96
|
-
--dir DIR
|
|
97
|
-
--format {tar,zip} archive format (default: zip)
|
|
98
|
-
--gists
|
|
99
|
-
--history
|
|
100
|
-
--list
|
|
101
|
-
--token
|
|
95
|
+
-h, --help show this help message and exit
|
|
96
|
+
--dir DIR output directory (default: .)
|
|
97
|
+
--format {tar,zip,none} archive format (default: zip)
|
|
98
|
+
--gists include gists
|
|
99
|
+
--history include commit history and branches (.git directory)
|
|
100
|
+
--list list repos only
|
|
101
|
+
--token prompt for auth token
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
## Usage Examples:
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
#### Install from PyPI with pipx, Run:
|
|
107
107
|
|
|
108
108
|
```
|
|
109
109
|
pipx install githubtakeout
|
|
110
110
|
githubtakeout <github username>
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
#### Clone Repo, Create/Activate Virtual Environment, Install from Source, Run:
|
|
114
114
|
|
|
115
115
|
```
|
|
116
116
|
git clone git@github.com:cgoldberg/githubtakeout.git
|
|
@@ -121,12 +121,8 @@ pip install .
|
|
|
121
121
|
githubtakeout <github username>
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
|
|
125
124
|
[github-home]: https://github.com/cgoldberg
|
|
126
125
|
[github-repo]: https://github.com/cgoldberg/sudokubot
|
|
127
126
|
[github-pat]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
|
|
128
127
|
[pypi-githubtakeout]: https://pypi.org/project/githubtakeout
|
|
129
|
-
[pypi-gitpython]: https://pypi.org/project/GitPython
|
|
130
|
-
[pypi-pygithub]: https://pypi.org/project/PyGithub
|
|
131
|
-
[pypi-rich]: https://pypi.org/project/rich
|
|
132
128
|
[mit-license]: https://raw.githubusercontent.com/cgoldberg/githubtakeout/refs/heads/master/LICENSE
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2015-2025 Corey Goldberg
|
|
2
2
|
# License: MIT
|
|
3
3
|
|
|
4
|
-
"""
|
|
4
|
+
"""Backup and archive Git Repos and Gists from GitHub."""
|
|
5
5
|
|
|
6
6
|
import argparse
|
|
7
7
|
import getpass
|
|
@@ -22,7 +22,7 @@ import github
|
|
|
22
22
|
|
|
23
23
|
from progress import GitProgress
|
|
24
24
|
|
|
25
|
-
ARCHIVE_FORMATS = ("tar", "zip")
|
|
25
|
+
ARCHIVE_FORMATS = ("tar", "zip", "none")
|
|
26
26
|
|
|
27
27
|
logging.basicConfig(level=logging.INFO, format="%(message)s")
|
|
28
28
|
logger = logging.getLogger(__name__)
|
|
@@ -52,6 +52,8 @@ def add_creds(url, username, token):
|
|
|
52
52
|
def archive(local_repo_dir, archive_format="zip", is_gist=False):
|
|
53
53
|
if archive_format not in ARCHIVE_FORMATS:
|
|
54
54
|
raise ValueError(f"{archive_format} is not a valid archive format")
|
|
55
|
+
if archive_format == "none":
|
|
56
|
+
return None
|
|
55
57
|
base_name = os.path.basename(local_repo_dir)
|
|
56
58
|
extension = "tar.gz" if archive_format == "tar" else archive_format
|
|
57
59
|
archive_name = f"{base_name}.{extension}"
|
|
@@ -132,14 +134,15 @@ def clone_and_archive_repo(repo_url, local_repo_dir, archive_format, include_his
|
|
|
132
134
|
except FileNotFoundError:
|
|
133
135
|
pass
|
|
134
136
|
archive_path = archive(local_repo_dir, archive_format, is_gist)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
if archive_path:
|
|
138
|
+
size = convert_size(os.path.getsize(archive_path))
|
|
139
|
+
logger.info(f"archive size: {size}")
|
|
140
|
+
logger.info("deleting repo")
|
|
141
|
+
try:
|
|
142
|
+
# delete repo after archive is created
|
|
143
|
+
shutil.rmtree(local_repo_dir, onexc=remove_readonly)
|
|
144
|
+
except FileNotFoundError:
|
|
145
|
+
pass
|
|
143
146
|
elapsed = default_timer() - start
|
|
144
147
|
base_name = os.path.basename(local_repo_dir)
|
|
145
148
|
logger.info(f"successfully backed up '{base_name}' repo in {elapsed:.3f} secs\n")
|
|
@@ -227,12 +230,16 @@ def run(
|
|
|
227
230
|
def main():
|
|
228
231
|
if sys.version_info < (3, 12):
|
|
229
232
|
sys.exit("sorry, this program requires Python 3.12+")
|
|
230
|
-
|
|
233
|
+
|
|
234
|
+
def formatter(prog):
|
|
235
|
+
return argparse.HelpFormatter(prog, max_help_position=30)
|
|
236
|
+
|
|
237
|
+
parser = argparse.ArgumentParser(formatter_class=formatter)
|
|
231
238
|
parser.add_argument("username", help="github username")
|
|
232
239
|
parser.add_argument(
|
|
233
240
|
"--dir",
|
|
234
241
|
default=os.getcwd(),
|
|
235
|
-
help="output directory (default:
|
|
242
|
+
help="output directory (default: .)",
|
|
236
243
|
)
|
|
237
244
|
parser.add_argument(
|
|
238
245
|
"--format",
|
githubtakeout-0.1.11/README.md
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# githubtakeout
|
|
2
|
-
|
|
3
|
-
## Archive Git Repos and Gists from GitHub
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
- Copyright (c) 2015-2025 [Corey Goldberg][github-home]
|
|
8
|
-
- Development: [GitHub][github-repo]
|
|
9
|
-
- Download/Install: [PyPI][pypi-githubtakeout]
|
|
10
|
-
- License: [MIT][mit-license]
|
|
11
|
-
|
|
12
|
-
----
|
|
13
|
-
|
|
14
|
-
## About:
|
|
15
|
-
|
|
16
|
-
`githubtakeout` is a data export tool for archiving Git repositories hosted on GitHub.
|
|
17
|
-
It clones a user's repos and creates an archive of each.
|
|
18
|
-
|
|
19
|
-
It supports public/private repos and public/secret gists. By default, it doesn't save
|
|
20
|
-
commit history or branches (`.git` directory), or Gist repositories (both can be enabled
|
|
21
|
-
with command line options).
|
|
22
|
-
|
|
23
|
-
When you run the program, archives of your repos will be saved in a directory named
|
|
24
|
-
`backups` inside your current working directory, unless a different location is specified
|
|
25
|
-
using the `--dir` option.
|
|
26
|
-
|
|
27
|
-
Archives are saved in compressed zip format (`.zip`) by default, but can also be saved
|
|
28
|
-
as tarballs (`.tar.gz`) using the `--format=tar` option.
|
|
29
|
-
|
|
30
|
-
## Requirements:
|
|
31
|
-
|
|
32
|
-
- Python 3.12+
|
|
33
|
-
- Git 1.7+
|
|
34
|
-
- Python packages:
|
|
35
|
-
- [GitPython][pypi-gitpython]
|
|
36
|
-
- [PyGithub][pypi-pygithub]
|
|
37
|
-
- [rich][pypi-rich]
|
|
38
|
-
|
|
39
|
-
## Installation:
|
|
40
|
-
|
|
41
|
-
Install from [PyPI][pypyi-githubtakeout]:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
pip install githubtakeout
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Authentication:
|
|
48
|
-
|
|
49
|
-
By default, `githubtakeout` will only retrieve an account's public repos. To access private repos and secret gists,
|
|
50
|
-
you need to authenticate.
|
|
51
|
-
|
|
52
|
-
First, you must create a [personal access token][github-pat] on Github (either a fine-grained or classic personal
|
|
53
|
-
access token). Once you have a token, you can set the `GITHUB_TOKEN` environment variable:
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
$ export GITHUB_TOKEN=<access token>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
If you prefer to be prompted for your token each time you run the program, use the `--token` argument.
|
|
60
|
-
|
|
61
|
-
### CLI Options:
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
usage: githubtakeout [-h] [--dir DIR] [--format {tar,zip}] [--gists] [--history] [--list] [--token] username
|
|
65
|
-
|
|
66
|
-
positional arguments:
|
|
67
|
-
username github username
|
|
68
|
-
|
|
69
|
-
options:
|
|
70
|
-
-h, --help show this help message and exit
|
|
71
|
-
--dir DIR output directory (default: ./)
|
|
72
|
-
--format {tar,zip} archive format (default: zip)
|
|
73
|
-
--gists include gists
|
|
74
|
-
--history include commit history and branches (.git directory)
|
|
75
|
-
--list list repos only
|
|
76
|
-
--token prompt for auth token
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Usage Examples:
|
|
80
|
-
|
|
81
|
-
### Install from PyPI with pipx, Run:
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
pipx install githubtakeout
|
|
85
|
-
githubtakeout <github username>
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Clone Repo, Create/Activate Virtual Environment, Install from Source, Run:
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
git clone git@github.com:cgoldberg/githubtakeout.git
|
|
92
|
-
cd ./githubtakeout
|
|
93
|
-
python3 -m venv venv
|
|
94
|
-
source venv/bin/activate
|
|
95
|
-
pip install .
|
|
96
|
-
githubtakeout <github username>
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
[github-home]: https://github.com/cgoldberg
|
|
101
|
-
[github-repo]: https://github.com/cgoldberg/sudokubot
|
|
102
|
-
[github-pat]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
|
|
103
|
-
[pypi-githubtakeout]: https://pypi.org/project/githubtakeout
|
|
104
|
-
[pypi-gitpython]: https://pypi.org/project/GitPython
|
|
105
|
-
[pypi-pygithub]: https://pypi.org/project/PyGithub
|
|
106
|
-
[pypi-rich]: https://pypi.org/project/rich
|
|
107
|
-
[mit-license]: https://raw.githubusercontent.com/cgoldberg/githubtakeout/refs/heads/master/LICENSE
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{githubtakeout-0.1.11 → githubtakeout-0.1.12}/src/githubtakeout.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|