pierre-storage 0.12.1__tar.gz → 1.0.1__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 (27) hide show
  1. pierre_storage-1.0.1/LICENSE +189 -0
  2. {pierre_storage-0.12.1/pierre_storage.egg-info → pierre_storage-1.0.1}/PKG-INFO +76 -27
  3. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/README.md +73 -24
  4. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/client.py +4 -0
  5. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/repo.py +76 -1
  6. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/types.py +25 -1
  7. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/version.py +1 -1
  8. {pierre_storage-0.12.1 → pierre_storage-1.0.1/pierre_storage.egg-info}/PKG-INFO +76 -27
  9. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pyproject.toml +3 -3
  10. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/tests/test_client.py +67 -0
  11. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/tests/test_repo.py +95 -1
  12. pierre_storage-0.12.1/LICENSE +0 -21
  13. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/MANIFEST.in +0 -0
  14. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/__init__.py +0 -0
  15. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/auth.py +0 -0
  16. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/commit.py +0 -0
  17. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/errors.py +0 -0
  18. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/py.typed +0 -0
  19. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage/webhook.py +0 -0
  20. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage.egg-info/SOURCES.txt +0 -0
  21. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage.egg-info/dependency_links.txt +0 -0
  22. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage.egg-info/requires.txt +0 -0
  23. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/pierre_storage.egg-info/top_level.txt +0 -0
  24. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/setup.cfg +0 -0
  25. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/tests/test_commit.py +0 -0
  26. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/tests/test_version.py +0 -0
  27. {pierre_storage-0.12.1 → pierre_storage-1.0.1}/tests/test_webhook.py +0 -0
