Python SDK for reserving and querying Git Dibs commits
Project description
git-dibs-sdk
If you're reading this, you're already in too deep. Yes, I really made a python sdk for the useless utility that is "Git Dibs". It actually works.
Install
python -m pip install git-dibs-sdk
Quick Start
from git_dibs_sdk import DibsAlreadyCalledError, GitDibsClient
client = GitDibsClient()
dibs = client.lookup_commit("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
if dibs is None:
print("commit is available")
else:
print(dibs.reserved_by, dibs.upvote_count)
try:
created = client.reserve_commit(
commit_hash="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
reserved_by="bb",
)
print(created.hash)
except DibsAlreadyCalledError as error:
print(error)
Client Surface
from git_dibs_sdk import GitDibsClient
client = GitDibsClient(
base_url="https://gitdibs.com",
timeout=10.0,
)
Available methods:
lookup_commit(commit_hash) -> Dibs | Nonereserve_commit(commit_hash, reserved_by) -> Dibslist_recent_reservations() -> list[Dibs]list_popular_reservations() -> list[Dibs]search_reservations(query=None, after=None, limit=None) -> DibsSearchResultupvote_commit(commit_hash, voter_fingerprint) -> UpvoteResult
Dibs fields:
hashreserved_at_utcreserved_byupvote_count
DibsSearchResult fields:
dibsqueryafterlimithas_morenext_after
UpvoteResult fields:
appliedupvote_count
Error Handling
All transport, HTTP, and response-shape failures are raised as GitDibsError subclasses.
DibsAlreadyCalledError: the commit is already reservedGitDibsHttpError: a non-success HTTP response came back from the API
Example:
from git_dibs_sdk import DibsAlreadyCalledError, GitDibsError, GitDibsClient
client = GitDibsClient()
try:
client.reserve_commit(
"cccccccccccccccccccccccccccccccccccccccc",
"TestUser2",
)
except DibsAlreadyCalledError as error:
print(error.commit_hash, error.reserved_by)
except GitDibsError as error:
print(f"request failed: {error}")
API Notes
This SDK matches the current Git Dibs API contract:
GET /api/commits/<commit>GET /api/dibs/recentGET /api/dibs/popularGET /api/dibs/search?q=<optional-prefix>&after=<optional-full-commit>&limit=<optional-1-to-50>POST /api/dibsPOST /api/upvotes
Lookup returns 204 No Content when a commit is available and 200 OK with a dibs payload when it is reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_dibs_sdk-0.1.0.tar.gz.
File metadata
- Download URL: git_dibs_sdk-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62fdb83a2bcfb18a701a07df46dd851cae8272288510f2f1dba04cf66a8e21c6
|
|
| MD5 |
22d618a18562944f776d8d86739ae684
|
|
| BLAKE2b-256 |
561a6b8b8ad97ca225ddc1881838ee5c6c14a752a46e478c7f504aacda740ddf
|
Provenance
The following attestation bundles were made for git_dibs_sdk-0.1.0.tar.gz:
Publisher:
publish.yml on gieseanw/git-dibs-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_dibs_sdk-0.1.0.tar.gz -
Subject digest:
62fdb83a2bcfb18a701a07df46dd851cae8272288510f2f1dba04cf66a8e21c6 - Sigstore transparency entry: 1193446184
- Sigstore integration time:
-
Permalink:
gieseanw/git-dibs-sdk@3b5894fa35641efd251ff028a74a87113c1c5353 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/gieseanw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3b5894fa35641efd251ff028a74a87113c1c5353 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file git_dibs_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: git_dibs_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17eecddab801259aadd9502f6f8df7693a0c392422419d63e5fb101584bdeb67
|
|
| MD5 |
39d945dd19e47d11b22b154bad8d7410
|
|
| BLAKE2b-256 |
c1787d4cb5e2a373a0165aa9f7de11306c9fb9555b1a88e6e2fecc6bf80cdaf6
|
Provenance
The following attestation bundles were made for git_dibs_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on gieseanw/git-dibs-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_dibs_sdk-0.1.0-py3-none-any.whl -
Subject digest:
17eecddab801259aadd9502f6f8df7693a0c392422419d63e5fb101584bdeb67 - Sigstore transparency entry: 1193446216
- Sigstore integration time:
-
Permalink:
gieseanw/git-dibs-sdk@3b5894fa35641efd251ff028a74a87113c1c5353 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/gieseanw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3b5894fa35641efd251ff028a74a87113c1c5353 -
Trigger Event:
workflow_dispatch
-
Statement type: