grad300-client
Small Python package to access the GRAD300 backend API.
Install
From PyPI (once published):
pip install grad300-client
From this repository:
pip install ./clients/grad300-client
Build and Publish (uv)
This project uses uv workspace tooling, so you do not need to add build or twine as package dev dependencies.
Build artifacts for this package:
uv build --package grad300-client -o clients/grad300-client/dist
Publish to TestPyPI first:
export UV_PUBLISH_TOKEN="pypi-..."
uv publish \
--publish-url https://test.pypi.org/legacy/ \
--check-url https://test.pypi.org/simple/ \
clients/grad300-client/dist/*
Publish to PyPI:
export UV_PUBLISH_TOKEN="pypi-..."
uv publish --check-url https://pypi.org/simple/ clients/grad300-client/dist/*
Local Compatibility Tests (tox)
Run the client test suite across Python 3.9 to 3.13:
cd clients/grad300-client
python -m pip install tox
tox
If some interpreters are not installed locally, tox will skip them.
GitLab CI Publishing (tags)
The repository CI can publish automatically to PyPI when a tag is pushed.
- Tag format:
v0.2(also supports patch tags likev0.2.1). - The package version is derived from Git tags via
hatch-vcs, so there is no manual version update inpyproject.tomlfor releases. - Configure
UV_PUBLISH_TOKENas a protected GitLab CI variable (PyPI token).
Quick start
from datetime import datetime
from grad300_client import Grad300
client = Grad300(user="student@example.com", password="your-password")
# Simple source query (astroquery-like helper)
tpi_scans = client.query_source("sun", scan_type="TPI")
print(tpi_scans["id", "scan_type", "file_name", "source", "date"])
# Query by scan filename fragment
named_scans = client.query_scan_name("2025062")
# Query by date range
march_scans = client.query_date_range(
date_from=datetime(2026, 3, 1),
date_to=datetime(2026, 3, 31, 23, 59, 59),
)
# Download one scan from a table row
if len(tpi_scans) > 0:
# In-memory return (no destination_dir):
# - TPI -> astropy.table.Table
tpi_data = client.download(tpi_scans[0])
# Save to file when destination_dir is provided
local_path = client.download(tpi_scans[0], destination_dir="./downloads")
print(local_path)
# Non-TPI in-memory return is an astropy.io.fits.HDUList
image_hdul = client.download_by_id(scan_type="Images", scan_id=30)
image_hdul.close()
client.close()
Configuration (astropy.config)
grad300-client exposes a global conf object (Astropy-style) for defaults.
from grad300_client import Grad300, conf
with (
conf.set_temp("base_url", "https://staging.grad300.lam.fr"),
conf.set_temp("api_prefix", "/api/v1"),
conf.set_temp("timeout", 60.0),
conf.set_temp("default_page_size", 200),
):
client = Grad300(user="student@example.com", password="your-password")
scans = client.query_source("sun", scan_type="TPI")
client.close()
Constructor arguments still override config defaults.
Notes
- The package wraps existing routes under
/api/v1. list,query_source,query_scan_name, andquery_date_rangereturnastropy.table.Table.- Use
list_recordsandquery_recordsif you prefer typed Python objects (ScanRecord). - You can authenticate either with
token=...or withuser=...andpassword=...in the constructor. download,download_by_id, anddownload_by_scan_namefetch FITS data from scan download endpoints.- If
destination_diris omitted: TPI returns anastropy.table.Table, other scan types return anastropy.io.fits.HDUList. - If
destination_diris provided, the FITS file is saved and the returned value is the localPath.
License
This package is distributed under the MIT License. See LICENSE.
Metadata
Release files for grad300-client 0.1.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 |
|---|---|---|---|---|
| grad300_client-0.1.1.tar.gz | 11.5 kB | Without provenance | Details for grad300_client-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| grad300_client-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for grad300_client-0.1.1-py3-none-any.whl |
Total release size: 24.4 kB
Release files / grad300_client-0.1.1.tar.gz
| Download URL | grad300_client-0.1.1.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ea68820e08999797c9e7daa7f3e4337c5bb65e3bd435a8fb29f06fdfb848067
|
|
BLAKE2b-256 checksum How to use checksums |
de40eedfe5469b1e306c6059074704e0a4ef25d944780a416b45122a54735eee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / grad300_client-0.1.1-py3-none-any.whl
| Download URL | grad300_client-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06e73f0fd325b1b88197a0dce617a670257825c2c2105ae7a7a688a7dc4909ca
|
|
BLAKE2b-256 checksum How to use checksums |
45618dfd28006e9ad6110b7487c24099aee9151dd1cee0bcb4bf09bbe3c38cc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for grad300-client 0.1.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.