@@ -0,0 +1,189 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled
32
+ object code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work (an example is provided in the Appendix
37
+ below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object form,
40
+ that is based on (or derived from) the Work and for which the editorial
41
+ revisions, annotations, elaborations, or other modifications represent, as a
42
+ whole, an original work of authorship. For the purposes of this License,
43
+ Derivative Works shall not include works that remain separable from, or
44
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
45
+ Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including the original
48
+ version of the Work and any modifications or additions to that Work or
49
+ Derivative Works thereof, that is intentionally submitted to Licensor for
50
+ inclusion in the Work by the copyright owner or by an individual or Legal
51
+ Entity authorized to submit on behalf of the copyright owner. For the
52
+ purposes of this definition, "submitted" means any form of electronic,
53
+ verbal, or written communication sent to the Licensor or its
54
+ representatives, including but not limited to communication on electronic
55
+ mailing lists, source code control systems, and issue tracking systems that
56
+ are managed by, or on behalf of, the Licensor for the purpose of discussing
57
+ and improving the Work, but excluding communication that is conspicuously
58
+ marked or otherwise designated in writing by the copyright owner as "Not a
59
+ Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
62
+ behalf of whom a Contribution has been received by Licensor and subsequently
63
+ incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
66
+ License, each Contributor hereby grants to You a perpetual, worldwide,
67
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
68
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
69
+ sublicense, and distribute the Work and such Derivative Works in Source or
70
+ Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of this
73
+ License, each Contributor hereby grants to You a perpetual, worldwide,
74
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
75
+ this section) patent license to make, have made, use, offer to sell, sell,
76
+ import, and otherwise transfer the Work, where such license applies only to
77
+ those patent claims licensable by such Contributor that are necessarily
78
+ infringed by their Contribution(s) alone or by combination of their
79
+ Contribution(s) with the Work to which such Contribution(s) was submitted.
80
+ If You institute patent litigation against any entity (including a
81
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
82
+ Contribution incorporated within the Work constitutes direct or contributory
83
+ patent infringement, then any patent licenses granted to You under this
84
+ License for that Work shall terminate as of the date such litigation is
85
+ filed.
86
+
87
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
88
+ Derivative Works thereof in any medium, with or without modifications, and
89
+ in Source or Object form, provided that You meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative Works a
92
+ copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices stating
95
+ that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works that You
98
+ distribute, all copyright, patent, trademark, and attribution notices from
99
+ the Source form of the Work, excluding those notices that do not pertain to
100
+ any part of the Derivative Works; and
101
+
102
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
103
+ then any Derivative Works that You distribute must include a readable copy
104
+ of the attribution notices contained within such NOTICE file, excluding
105
+ those notices that do not pertain to any part of the Derivative Works, in at
106
+ least one of the following places: within a NOTICE text file distributed as
107
+ part of the Derivative Works; within the Source form or documentation, if
108
+ provided along with the Derivative Works; or, within a display generated by
109
+ the Derivative Works, if and wherever such third-party notices normally
110
+ appear. The contents of the NOTICE file are for informational purposes only
111
+ and do not modify the License. You may add Your own attribution notices
112
+ within Derivative Works that You distribute, alongside or as an addendum to
113
+ the NOTICE text from the Work, provided that such additional attribution
114
+ notices cannot be construed as modifying the License.
115
+
116
+ You may add Your own copyright statement to Your modifications and may
117
+ provide additional or different license terms and conditions for use,
118
+ reproduction, or distribution of Your modifications, or for any such
119
+ Derivative Works as a whole, provided Your use, reproduction, and
120
+ distribution of the Work otherwise complies with the conditions stated in
121
+ this License.
122
+
123
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
124
+ Contribution intentionally submitted for inclusion in the Work by You to the
125
+ Licensor shall be under the terms and conditions of this License, without
126
+ any additional terms or conditions. Notwithstanding the above, nothing
127
+ herein shall supersede or modify the terms of any separate license agreement
128
+ you may have executed with Licensor regarding such Contributions.
129
+
130
+ 6. Trademarks. This License does not grant permission to use the trade names,
131
+ trademarks, service marks, or product names of the Licensor, except as
132
+ required for reasonable and customary use in describing the origin of the
133
+ Work and reproducing the content of the NOTICE file.
134
+
135
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
136
+ writing, Licensor provides the Work (and each Contributor provides its
137
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
138
+ KIND, either express or implied, including, without limitation, any
139
+ warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
140
+ FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining
141
+ the appropriateness of using or redistributing the Work and assume any risks
142
+ associated with Your exercise of permissions under this License.
143
+
144
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
145
+ tort (including negligence), contract, or otherwise, unless required by
146
+ applicable law (such as deliberate and grossly negligent acts) or agreed to
147
+ in writing, shall any Contributor be liable to You for damages, including
148
+ any direct, indirect, special, incidental, or consequential damages of any
149
+ character arising as a result of this License or out of the use or inability
150
+ to use the Work (including but not limited to damages for loss of goodwill,
151
+ work stoppage, computer failure or malfunction, or any and all other
152
+ commercial damages or losses), even if such Contributor has been advised of
153
+ the possibility of such damages.
154
+
155
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
156
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
157
+ acceptance of support, warranty, indemnity, or other liability obligations
158
+ and/or rights consistent with this License. However, in accepting such
159
+ obligations, You may act only on Your own behalf and on Your sole
160
+ responsibility, not on behalf of any other Contributor, and only if You
161
+ agree to indemnify, defend, and hold each Contributor harmless for any
162
+ liability incurred by, or claims asserted against, such Contributor by
163
+ reason of your accepting any such warranty or additional liability.
164
+
165
+ END OF TERMS AND CONDITIONS
166
+
167
+ APPENDIX: How to apply the Apache License to your work.
168
+
169
+ To apply the Apache License to your work, attach the following
170
+ boilerplate notice, with the fields enclosed by brackets "[]"
171
+ replaced with your own identifying information. (Don't include
172
+ the brackets!) The text should be enclosed in the appropriate
173
+ comment syntax for the file format. We also recommend that a
174
+ file or class name and description of purpose be included on the
175
+ same "printed page" as the copyright notice for easier
176
+ identification within third-party archives.
177
+
178
+ Copyright 2025 Pierre Computer Company
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
181
+ this file except in compliance with the License. You may obtain a copy of the
182
+ License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software distributed
187
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
188
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
189
+ specific language governing permissions and limitations under the License.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pierre-storage
3
- Version: 0.12.1
3
+ Version: 1.0.1
4
4
  Summary: Pierre Git Storage SDK for Python
5
5
  Author-email: Pierre <support@pierre.io>
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://pierre.io
8
8
  Project-URL: Documentation, https://docs.pierre.io
9
- Project-URL: Repository, https://github.com/pierre/monorepo
10
- Project-URL: Issues, https://github.com/pierre/monorepo/issues
9
+ Project-URL: Repository, https://github.com/pierrecomputer/pierre
10
+ Project-URL: Issues, https://github.com/pierrecomputer/pierre/issues
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Programming Language :: Python :: 3
@@ -171,6 +171,16 @@ response = await repo.get_file_stream(
171
171
  text = await response.aread()
172
172
  print(text.decode())
173
173
 
174
+ # Download repository archive (streaming tar.gz)
175
+ archive_response = await repo.get_archive_stream(
176
+ ref="main",
177
+ include_globs=["README.md"],
178
+ exclude_globs=["vendor/**"],
179
+ archive_prefix="repo/",
180
+ )
181
+ archive_bytes = await archive_response.aread()
182
+ print(len(archive_bytes))
183
+
174
184
  # List all files in the repository
175
185
  files = await repo.list_files(
176
186
  ref="main", # optional, defaults to default branch
@@ -244,7 +254,8 @@ print(commit_diff["files"])
244
254
 
245
255
  ### Creating Commits
246
256
 
247
- The SDK provides a fluent builder API for creating commits with streaming support:
257
+ The SDK provides a fluent builder API for creating commits with streaming
258
+ support:
248
259
 
249
260
  ```python
250
261
  # Create a commit
@@ -268,7 +279,8 @@ print(result["ref_update"]["old_sha"]) # All zeroes when ref is created
268
279
  The builder exposes:
269
280
 
270
281
  - `add_file(path, source, *, mode=None)` - Attach bytes from various sources
271
- - `add_file_from_string(path, contents, encoding="utf-8", *, mode=None)` - Add text files (defaults to UTF-8)
282
+ - `add_file_from_string(path, contents, encoding="utf-8", *, mode=None)` - Add
283
+ text files (defaults to UTF-8)
272
284
  - `delete_path(path)` - Remove files or folders
273
285
  - `send()` - Finalize the commit and receive metadata
274
286
 
@@ -289,22 +301,29 @@ The builder exposes:
289
301
  }
290
302
  ```
291
303
 
292
- If the backend reports a failure, the builder raises a `RefUpdateError` containing the status, reason, and ref details.
304
+ If the backend reports a failure, the builder raises a `RefUpdateError`
305
+ containing the status, reason, and ref details.
293
306
 
294
307
  **Options:**
295
308
 
296
309
  - `target_branch` (required): Branch name (without `refs/heads/` prefix)
297
- - `expected_head_sha` (optional): Branch or commit that must match the remote tip
298
- - `base_branch` (optional): Name of the branch to use as the base when creating a new branch (without `refs/heads/` prefix)
299
- - `ephemeral` (optional): Mark the target branch as ephemeral (stored in separate namespace)
300
- - `ephemeral_base` (optional): Indicates the base branch is ephemeral (requires `base_branch`)
310
+ - `expected_head_sha` (optional): Branch or commit that must match the remote
311
+ tip
312
+ - `base_branch` (optional): Name of the branch to use as the base when creating
313
+ a new branch (without `refs/heads/` prefix)
314
+ - `ephemeral` (optional): Mark the target branch as ephemeral (stored in
315
+ separate namespace)
316
+ - `ephemeral_base` (optional): Indicates the base branch is ephemeral (requires
317
+ `base_branch`)
301
318
  - `commit_message` (required): The commit message
302
319
  - `author` (required): Dictionary with `name` and `email`
303
- - `committer` (optional): Dictionary with `name` and `email` (defaults to author)
320
+ - `committer` (optional): Dictionary with `name` and `email` (defaults to
321
+ author)
304
322
 
305
323
  ### Creating Commits from Diff Streams
306
324
 
307
- When you already have a unified diff, you can let the SDK apply it directly without building individual file operations:
325
+ When you already have a unified diff, you can let the SDK apply it directly
326
+ without building individual file operations:
308
327
 
309
328
  ```python
310
329
  diff_text = """\
@@ -327,13 +346,21 @@ result = await repo.create_commit_from_diff(
327
346
  print(result["commit_sha"])
328
347
  ```
329
348
 
330
- `diff` accepts the same source types as the commit builder (string, bytes, async iterator, etc.). The helper automatically streams the diff to the `/diff-commit` endpoint and returns a `CommitResult`. On conflicts or validation errors, it raises `RefUpdateError` with the server-provided status and message.
349
+ `diff` accepts the same source types as the commit builder (string, bytes, async
350
+ iterator, etc.). The helper automatically streams the diff to the `/diff-commit`
351
+ endpoint and returns a `CommitResult`. On conflicts or validation errors, it
352
+ raises `RefUpdateError` with the server-provided status and message.
331
353
 
332
- You can provide the same metadata options as `create_commit`, including `expected_head_sha`, `base_branch`, `ephemeral`, `ephemeral_base`, and `committer`.
354
+ You can provide the same metadata options as `create_commit`, including
355
+ `expected_head_sha`, `base_branch`, `ephemeral`, `ephemeral_base`, and
356
+ `committer`.
333
357
 
334
- > Files are chunked into 4 MiB segments, allowing streaming of large assets without buffering in memory.
358
+ > Files are chunked into 4 MiB segments, allowing streaming of large assets
359
+ > without buffering in memory.
335
360
 
336
- > The `target_branch` must already exist on the remote repository. To seed an empty repository, omit `expected_head_sha`; the service will create the first commit only when no refs are present.
361
+ > The `target_branch` must already exist on the remote repository. To seed an
362
+ > empty repository, omit `expected_head_sha`; the service will create the first
363
+ > commit only when no refs are present.
337
364
 
338
365
  **Branching Example:**
339
366
 
@@ -353,7 +380,9 @@ result = await (
353
380
 
354
381
  ### Ephemeral Branches
355
382
 
356
- Ephemeral branches are temporary branches that are stored in a separate namespace. They're useful for preview environments, temporary workspaces, or short-lived feature branches that don't need to be permanent.
383
+ Ephemeral branches are temporary branches that are stored in a separate
384
+ namespace. They're useful for preview environments, temporary workspaces, or
385
+ short-lived feature branches that don't need to be permanent.
357
386
 
358
387
  **Creating an ephemeral branch:**
359
388
 
@@ -424,9 +453,12 @@ print(result["target_branch"]) # "feature/awesome-change"
424
453
 
425
454
  - Ephemeral branches are stored separately from regular branches
426
455
  - Use `ephemeral=True` when creating commits, reading files, or listing files
427
- - Use `ephemeral_base=True` when branching off another ephemeral branch (requires `base_branch`)
428
- - Promote an ephemeral branch with `repo.promote_ephemeral_branch()`; omit `target_branch` to keep the same name
429
- - Ephemeral branches are ideal for temporary previews, CI/CD environments, or experiments
456
+ - Use `ephemeral_base=True` when branching off another ephemeral branch
457
+ (requires `base_branch`)
458
+ - Promote an ephemeral branch with `repo.promote_ephemeral_branch()`; omit
459
+ `target_branch` to keep the same name
460
+ - Ephemeral branches are ideal for temporary previews, CI/CD environments, or
461
+ experiments
430
462
 
431
463
  ### Streaming Large Files
432
464
 
@@ -476,9 +508,11 @@ commits = await repo.list_commits()
476
508
 
477
509
  **How it works:**
478
510
 
479
- 1. When you create a repo with `base_repo`, Pierre links it to the specified GitHub repository
511
+ 1. When you create a repo with `base_repo`, Pierre links it to the specified
512
+ GitHub repository
480
513
  2. The `pull_upstream()` method fetches the latest changes from GitHub
481
- 3. You can then use all Pierre SDK features (diffs, commits, file access) on the synced content
514
+ 3. You can then use all Pierre SDK features (diffs, commits, file access) on the
515
+ synced content
482
516
  4. The provider is automatically set to `"github"` when using `base_repo`
483
517
 
484
518
  ### Forking Repositories
@@ -564,6 +598,16 @@ class Repo:
564
598
  ttl: Optional[int] = None,
565
599
  ) -> Response: ...
566
600
 
601
+ async def get_archive_stream(
602
+ self,
603
+ *,
604
+ ref: Optional[str] = None,
605
+ include_globs: Optional[List[str]] = None,
606
+ exclude_globs: Optional[List[str]] = None,
607
+ archive_prefix: Optional[str] = None,
608
+ ttl: Optional[int] = None,
609
+ ) -> Response: ...
610
+
567
611
  async def list_files(
568
612
  self,
569
613
  *,
@@ -724,17 +768,20 @@ else:
724
768
 
725
769
  ## Authentication
726
770
 
727
- The SDK uses JWT (JSON Web Tokens) for authentication. When you call `get_remote_url()`, it:
771
+ The SDK uses JWT (JSON Web Tokens) for authentication. When you call
772
+ `get_remote_url()`, it:
728
773
 
729
774
  1. Creates a JWT with your name, repository ID, and requested permissions
730
775
  2. Signs it with your private key (ES256, RS256, or EdDSA)
731
776
  3. Embeds it in the Git remote URL as the password
732
777
 
733
- The generated URLs are compatible with standard Git clients and include all necessary authentication.
778
+ The generated URLs are compatible with standard Git clients and include all
779
+ necessary authentication.
734
780
 
735
781
  ### Manual JWT Generation
736
782
 
737
- For advanced use cases, you can generate JWTs manually using the `generate_jwt` helper:
783
+ For advanced use cases, you can generate JWTs manually using the `generate_jwt`
784
+ helper:
738
785
 
739
786
  ```python
740
787
  from pierre_storage import generate_jwt
@@ -761,11 +808,13 @@ git_url = f"https://t:{token}@your-name.code.storage/your-repo-id.git"
761
808
  - `key_pem` (required): Private key in PEM format (PKCS8)
762
809
  - `issuer` (required): Token issuer (your customer name)
763
810
  - `repo_id` (required): Repository identifier
764
- - `scopes` (optional): List of permission scopes. Defaults to `["git:write", "git:read"]`
811
+ - `scopes` (optional): List of permission scopes. Defaults to
812
+ `["git:write", "git:read"]`
765
813
  - Available scopes: `"git:read"`, `"git:write"`, `"repo:write"`
766
814
  - `ttl` (optional): Time-to-live in seconds. Defaults to 31536000 (1 year)
767
815
 
768
- The function automatically detects the key type (RSA, EC, or EdDSA) and uses the appropriate signing algorithm (RS256, ES256, or EdDSA).
816
+ The function automatically detects the key type (RSA, EC, or EdDSA) and uses the
817
+ appropriate signing algorithm (RS256, ES256, or EdDSA).
769
818
 
770
819
  ## Error Handling
771
820
 
@@ -135,6 +135,16 @@ response = await repo.get_file_stream(
135
135
  text = await response.aread()
136
136
  print(text.decode())
137
137
 
138
+ # Download repository archive (streaming tar.gz)
139
+ archive_response = await repo.get_archive_stream(
140
+ ref="main",
141
+ include_globs=["README.md"],
142
+ exclude_globs=["vendor/**"],
143
+ archive_prefix="repo/",
144
+ )
145
+ archive_bytes = await archive_response.aread()
146
+ print(len(archive_bytes))
147
+
138
148
  # List all files in the repository
139
149
  files = await repo.list_files(
140
150
  ref="main", # optional, defaults to default branch
@@ -208,7 +218,8 @@ print(commit_diff["files"])
208
218
 
209
219
  ### Creating Commits
210
220
 
211
- The SDK provides a fluent builder API for creating commits with streaming support:
221
+ The SDK provides a fluent builder API for creating commits with streaming
222
+ support:
212
223
 
213
224
  ```python
214
225
  # Create a commit
@@ -232,7 +243,8 @@ print(result["ref_update"]["old_sha"]) # All zeroes when ref is created
232
243
  The builder exposes:
233
244
 
234
245
  - `add_file(path, source, *, mode=None)` - Attach bytes from various sources
235
- - `add_file_from_string(path, contents, encoding="utf-8", *, mode=None)` - Add text files (defaults to UTF-8)
246
+ - `add_file_from_string(path, contents, encoding="utf-8", *, mode=None)` - Add
247
+ text files (defaults to UTF-8)
236
248
  - `delete_path(path)` - Remove files or folders
237
249
  - `send()` - Finalize the commit and receive metadata
238
250
 
@@ -253,22 +265,29 @@ The builder exposes:
253
265
  }
254
266
  ```
255
267
 
256
- If the backend reports a failure, the builder raises a `RefUpdateError` containing the status, reason, and ref details.
268
+ If the backend reports a failure, the builder raises a `RefUpdateError`
269
+ containing the status, reason, and ref details.
257
270
 
258
271
  **Options:**
259
272
 
260
273
  - `target_branch` (required): Branch name (without `refs/heads/` prefix)
261
- - `expected_head_sha` (optional): Branch or commit that must match the remote tip
262
- - `base_branch` (optional): Name of the branch to use as the base when creating a new branch (without `refs/heads/` prefix)
263
- - `ephemeral` (optional): Mark the target branch as ephemeral (stored in separate namespace)
264
- - `ephemeral_base` (optional): Indicates the base branch is ephemeral (requires `base_branch`)
274
+ - `expected_head_sha` (optional): Branch or commit that must match the remote
275
+ tip
276
+ - `base_branch` (optional): Name of the branch to use as the base when creating
277
+ a new branch (without `refs/heads/` prefix)
278
+ - `ephemeral` (optional): Mark the target branch as ephemeral (stored in
279
+ separate namespace)
280
+ - `ephemeral_base` (optional): Indicates the base branch is ephemeral (requires
281
+ `base_branch`)
265
282
  - `commit_message` (required): The commit message
266
283
  - `author` (required): Dictionary with `name` and `email`
267
- - `committer` (optional): Dictionary with `name` and `email` (defaults to author)
284
+ - `committer` (optional): Dictionary with `name` and `email` (defaults to
285
+ author)
268
286
 
269
287
  ### Creating Commits from Diff Streams
270
288
 
271
- When you already have a unified diff, you can let the SDK apply it directly without building individual file operations:
289
+ When you already have a unified diff, you can let the SDK apply it directly
290
+ without building individual file operations:
272
291
 
273
292
  ```python
274
293
  diff_text = """\
@@ -291,13 +310,21 @@ result = await repo.create_commit_from_diff(
291
310
  print(result["commit_sha"])
292
311
  ```
293
312
 
294
- `diff` accepts the same source types as the commit builder (string, bytes, async iterator, etc.). The helper automatically streams the diff to the `/diff-commit` endpoint and returns a `CommitResult`. On conflicts or validation errors, it raises `RefUpdateError` with the server-provided status and message.
313
+ `diff` accepts the same source types as the commit builder (string, bytes, async
314
+ iterator, etc.). The helper automatically streams the diff to the `/diff-commit`
315
+ endpoint and returns a `CommitResult`. On conflicts or validation errors, it
316
+ raises `RefUpdateError` with the server-provided status and message.
295
317
 
296
- You can provide the same metadata options as `create_commit`, including `expected_head_sha`, `base_branch`, `ephemeral`, `ephemeral_base`, and `committer`.
318
+ You can provide the same metadata options as `create_commit`, including
319
+ `expected_head_sha`, `base_branch`, `ephemeral`, `ephemeral_base`, and
320
+ `committer`.
297
321
 
298
- > Files are chunked into 4 MiB segments, allowing streaming of large assets without buffering in memory.
322
+ > Files are chunked into 4 MiB segments, allowing streaming of large assets
323
+ > without buffering in memory.
299
324
 
300
- > The `target_branch` must already exist on the remote repository. To seed an empty repository, omit `expected_head_sha`; the service will create the first commit only when no refs are present.
325
+ > The `target_branch` must already exist on the remote repository. To seed an
326
+ > empty repository, omit `expected_head_sha`; the service will create the first
327
+ > commit only when no refs are present.
301
328
 
302
329
  **Branching Example:**
303
330
 
@@ -317,7 +344,9 @@ result = await (
317
344
 
318
345
  ### Ephemeral Branches
319
346
 
320
- Ephemeral branches are temporary branches that are stored in a separate namespace. They're useful for preview environments, temporary workspaces, or short-lived feature branches that don't need to be permanent.
347
+ Ephemeral branches are temporary branches that are stored in a separate
348
+ namespace. They're useful for preview environments, temporary workspaces, or
349
+ short-lived feature branches that don't need to be permanent.
321
350
 
322
351
  **Creating an ephemeral branch:**
323
352
 
@@ -388,9 +417,12 @@ print(result["target_branch"]) # "feature/awesome-change"
388
417
 
389
418
  - Ephemeral branches are stored separately from regular branches
390
419
  - Use `ephemeral=True` when creating commits, reading files, or listing files
391
- - Use `ephemeral_base=True` when branching off another ephemeral branch (requires `base_branch`)
392
- - Promote an ephemeral branch with `repo.promote_ephemeral_branch()`; omit `target_branch` to keep the same name
393
- - Ephemeral branches are ideal for temporary previews, CI/CD environments, or experiments
420
+ - Use `ephemeral_base=True` when branching off another ephemeral branch
421
+ (requires `base_branch`)
422
+ - Promote an ephemeral branch with `repo.promote_ephemeral_branch()`; omit
423
+ `target_branch` to keep the same name
424
+ - Ephemeral branches are ideal for temporary previews, CI/CD environments, or
425
+ experiments
394
426
 
395
427
  ### Streaming Large Files
396
428
 
@@ -440,9 +472,11 @@ commits = await repo.list_commits()
440
472
 
441
473
  **How it works:**
442
474
 
443
- 1. When you create a repo with `base_repo`, Pierre links it to the specified GitHub repository
475
+ 1. When you create a repo with `base_repo`, Pierre links it to the specified
476
+ GitHub repository
444
477
  2. The `pull_upstream()` method fetches the latest changes from GitHub
445
- 3. You can then use all Pierre SDK features (diffs, commits, file access) on the synced content
478
+ 3. You can then use all Pierre SDK features (diffs, commits, file access) on the
479
+ synced content
446
480
  4. The provider is automatically set to `"github"` when using `base_repo`
447
481
 
448
482
  ### Forking Repositories
@@ -528,6 +562,16 @@ class Repo:
528
562
  ttl: Optional[int] = None,
529
563
  ) -> Response: ...
530
564
 
565
+ async def get_archive_stream(
566
+ self,
567
+ *,
568
+ ref: Optional[str] = None,
569
+ include_globs: Optional[List[str]] = None,
570
+ exclude_globs: Optional[List[str]] = None,
571
+ archive_prefix: Optional[str] = None,
572
+ ttl: Optional[int] = None,
573
+ ) -> Response: ...
574
+
531
575
  async def list_files(
532
576
  self,
533
577
  *,
@@ -688,17 +732,20 @@ else:
688
732
 
689
733
  ## Authentication
690
734
 
691
- The SDK uses JWT (JSON Web Tokens) for authentication. When you call `get_remote_url()`, it:
735
+ The SDK uses JWT (JSON Web Tokens) for authentication. When you call
736
+ `get_remote_url()`, it:
692
737
 
693
738
  1. Creates a JWT with your name, repository ID, and requested permissions
694
739
  2. Signs it with your private key (ES256, RS256, or EdDSA)
695
740
  3. Embeds it in the Git remote URL as the password
696
741
 
697
- The generated URLs are compatible with standard Git clients and include all necessary authentication.
742
+ The generated URLs are compatible with standard Git clients and include all
743
+ necessary authentication.
698
744
 
699
745
  ### Manual JWT Generation
700
746
 
701
- For advanced use cases, you can generate JWTs manually using the `generate_jwt` helper:
747
+ For advanced use cases, you can generate JWTs manually using the `generate_jwt`
748
+ helper:
702
749
 
703
750
  ```python
704
751
  from pierre_storage import generate_jwt
@@ -725,11 +772,13 @@ git_url = f"https://t:{token}@your-name.code.storage/your-repo-id.git"
725
772
  - `key_pem` (required): Private key in PEM format (PKCS8)
726
773
  - `issuer` (required): Token issuer (your customer name)
727
774
  - `repo_id` (required): Repository identifier
728
- - `scopes` (optional): List of permission scopes. Defaults to `["git:write", "git:read"]`
775
+ - `scopes` (optional): List of permission scopes. Defaults to
776
+ `["git:write", "git:read"]`
729
777
  - Available scopes: `"git:read"`, `"git:write"`, `"repo:write"`
730
778
  - `ttl` (optional): Time-to-live in seconds. Defaults to 31536000 (1 year)
731
779
 
732
- The function automatically detects the key type (RSA, EC, or EdDSA) and uses the appropriate signing algorithm (RS256, ES256, or EdDSA).
780
+ The function automatically detects the key type (RSA, EC, or EdDSA) and uses the
781
+ appropriate signing algorithm (RS256, ES256, or EdDSA).
733
782
 
734
783
  ## Error Handling
735
784
 
@@ -1,6 +1,7 @@
1
1
  """Main client for Pierre Git Storage SDK."""
2
2
 
3
3
  import uuid
4
+ from datetime import datetime, timezone
4
5
  from typing import Any, Dict, Optional, cast
5
6
  from urllib.parse import urlencode
6
7
 
@@ -216,6 +217,7 @@ class GitStorage:
216
217
  name,
217
218
  api_version,
218
219
  self._generate_jwt,
220
+ created_at=datetime.now(timezone.utc).isoformat(),
219
221
  )
220
222
 
221
223
  async def list_repos(
@@ -317,6 +319,7 @@ class GitStorage:
317
319
 
318
320
  body = response.json()
319
321
  default_branch = body.get("default_branch", "main")
322
+ created_at = body.get("created_at", "")
320
323
 
321
324
  # These are guaranteed to be set in __init__
322
325
  api_base_url: str = self.options["api_base_url"] # type: ignore[assignment]
@@ -332,6 +335,7 @@ class GitStorage:
332
335
  name,
333
336
  api_version,
334
337
  self._generate_jwt,
338
+ created_at=created_at,
335
339
  )
336
340
 
337
341
  async def delete_repo(