Skip to main content

A declarative language in python for creating jsPsych experiments

Project description

PyPI GitHub Workflow Status PyPI - Downloads Link to docs License: MIT DOI

SweetBean

A declarative programming language built in Python, designed for the synthesis of behavioral experiments. It allows researchers to specify experiments once and seamlessly compile them into a jsPsych experiment for conducting studies with human participants or text-based simulations with synthetic participants using large-language models.

Features

  • Declarative language: Specify experiments once and compile them into a jsPsych experiment for conducting studies with human participants or text-based simulations with synthetic participants using large-language models.
  • Python-based: SweetBean is built in Python, making it accessible and easy to use for researchers and educators.

Integrate with other packages

This package seamlessly integrates with other packages aimed at running online behavioral experiments:

  • AutoRA: For closed loop research, automatic experiment deployment, participant recruitment, and data collection.
  • SweetPea: For experimental design.

But it can also be used as a standalone product.

Installation

The package is available on PyPI and can be installed via pip:

pip install sweetbean

Compatibility

SweetBean is compatible with the following version of jsPsych:

  • jsPsych: 7.x

Dependencies

Sweetbean has the following dependencies that need to be installed on your system:

  • Python: >=3.9, <4.0
  • java

Other versions may work but are not officially supported. If you experience issues, please report them!

Python Dependencies

The following Python packages are required and will be installed automatically via pip:

  • jinja2
  • transcrypt
  • pyppeteer
  • pillow

jsPsych Plugins

SweetBean does not support all jsPsych plugins, but new plugins are added regularly.
If you need support for a specific jsPsych plugin, please open an issue here.

Documentation

You can find examples and documentation here: https://autoresearch.github.io/sweetbean/

Issues

Please report any issues with this software or its documentation here.

Contributing

We are open to contributions to SweetBean. More information can be found here.

Collaborating

We are always interested in collaborating! If you like our work but need some tailoring for your specific use case, please contact ystrittmatter@princeton.edu.

Citation

If you would like to reference SweetBean in a publication, you can use the following BibTeX entry referencing the associated publication in the Journal of Open Source Software:

@article{Strittmatter2025, doi = {10.21105/joss.07703},
author = {Younes Strittmatter and Sebastian Musslick},
title = {SweetBean: A declarative language for behavioral experiments with human and artificial participants},
url = {https://doi.org/10.21105/joss.07703}, 
year = {2025}, 
publisher = {The Open Journal}, 
volume = {10}, 
number = {107}, 
pages = {7703}, 
journal = {Journal of Open Source Software},
doi = {10.21105/joss.07703}
}

About

This project is in active development by the Autonomous Empirical Research Group, Lead Designer Younes Strittmatter, led by Sebastian Musslick.

This research program was supported by Schmidt Science Fellows, in partnership with the Rhodes Trust, as well as the Carney BRAINSTORM program at Brown University.

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

sweetbean-1.3.3.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

sweetbean-1.3.3-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file sweetbean-1.3.3.tar.gz.

File metadata

  • Download URL: sweetbean-1.3.3.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for sweetbean-1.3.3.tar.gz
Algorithm Hash digest
SHA256 7d64679c335d85458d713722780a7e83024060b5f69860bb7555065fe4a514b5
MD5 8b625067cf205d23fff4757cd79eb27d
BLAKE2b-256 578c5dcf724f0ad0bbcbaf32555563e999a8ca0aad2bfbbc247635a5f204452f

See more details on using hashes here.

File details

Details for the file sweetbean-1.3.3-py3-none-any.whl.

File metadata

  • Download URL: sweetbean-1.3.3-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for sweetbean-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b3ada4d7aa1af3663c638c6091432125c074eafcae3587e4461d4bb30b0d5b55
MD5 517ae2e5d2af25c97a62b0b5a0d56c57
BLAKE2b-256 efa1364d60d7e43e6d96c668cbe4f83a5997a8a245e399153027bd2de4fa4df4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page