benchclients
A simple, low-dependency Python library with clients for calling the Conbench API and potentially other APIs in the Conbench ecosystem
Installation
The benchclients package can be installed from PyPI with
pip install benchclients
or direct from GitHub with
pip install benchclients@git+https://github.com/conbench/conbench.git@main#subdirectory=benchclients/python
or with your preferred environment management system. Package code should rarely change, and the number of dependencies should remain very minimal.
Components
The package is structured such that all users should need is client classes that it
exposes. As of writing, there is only one such useful class: benchclients.ConbenchClient.
However, clients for other APIs can easily be created by inheriting from the
benchclients.BaseAdapter class, which defines core methods for making HTTP requests
(e.g. .get(), .post(), etc.) set up to handle retries and logging and so on.
ConbenchClient
Environment variables
Configuration and credentials for ConbenchClient can be handled by three environment
variables set before class instantiation:
CONBENCH_URL: The URL of the Conbench server. Required.CONBENCH_EMAIL: The email to use for Conbench login. Only required for GETting if the server is private.CONBENCH_PASSWORD: The password to use for Conbench login. Only required for GETting if the server is private.
Alternatively, you can instantiate the client with the url, email, and password keyword arguments - like:
conbench = ConbenchClient(url="https://conbench.ursa.dev",
email="test@example.com",
password="xxxxxx"
)
Usage
If environment variables are set before instantiation, or the keyword arguments are used, ConbenchClient will handle
auth, so users can get right to making requests:
import logging
import os
from benchclients import ConbenchClient, log
os.environ["CONBENCH_URL"] = "https://conbench.ursa.dev"
log.setLevel(logging.DEBUG)
conbench = ConbenchClient()
benchmark_result_id = "4e0e569d82724667b3e929dedb730edc"
res = conbench.get(f"/benchmarks/{benchmark_result_id}")
#> DEBUG [2023-02-10 12:56:48,492] GET https://conbench.ursa.dev/api/benchmarks/4e0e569d82724667b3e929dedb730edc
res
#> {'batch_id': '746e76a30fbf4bb0bf91bde369b76f3a-1n',
#> 'change_annotations': {},
#> 'error': None,
#> 'id': '4e0e569d82724667b3e929dedb730edc',
#> 'links': {'context': 'http://conbench.ursa.dev/api/contexts/105b127c7f624a6d908d4ec65e018fea/',
#> 'info': 'http://conbench.ursa.dev/api/info/4d8cb198342f455e90cd84e2e8356f2a/',
#> 'list': 'http://conbench.ursa.dev/api/benchmarks/',
#> 'run': 'http://conbench.ursa.dev/api/runs/746e76a30fbf4bb0bf91bde369b76f3a/',
#> 'self': 'http://conbench.ursa.dev/api/benchmarks/4e0e569d82724667b3e929dedb730edc/'},
#> 'optional_benchmark_info': {},
#> 'run_id': '746e76a30fbf4bb0bf91bde369b76f3a',
#> 'stats': {'data': [0.693055, 0.69691, 0.702238],
#> 'iqr': 0.004591,
#> 'iterations': 3,
#> 'max': 0.702238,
#> 'mean': 0.697401,
#> 'median': 0.69691,
#> 'min': 0.693055,
#> 'q1': 0.694982,
#> 'q3': 0.699574,
#> 'stdev': 0.004611,
#> 'time_unit': 's',
#> 'times': [],
#> 'unit': 's',
#> 'z_improvement': False,
#> 'z_regression': True,
#> 'z_score': -14.600706547691335},
#> 'tags': {'cpu_count': None,
#> 'engine': 'arrow',
#> 'format': 'native',
#> 'id': '4193bedfc281454f87f6e045019fedfa',
#> 'language': 'R',
#> 'memory_map': False,
#> 'name': 'tpch',
#> 'query_id': 'TPCH-13',
#> 'scale_factor': 1},
#> 'timestamp': '2023-02-10T09:17:18Z',
#> 'validation': None}
Metadata
Release files for benchclients 2024.3.29.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| benchclients-2024.3.29.1.tar.gz | 13.7 kB | Without provenance | Details for benchclients-2024.3.29.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| benchclients-2024.3.29.1-py3-none-any.whl | Python 3 | none | any | Details for benchclients-2024.3.29.1-py3-none-any.whl |
Total release size: 26.1 kB
Release files / benchclients-2024.3.29.1.tar.gz
| Download URL | benchclients-2024.3.29.1.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57c298af8df4e4a01662c80a76226c123225921d25948196b65fe100ee3c9d67
|
|
BLAKE2b-256 checksum How to use checksums |
ca329f5192140604301a48e25c940e25c5f89b1d9d99a4b54dbd9d0ce48fa118
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / benchclients-2024.3.29.1-py3-none-any.whl
| Download URL | benchclients-2024.3.29.1-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7f5fb2e4f25c46a39659af5548519484eeea6d45ac9cf171d6d7a8ef8adcbe4
|
|
BLAKE2b-256 checksum How to use checksums |
05982930cc74cd3a64bbf2ee5f75e7fdc5711dead2f0ece5c1ce5ddf7cd30b81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for benchclients 2024.3.29.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.