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 pip
Activate the environment:
conda activate unstructured-bargaining-experiment
conda (local)
Create the environment
conda create --prefix=venv -y python pip
Activate the environment:
conda activate ./venv
venv
Create the environment
python3 -m venv ./venv
Activate the environment:
source venv/bin/activate # Linux/Mac
venv/Script/activate # Windows
Then install the requirements in this isolated environment.
We have to use pip
as oTree
is not on conda-forge yet.
pip install -r requirements.txt
Open a terminal in the project folder and run
otree devserver
Then 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 test
for playing the experiment with automated botspyright
for Python type checkingruff check
for Python code styleruff format
for Python code formattingcodespell
for spell checking
You can also run these checks locally.
- You can execute the
otree
test runningotree test
- For
pyright
, you need to have thepyright
package installed. ruff
andcodespell
are implemented aspre-commit
hooks.
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.log
For the rest, install pyright
and pre-commit
, e.g. using pipx
:
pipx install pyright
pipx install pre-commit
Then, you can install the pre-commit
hooks by running
pre-commit install
This will install the hooks and run them on every commit automatically.
Finally, you can run the pyright
checks using
pyright
Please make sure that all checks pass before merging to the main branch.