feat(packages): python client (openchainbench) for PyPI#745
Merged
Conversation
Wraps /api/citable, /api/stat/<slug>, /api/series/<slug> as a typed synchronous client with frozen dataclass models and a small exception hierarchy (NotFound, RateLimit, APIUnavailable). Ships: - src layout under packages/python-client/, hatchling backend - httpx-based OpenChainBench client, list/get/series methods - 15 tests: 12 mocked, 3 live integration (skip via OCB_SKIP_INTEGRATION=1) - .github/workflows/python-client-ci.yml for PR tests on 3.10 to 3.13 - .github/workflows/pypi-publish.yml triggered on python-v* tags, publishes via PyPI Trusted Publisher (OIDC, no token in repo) - PUBLISHING.md with the one-time PyPI Trusted Publisher setup steps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Python client package under packages/python-client/ that wraps the
public OpenChainBench API: /api/citable, /api/stat/, /api/series/.
Why
Distribution channel for the citable API. Python devs and AI agents expect
pip install openchainbench rather than DIY HTTP. Bonus: pypi.org/project/openchainbench
sidebar surfaces 4 to 5 dofollow project links to openchainbench.com (Homepage,
Documentation, Repository, Issues, Changelog).
Shape
hierarchy (NotFoundError, RateLimitError, APIUnavailableError) so callers
branch on intent not HTTP status.
of payload polymorphism (source can be str or object, methodology can be
str or list).
(skip with OCB_SKIP_INTEGRATION=1 for offline CI).
builds sdist + wheel on every PR touching the package.
Publish flow
PyPI Trusted Publisher (OIDC, no token stored in the repo).
trigger a Python release.
One-time setup required from the user before first release
Documented in packages/python-client/PUBLISHING.md. TL;DR:
Test plan