Quickstart: Python
Build a working study in Python in a few minutes. For the full API, see the Python SDK reference.
- Install psycloudpy
# From the PsyCloud monorepo (not yet on PyPI) pip install -e packages/psycloudpy - Write a study
Save this as
stroop.py. It builds a minimal Stroop task — two factors, a fixation, and a keypress response — and writes a runnable bundle.stroop.py from psycloudpy import experiment, text, keypress, pc_bundle_write from psycloudpy.expr import col bundle = ( experiment(id="hello.stroop", name="Hello Stroop") .phase("main", label="Trials") .factors(word=["red", "blue"], ink=["red", "blue"]) .cross() .shuffle() .screen("trial") .present(text("+"), 250) .ask(text(col.word, fill=col.ink, font_size=72), keypress(keys=["r", "b"])) .bind_self("word", "ink") .bundle(with_auto_ids=True) ) pc_bundle_write(bundle, "stroop_bundle", overwrite=True) - Generate the bundle
python stroop.pyThis writes a
stroop_bundle/directory containing the bundle artifacts. - Run or edit it
Compile or serve the bundle with the CLI, or open it in Studio via New Study → Import bundle to keep editing visually.
psycloud validate ./stroop_bundle psycloud compile ./stroop_bundle --out ./dist/bundle.json
Dynamic values
col.word and col.ink bind each trial's values into the screen. The
expression DSL covers conditionals, derived columns, and response-based logic.