gitd-client 0.14.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,92 @@
1
+ Metadata-Version: 2.5
2
+ Name: gitd-client
3
+ Version: 0.14.0
4
+ Summary: Client for gitd: instant, secretless git checkouts for agent sandboxes
5
+ Project-URL: Homepage, https://github.com/dooservice/gitd
6
+ Project-URL: Source, https://github.com/dooservice/gitd/tree/main/sdk/python
7
+ License-Expression: Apache-2.0
8
+ Keywords: ai-agents,git,grpc,sandbox,workspace
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Software Development :: Version Control :: Git
12
+ Requires-Python: >=3.11
13
+ Requires-Dist: grpcio-status>=1.84.0
14
+ Requires-Dist: grpcio>=1.84.0
15
+ Requires-Dist: protobuf>=7.36.2
16
+ Description-Content-Type: text/markdown
17
+
18
+ # gitd for Python
19
+
20
+ A client for [gitd](https://github.com/dooservice/gitd): instant, secretless git checkouts
21
+ for agent sandboxes. Your agents work in their own copy and publish a branch; they never
22
+ see your token.
23
+
24
+ ```sh
25
+ pip install gitd-client
26
+ ```
27
+
28
+ It is imported as `gitd`. Up to 0.13.0 it was published as `gitd`; from 0.14.0 it is
29
+ `gitd-client`, the name every gitd client has.
30
+
31
+ ```python
32
+ from gitd import Gitd, GitdError
33
+
34
+ with Gitd() as gitd: # $GITD_SOCKET, then /run/gitd/gitd.sock
35
+ workspace = gitd.prepare("https://github.com/acme/web", "/var/lib/gitd/workspaces/agent-1")
36
+ print(workspace.path, workspace.commit, workspace.strategy)
37
+
38
+ # … the agent works in workspace.path with plain git, and commits …
39
+
40
+ published = gitd.publish(workspace.path, "agents/fix-login")
41
+ gitd.remove(workspace.path)
42
+ ```
43
+
44
+ No call takes a credential: gitd reads and publishes with the ones it keeps.
45
+
46
+ | Method | What it does |
47
+ |---|---|
48
+ | `prepare(url, path, *, branch, commit, submodules, full_history, strategy, on_progress)` | A workspace of a repository at a path under gitd's roots |
49
+ | `update(path, *, branch, submodules, on_progress)` | To the tip of its branch, or of the branch given |
50
+ | `checkout(path, commit, *, submodules, on_progress)` | To a commit, as a rollback does |
51
+ | `describe(path)` | Its repository, commit, branch, uncommitted changes and submodules |
52
+ | `publish(path, branch, *, requested_by, pull_request, provenance, sandbox, update)` | Its commits pushed to a new branch, or with `update` an earlier publish's branch moved forward; its pull request opened or updated |
53
+ | `remove(path)` | Deleted; its pool stays |
54
+ | `probe(url)` | Whether it can be read, its default branch and branches |
55
+ | `info()` | Which gitd answers, and how it makes workspaces here and why |
56
+ | `audit(*, since, url, limit)` | Every publish, done or refused, newest first |
57
+
58
+ ```python
59
+ from gitd import PullRequestOptions
60
+
61
+ published = gitd.publish(
62
+ workspace.path, "agents/fix-login", update=True,
63
+ pull_request=PullRequestOptions(open=True, submodules=True, title="Fix the login", body="…"),
64
+ )
65
+ print(published.pull_request.url, published.pull_request.updated)
66
+ for submodule in published.submodule_pull_requests: # merged first, with a merge commit
67
+ print(submodule.path, submodule.pull_request or submodule.refused)
68
+ ```
69
+
70
+ A refusal raises `GitdError`, with `reason` (`AUTH_REQUIRED`, `NOT_FOUND`, `PATH_REFUSED`,
71
+ `BRANCH_REFUSED`, `BUSY`, …) and `said`, what git said. Decide from the reason, never from
72
+ the message.
73
+
74
+ [`examples/agent.py`](examples/agent.py) is an agent's whole round trip.
75
+
76
+ ## Layout
77
+
78
+ | Path | What it is |
79
+ |---|---|
80
+ | `src/gitd/client.py` | `Gitd`, the client |
81
+ | `src/gitd/models.py` | What gitd answers, as dataclasses |
82
+ | `src/gitd/errors.py` | `GitdError` |
83
+ | `src/gitd/timestamps.py` | Between the contract's timestamps and `datetime` |
84
+ | `src/gitd/connection.py` | The channel to the socket, and how calls are made |
85
+ | `src/gitd/methods.py` | The gitd methods called, by their gRPC path |
86
+ | `src/gitd/messages.py` | The messages of the contract the client uses |
87
+ | `src/gitd/contract.py` | Reads the contract at run time, with protobuf's public API |
88
+ | `src/gitd/contract.json` | The contract, built from [`proto/gitd/v1/gitd.proto`](../../proto/gitd/v1/gitd.proto) by `make generate` |
89
+
90
+ No code is generated: the client reads gitd's contract when it starts.
91
+
92
+ Python 3.11 or later, on Linux, macOS and Windows. Apache-2.0.
@@ -0,0 +1,22 @@
1
+ gitd/__init__.py,sha256=h7oVjXVCt1G9Yfo5PojppnzuuwuwP30akBTdXdemlq0,1865
2
+ gitd/changes.py,sha256=zN-HqNjSdYl5Urozf7Wt6l6ZXMQRlb6DToli2bauIq0,2127
3
+ gitd/client.py,sha256=bRwEaQl1P4JfbNqUwbbAJM98xpBl7Ozpfu_Q1msJXnw,10471
4
+ gitd/comparison.py,sha256=cec-szp9VaJ51qnZWnm54_6W5SsLcdrlMVeuSUtygM8,2976
5
+ gitd/connection.py,sha256=dMA9SDnR38twzznGgG68fFbNGo1neOZyBp250PxzVTc,5166
6
+ gitd/contract.json,sha256=lqtwquuA169dzdTmYSOgkhXrY1Xyemt4Wy2aspcM_VY,89184
7
+ gitd/contract.py,sha256=_hvrks2Lu4Ugcp53aYSxiO83n8EsaoA2BTqmF7r5lPc,1826
8
+ gitd/credentials_calls.py,sha256=m7WMVPc3Azl4su9QPaZ58uIggW8lOfxc8ZiijLOGbZ4,3684
9
+ gitd/endpoint_calls.py,sha256=XU6BJN69qV6hlCR9A8HjUbqv3KaZBFuCDVHtFH2z7OI,2046
10
+ gitd/endpoint_tokens.py,sha256=RoqnS8HVb_kHYzc5z4tfkRQ6Ubst8JTfjqJtAGUT9r4,1656
11
+ gitd/errors.py,sha256=QU8NWOyfh5Z6I4irwUds6c6DsouRWDyB_sERdOvGK0M,1326
12
+ gitd/kept_credentials.py,sha256=n4Q_ZLMJYQpvVVatIL3s9fVPIM4KBvKptC0qIFhnfJY,3407
13
+ gitd/messages.py,sha256=Z3hkNU4bFxBa--NKJ2J6pGbaH0zL_iMHGOt7wdCJv5o,4842
14
+ gitd/methods.py,sha256=YozGLd6UjUSsJoqW3NDabZ5-CfRgeZf9n9dkEnvRTzQ,3187
15
+ gitd/models.py,sha256=f8KwN9SPR5MnBLpk3Kc2Dp7825mHx8jAG18IhnZmmBg,12602
16
+ gitd/publishing_calls.py,sha256=BZdWaK2AiXayLmd3ni6oLEYMom50UAqtUVwPoKPvH3w,2335
17
+ gitd/publishing_settings.py,sha256=reOSvmTgqyHr6JFZ5GzvwAXzKY-in5y6wGzGxLzR4lY,7802
18
+ gitd/timestamps.py,sha256=mroL2g5H6WN5gWxSCrtGG-xo5sznqsFrB5-LUYZ2xIY,717
19
+ gitd/warm_layers.py,sha256=4QtHp9AfkLiklW9cgNIpZFmq4sX1nHuM2pg1uUAkxVU,986
20
+ gitd_client-0.14.0.dist-info/METADATA,sha256=KbFNBpR67j9yZQ6a0a7HInbmQRdKEbWysFVyt8YhktU,4167
21
+ gitd_client-0.14.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
22
+ gitd_client-0.14.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any