An otree experiment for testing unstructured bargaining in a specific context.
It is recommended to use a virtual environment for the project (either through conda or venv):
conda (standard)
Create the environment
conda create --name unstructured-bargaining-experiment -y python pipActivate the environment:
conda activate unstructured-bargaining-experimentconda (local)
Create the environment
conda create --prefix=venv -y python pipActivate the environment:
conda activate ./venvvenv
Create the environment
python3 -m venv ./venvActivate the environment:
source venv/bin/activate # Linux/Mac
venv/Script/activate # WindowsThen install the requirements in this isolated environment.
We have to use pip as oTree is not on conda-forge yet.
pip install -r requirements.txtOpen a terminal in the project folder and run
otree devserverThen navigate to http://localhost:8000 in your browser. You can stop the server by pressing Ctrl+c in your terminal window.
The Procfile is set up to start a production server on Heroku. Simply create an app, assign a dyno and a Postgres database, and deploy the app from this repo.
The project is set up with GitHub Actions to run automated checks on every push and pull request to the main branch. The checks include:
otree testfor playing the experiment with automated botspyrightfor Python type checkingruff checkfor Python code styleruff formatfor Python code formattingcodespellfor spell checking
You can also run these checks locally.
- You can execute the
otreetest runningotree test - For
pyright, you need to have thepyrightpackage installed. ruffandcodespellare implemented aspre-commithooks.
Running the checks locally
You can run the oTree test and get nice output with the following one-liner:otree test 2> /tmp/stderr.log || cat /tmp/stderr.log; rm /tmp/stderr.logFor the rest, install pyright and pre-commit, e.g. using pipx:
pipx install pyright
pipx install pre-commitThen, you can install the pre-commit hooks by running
pre-commit installThis will install the hooks and run them on every commit automatically.
Finally, you can run the pyright checks using
pyrightPlease make sure that all checks pass before merging to the main branch.