Task-agnostic harness for PsychoPy experiments: screen/frame-timing setup, run manifests, CSV writers, setup-wizard primitives, instruction pager, and keyboard abstraction.
Project description
psyexp-core
Task-agnostic harness for PsychoPy experiments, shared across the lab's task
repos (heat-task, mid-task, mid-task-deterministic). It owns the plumbing
that every task duplicates; each task repo keeps only its own stimuli, trial
logic, and record schemas.
What's in here
| Module | Responsibility |
|---|---|
screen |
setup_screen() — open a fullscreen PsychoPy window, enable VSYNC, run a frame-timing calibration, and return a ScreenDiagnostics. |
diagnostics |
The ScreenDiagnostics dataclass (import-light; no PsychoPy). |
rundir |
make_run_dir(data_dir, label, session_time) — timestamped output directory. |
manifest |
write_manifest(...) + system_info() — JSON run manifest with system/display/process diagnostics and the resolved psyexp_core_version. App-specific fields are injected via header / study_params. |
recording |
CsvWriter base class (maps a dataclass record onto a fixed column schema). |
wizard |
questionary / prompt_toolkit setup-wizard primitives: shared styles, ask_text / ask_select / ask_confirm, PosFloatValidator, prompt_unique_name, quit_app. |
instructions |
page_through(...) — a self-paced, keypress-driven instruction pager. |
keyboard |
PTB / PsychoPy-event keyboard abstraction: build_keyboard / get_keys / wait_for_keys / clear_events, plus the timed-press API for response windows — get_presses (name + rt), reset_clock_on_flip / reset_clock / clock_time. |
Use from a task repo
Add it as a dependency. For day-to-day development, point at a local checkout so edits are live without reinstalling:
# your-task/pyproject.toml
dependencies = ["psyexp-core"]
[tool.uv.sources]
psyexp-core = { path = "../psyexp-core", editable = true }
For a reproducible release build, pin a tagged ref instead:
[tool.uv.sources]
psyexp-core = { git = "ssh://git@github.com/<you>/psyexp-core.git", tag = "v0.1.0" }
write_manifest records the resolved psyexp_core_version so each run is
traceable back to a core version.
Co-developing core while a task repo keeps the git pin
Lab task repos (e.g. heat-task) commit the git-tag source above so clones
reproduce exactly, then overlay a local editable install for development:
uv pip install -e ../psyexp-core
Gotcha: uv run re-syncs the task venv from its uv.lock on every launch,
which reverts that editable install straight back to the pinned tag (symptoms:
your local core edits silently don't take effect). Set UV_NO_SYNC=1 in the task
repo (export it in your shell, or use uv run --no-sync) so the editable overlay
sticks; run a manual uv sync only when you change other deps, then re-run the
editable install. See heat-task's README ("Co-developing psyexp-core locally")
for the full workflow.
Releasing
Tagging and publishing are deliberately separate, so tags stay cheap to iterate on:
- Bump + lock + changelog, then tag
vX.Y.Z. The tag runs the checks and creates a draft GitHub Release — it does not publish anything. - Review the draft Release and publish it. That triggers
publish.yml, which uploads to PyPI via Trusted Publishing (OIDC; no API token stored).
PyPI versions are immutable, so retagging never republishes; bump the version to ship new code. See docs/releasing.md for the full process, SemVer policy, pre-releases, retag semantics, and the one-time PyPI setup.
Project details
Release history Release notifications | RSS feed
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 psyexp_core-0.5.1.tar.gz.
File metadata
- Download URL: psyexp_core-0.5.1.tar.gz
- Upload date:
- Size: 297.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
274ae198aeb95365f002113424bcd2a571fdfd9b2c35044911a7d1b674a79a98
|
|
| MD5 |
c727c3e8573470155b2e35500139734b
|
|
| BLAKE2b-256 |
9762d1448ffcfd29872932932d587b4d4b69e9538968a5c3132ef168dc2b1f47
|
Provenance
The following attestation bundles were made for psyexp_core-0.5.1.tar.gz:
Publisher:
publish.yml on HAPNlab/psyexp-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psyexp_core-0.5.1.tar.gz -
Subject digest:
274ae198aeb95365f002113424bcd2a571fdfd9b2c35044911a7d1b674a79a98 - Sigstore transparency entry: 1931208792
- Sigstore integration time:
-
Permalink:
HAPNlab/psyexp-core@b3b4ad60f7ed6a81bafe3f29867349f34c64ee10 -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/HAPNlab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b3b4ad60f7ed6a81bafe3f29867349f34c64ee10 -
Trigger Event:
release
-
Statement type:
File details
Details for the file psyexp_core-0.5.1-py3-none-any.whl.
File metadata
- Download URL: psyexp_core-0.5.1-py3-none-any.whl
- Upload date:
- Size: 14.4 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 |
75522a4f7d5d64b56feff18135f18c6cd06bcede64cf88b6fb290919bcd76f3f
|
|
| MD5 |
7858f2b43001fce3b7f9434bf87f7234
|
|
| BLAKE2b-256 |
926754fd54354515afa28e4d8ea61ed1e046ed29cb6117f5a42da578fc0afe8a
|
Provenance
The following attestation bundles were made for psyexp_core-0.5.1-py3-none-any.whl:
Publisher:
publish.yml on HAPNlab/psyexp-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psyexp_core-0.5.1-py3-none-any.whl -
Subject digest:
75522a4f7d5d64b56feff18135f18c6cd06bcede64cf88b6fb290919bcd76f3f - Sigstore transparency entry: 1931209310
- Sigstore integration time:
-
Permalink:
HAPNlab/psyexp-core@b3b4ad60f7ed6a81bafe3f29867349f34c64ee10 -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/HAPNlab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b3b4ad60f7ed6a81bafe3f29867349f34c64ee10 -
Trigger Event:
release
-
Statement type: