Skip to main content

Python SDK for calling dibs, and checking for dibs, on git commit hashes

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

pip install -i https://pypi.org/simple/ git-dibs-sdk

Quick Start

from git_dibs_sdk import DibsAlreadyCalledError, GitDibsClient

client = GitDibsClient()

dibs = client.get_dibs("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
if dibs is None:
    print("commit is available")
else:
    print(dibs.reserved_by, dibs.upvote_count)

try:
    created = client.call_dibs(
        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:

  • get_dibs(commit_hash) -> Dibs | None
  • call_dibs(commit_hash, reserved_by) -> Dibs
  • list_recent_dibs() -> list[Dibs]
  • list_popular_dibs() -> list[Dibs]
  • search_dibs(query=None, after=None, limit=None) -> DibsSearchResult
  • upvote_commit(commit_hash, voter_fingerprint) -> UpvoteResult

Dibs fields:

  • hash
  • reserved_at_utc
  • reserved_by
  • upvote_count

DibsSearchResult fields:

  • dibs
  • query
  • after
  • limit
  • has_more
  • next_after

UpvoteResult fields:

  • applied
  • upvote_count

Error Handling

All transport, HTTP, and response-shape failures are raised as GitDibsError subclasses.

  • DibsAlreadyCalledError: the commit is already reserved
  • GitDibsHttpError: a non-success HTTP response came back from the API

Example:

from git_dibs_sdk import DibsAlreadyCalledError, GitDibsError, GitDibsClient

client = GitDibsClient()

try:
    client.call_dibs(
        "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/dibs/<commit>
  • GET /api/dibs/recent
  • GET /api/dibs/popular
  • GET /api/dibs/search?q=<optional-prefix>&after=<optional-full-commit>&limit=<optional-1-to-50>
  • POST /api/dibs
  • POST /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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_dibs_sdk-0.1.3.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_dibs_sdk-0.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file git_dibs_sdk-0.1.3.tar.gz.

File metadata

  • Download URL: git_dibs_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for git_dibs_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4a12f577ba63fe8e24c51fe5f227d8dd6e8bfd1a7c7874dafaef4fcf58807782
MD5 dea653cacc16976b19064f5d078aee16
BLAKE2b-256 34a6055d6fe3a28892b67e1590eb6fc7b428931571944f5a9a55252454e8362b

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_dibs_sdk-0.1.3.tar.gz:

Publisher: publish.yml on gieseanw/git-dibs-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file git_dibs_sdk-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: git_dibs_sdk-0.1.3-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

Hashes for git_dibs_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0c436aa2950520bcfce534908a866fb2f78a808a6c8afcf95dd75e077a4078a2
MD5 66aa1de77d7feb1570e73169d1d2e932
BLAKE2b-256 dedc0211ba176a04cb044f66ef963dc4bf755b232877868ff8340c0d585045bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_dibs_sdk-0.1.3-py3-none-any.whl:

Publisher: publish.yml on gieseanw/git-dibs-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page