flat-packager 0.4.0__py3-none-any.whl

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.
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.4
2
+ Name: flat-packager
3
+ Version: 0.4.0
4
+ Summary: Pack a repository into one flat text archive and restore it later.
5
+ Author: Thomas
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/tomanizer/flat-packager
8
+ Project-URL: Repository, https://github.com/tomanizer/flat-packager
9
+ Project-URL: Documentation, https://github.com/tomanizer/flat-packager#readme
10
+ Project-URL: Changelog, https://github.com/tomanizer/flat-packager/blob/main/CHANGELOG.md
11
+ Keywords: archive,repository,github,packaging,restore
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development :: Version Control :: Git
23
+ Classifier: Topic :: System :: Archiving
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: build>=1.2; extra == "dev"
29
+ Requires-Dist: twine>=5.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # Flat Packager
33
+
34
+ Flat Packager turns a repository into one flat text archive, then rebuilds the
35
+ original folder structure from that archive.
36
+
37
+ The default archive format is newline-delimited JSON with chunked base64 file
38
+ payloads. Text files, binary files, empty directories, and symlinks survive the
39
+ round trip. Restores validate archive paths, duplicate entries, symlink
40
+ ancestry, chunk ordering, and recorded SHA-256 hashes before writing file
41
+ contents.
42
+
43
+ ## Install
44
+
45
+ From PyPI:
46
+
47
+ ```bash
48
+ python3 -m pip install flat-packager
49
+ ```
50
+
51
+ From a checkout:
52
+
53
+ ```bash
54
+ python3 -m pip install .
55
+ ```
56
+
57
+ For development:
58
+
59
+ ```bash
60
+ python3 -m pip install -e ".[dev]"
61
+ make test
62
+ ```
63
+
64
+ This installs four console commands:
65
+
66
+ ```bash
67
+ flat-pack --help
68
+ flat-unpack --help
69
+ flat-inspect --help
70
+ flat-verify --help
71
+ ```
72
+
73
+ The repository also keeps compatibility wrappers:
74
+
75
+ ```bash
76
+ python3 pack_repo.py --help
77
+ python3 unpack_repo.py --help
78
+ ```
79
+
80
+ ## Pack a Repository
81
+
82
+ Pack a local repository:
83
+
84
+ ```bash
85
+ flat-pack /path/to/repo repo.flat.txt
86
+ ```
87
+
88
+ Pack a public GitHub repository by shorthand or Git URL:
89
+
90
+ ```bash
91
+ flat-pack owner/repo repo.flat.txt
92
+ flat-pack https://github.com/owner/repo.git repo.flat.txt
93
+ ```
94
+
95
+ Remote repositories are cloned with `--depth 1` by default. You can select a
96
+ branch or tag, include submodules, or request a full clone:
97
+
98
+ ```bash
99
+ flat-pack owner/repo repo.flat.txt --branch main
100
+ flat-pack owner/repo repo.flat.txt --recurse-submodules
101
+ flat-pack owner/repo repo.flat.txt --no-shallow
102
+ ```
103
+
104
+ By default, local directory scans include all files and directories except
105
+ `.git`. To include only tracked git files:
106
+
107
+ ```bash
108
+ flat-pack /path/to/repo repo.flat.txt --tracked-only
109
+ ```
110
+
111
+ Useful options:
112
+
113
+ ```bash
114
+ flat-pack /path/to/repo repo.flat.txt --exclude "node_modules/*"
115
+ flat-pack /path/to/repo repo.flat.txt --max-file-bytes 10485760
116
+ flat-pack /path/to/repo repo.flat.txt --include-git
117
+ ```
118
+
119
+ ## Format and Compression
120
+
121
+ New archives use format version 2 by default. Version 2 stores each regular
122
+ file as metadata plus one or more base64 chunk records, which keeps memory usage
123
+ bounded while packing and restoring large files.
124
+
125
+ ```bash
126
+ flat-pack /path/to/repo repo.flat.txt --chunk-size 1048576
127
+ ```
128
+
129
+ To write the legacy inline format:
130
+
131
+ ```bash
132
+ flat-pack /path/to/repo repo.v1.flat.txt --format-version 1
133
+ ```
134
+
135
+ To gzip-compress an archive:
136
+
137
+ ```bash
138
+ flat-pack /path/to/repo repo.flat.txt.gz --compress gzip
139
+ ```
140
+
141
+ `--compress auto` is the default and writes gzip when the output path ends in
142
+ `.gz`. Restore, inspect, and verify commands auto-detect gzip archives.
143
+
144
+ ## Restore a Repository
145
+
146
+ ```bash
147
+ flat-unpack repo.flat.txt restored-repo
148
+ ```
149
+
150
+ If the output directory already contains files:
151
+
152
+ ```bash
153
+ flat-unpack repo.flat.txt restored-repo --overwrite
154
+ ```
155
+
156
+ Restores are staged in a temporary sibling directory and moved into place only
157
+ after the full archive validates and writes successfully. If validation fails,
158
+ the existing output directory is left unchanged.
159
+
160
+ Validate an archive without writing files:
161
+
162
+ ```bash
163
+ flat-unpack repo.flat.txt restored-repo --verify-only
164
+ ```
165
+
166
+ You can also validate without naming an output directory:
167
+
168
+ ```bash
169
+ flat-verify repo.flat.txt
170
+ ```
171
+
172
+ On systems where symlink creation is unavailable:
173
+
174
+ ```bash
175
+ flat-unpack repo.flat.txt restored-repo --no-symlinks
176
+ ```
177
+
178
+ ## Inspect an Archive
179
+
180
+ ```bash
181
+ flat-inspect repo.flat.txt
182
+ flat-inspect repo.flat.txt --json
183
+ flat-inspect repo.flat.txt --limit 20
184
+ ```
185
+
186
+ Inspection validates the archive first, then reports version, compression,
187
+ source metadata, entry counts, total file bytes, chunk count, largest files, and
188
+ symlinks.
189
+
190
+ ## Safety Model
191
+
192
+ Flat Packager is intended for moving repository snapshots, not for executing or
193
+ trusting their contents. Treat archives from untrusted sources the same way you
194
+ would treat a zip file from an untrusted source.
195
+
196
+ The restore step rejects:
197
+
198
+ - absolute archive paths
199
+ - `..`, `.`, empty, or backslash path segments
200
+ - duplicate archive paths
201
+ - file or directory records nested underneath an archived symlink
202
+ - chunk records that are missing, out of order, corrupt, or attached to the
203
+ wrong file
204
+ - corrupt base64, size, or SHA-256 data
205
+
206
+ Restored symlinks may still point outside the restored repository, because that
207
+ is valid repository content. Use `--no-symlinks` if you want symlink targets
208
+ written as text files instead.
209
+
210
+ ## Limitations
211
+
212
+ - File contents are base64 encoded, so archives are larger than raw file bytes.
213
+ Use gzip compression when archive size matters.
214
+ - Legacy format version 1 stores each file as one JSON record and is
215
+ memory-heavy for large files. Version 2 is chunked and is the default.
216
+ - Remote GitHub packing depends on local `git` and whatever authentication your
217
+ git installation already has configured.
218
+ - Git LFS files are captured as whatever exists in the cloned checkout. If LFS
219
+ smudge is disabled or unavailable, pointer files may be archived instead of
220
+ large objects.
221
+ - This stores file bytes, directory modes, file modes, and symlink targets. It
222
+ does not preserve owners, groups, extended attributes, ACLs, hard links,
223
+ timestamps, git history, or ignored remote refs.
224
+
225
+ ## Test
226
+
227
+ ```bash
228
+ python3 -m unittest discover -s tests
229
+ ```
230
+
231
+ Build a wheel:
232
+
233
+ ```bash
234
+ python3 -m pip install ".[dev]"
235
+ python3 -m build
236
+ ```
237
+
238
+ ## Release
239
+
240
+ See [CHANGELOG.md](CHANGELOG.md) and [docs/RELEASING.md](docs/RELEASING.md).
241
+
242
+ ```bash
243
+ make release-check
244
+ ```
@@ -0,0 +1,12 @@
1
+ flat_packager/__init__.py,sha256=NGZKw1beQ3of5_dyg3FuH8IgFZxaatbvvMJdXGZYfF8,570
2
+ flat_packager/archive.py,sha256=o6S903h0_to7vFH2Sk_nIEHI7S1AnOinPcBN1Iwp6lQ,2131
3
+ flat_packager/inspect.py,sha256=o9Eopo3tNIAtO7C7DME4Xp-j-kN1aKrM7WroSpXpyIE,4648
4
+ flat_packager/pack.py,sha256=Jw7JplxYGyv59hD8mbIcr7n-llhnmcwpLnthPD247RQ,15600
5
+ flat_packager/unpack.py,sha256=X9Qk3zjJ5pPywtgJJg-GqfPjPIRcDGeuHoQvXdwDyAs,19021
6
+ flat_packager/verify.py,sha256=I-iucSJZiL34ixLq4x5WzzydnX02ormizKuTpxkLiEM,1148
7
+ flat_packager-0.4.0.dist-info/licenses/LICENSE,sha256=BufjMxd0D5d391bc2OKLamcn-jJishUEP4ngVrSMF8Y,1063
8
+ flat_packager-0.4.0.dist-info/METADATA,sha256=KE0MBKLAzgy-G8_BFSG3BHnyic17RyqMpgNCHwcQDJA,6688
9
+ flat_packager-0.4.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
10
+ flat_packager-0.4.0.dist-info/entry_points.txt,sha256=6hUb3iDRib01PVZ1uE1_x4cp0jgH09BvSdxJYmk_8KU,176
11
+ flat_packager-0.4.0.dist-info/top_level.txt,sha256=le59f_b7sIYm8LkA94PWg9eiHSqxO_N7BU91F-psN2Y,14
12
+ flat_packager-0.4.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ flat-inspect = flat_packager.inspect:main
3
+ flat-pack = flat_packager.pack:main
4
+ flat-unpack = flat_packager.unpack:main
5
+ flat-verify = flat_packager.verify:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Thomas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ flat_packager