Python SDK for the HyperStudy experiment platform API
Project description
hyperstudy
Python SDK for the HyperStudy experiment platform API. Designed for researchers working in Jupyter, marimo, or Python scripts.
Installation
pip install hyperstudy
For polars support:
pip install hyperstudy[polars]
Quick Start
import hyperstudy
hs = hyperstudy.HyperStudy(api_key="hst_live_...")
# Or set the HYPERSTUDY_API_KEY environment variable
# Fetch events as a pandas DataFrame
events = hs.get_events("your_experiment_id")
# Room-scoped data
events = hs.get_events("room_id", scope="room")
# Participant-scoped data
events = hs.get_events("participant_id", scope="participant", room_id="room_id")
Data Types
All data retrieval methods follow the same pattern:
events = hs.get_events("exp_id")
recordings = hs.get_recordings("exp_id")
chat = hs.get_chat("exp_id")
videochat = hs.get_videochat("exp_id")
sync = hs.get_sync("exp_id")
ratings = hs.get_ratings("exp_id", kind="continuous")
components = hs.get_components("exp_id")
participants = hs.get_participants("exp_id")
rooms = hs.get_rooms("exp_id")
# Convenience methods for common event categories
questionnaire = hs.get_questionnaire("exp_id")
instructions = hs.get_instructions("exp_id")
consent = hs.get_consent("exp_id")
Output Formats
df_pandas = hs.get_events("exp_id") # pandas (default)
df_polars = hs.get_events("exp_id", output="polars") # polars
raw = hs.get_events("exp_id", output="dict") # list[dict]
Filtering
events = hs.get_events(
"exp_id",
start_time="2024-01-01T10:00:00Z",
end_time="2024-01-01T12:00:00Z",
category="component",
sort="onset",
limit=100,
)
Auto-Pagination
When limit is not set, all pages are fetched automatically with a progress bar:
all_events = hs.get_events("exp_id") # fetches all pages
Experiment Management
# List experiments
experiments = hs.list_experiments()
# Get details (with rich display in notebooks)
exp = hs.get_experiment("exp_id")
# Create / update / delete
new_exp = hs.create_experiment(name="My Study", description="...")
hs.update_experiment("exp_id", name="Updated Name")
hs.delete_experiment("exp_id")
Deployments
# List deployments
deployments = hs.list_deployments()
deployments = hs.list_deployments(experiment_id="exp_id", status="active")
# Get deployment details
dep = hs.get_deployment("deployment_id")
# List sessions/rooms for a deployment
sessions = hs.get_deployment_sessions("deployment_id")
All Data for a Participant
data = hs.get_all_data("participant_id", room_id="room_id")
# Returns dict with keys: events, recordings, chat, videochat, sync,
# ratings_continuous, ratings_sparse, components, questionnaire,
# instructions, consent
API Key
Generate an API key from the HyperStudy dashboard under Settings. Keys follow the format hst_{environment}_{key} and are passed via the X-API-Key header.
Documentation
Full documentation: docs.hyperstudy.io/developers/python-sdk
Development
git clone https://github.com/hyperstudyio/hyperstudy-pythonsdk.git
cd hyperstudy-pythonsdk
pip install -e ".[dev,polars]"
pytest --cov=hyperstudy
ruff check src/
License
MIT
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
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 hyperstudy-0.2.3.tar.gz.
File metadata
- Download URL: hyperstudy-0.2.3.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e61e0667938ef1db45ef72ad32f41a01a8e4841173991de6d7473031530c2ac3
|
|
| MD5 |
71f85addff5ebf86666fe28059f39ece
|
|
| BLAKE2b-256 |
98fd57ff85df044a39f4ecd826c4109fe62c0e4df76a5cd7935df49f33ea7fee
|
Provenance
The following attestation bundles were made for hyperstudy-0.2.3.tar.gz:
Publisher:
publish.yml on hyperstudyio/hyperstudy-pythonsdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperstudy-0.2.3.tar.gz -
Subject digest:
e61e0667938ef1db45ef72ad32f41a01a8e4841173991de6d7473031530c2ac3 - Sigstore transparency entry: 1310615454
- Sigstore integration time:
-
Permalink:
hyperstudyio/hyperstudy-pythonsdk@49a4d009dbd19bb830434d229f810109533dd353 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/hyperstudyio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@49a4d009dbd19bb830434d229f810109533dd353 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperstudy-0.2.3-py3-none-any.whl.
File metadata
- Download URL: hyperstudy-0.2.3-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
600193c4b0ff6df859487bd52f696eab9b14ef9ac872e8b8a5ed5b8962b2ca58
|
|
| MD5 |
38215f8b0dd9916514575dce2b5aedcf
|
|
| BLAKE2b-256 |
40d1cfe54e75ff311da5418322d7f9dedc6e8d51785198a1770da9b927d36be2
|
Provenance
The following attestation bundles were made for hyperstudy-0.2.3-py3-none-any.whl:
Publisher:
publish.yml on hyperstudyio/hyperstudy-pythonsdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperstudy-0.2.3-py3-none-any.whl -
Subject digest:
600193c4b0ff6df859487bd52f696eab9b14ef9ac872e8b8a5ed5b8962b2ca58 - Sigstore transparency entry: 1310615606
- Sigstore integration time:
-
Permalink:
hyperstudyio/hyperstudy-pythonsdk@49a4d009dbd19bb830434d229f810109533dd353 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/hyperstudyio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@49a4d009dbd19bb830434d229f810109533dd353 -
Trigger Event:
release
-
Statement type: