A Domain-Specific Language (DSL) for designing experiments in psychology
pyFlies is a language tailored for designing of experiments in psychology. These kind of languages are often called Domain-Specific Languages - DSLs.
The aim of the language is to be highly readable and simple to learn and to focus on capturing the essence of the experiment while leaving the details to the compiler/code generator.
A code for various run-time platforms can be generated from the experiment description. Currently PsychoPy is fully supported and we plan to build generators for other targets.
- High-level. Easy to write and read. Experiments can be defined in minutes.
- From experiment description a source code for various platforms can be automatically generated.
- Declarative language. Specify
whatneeds to be done and leave
howpart to the pyFlies compiler.
- Integrates in VS Code, one of the most popular code editor today with a huge number of extensions for all sorts of file editing tasks.
- Written in Python programming language. Easy to extend. Generators are plugins which can be developed independently.
- Fully free and open source. GPL license. Hosted on github. Easy to contribute to. Contributions are welcomed!
Click on the image bellow to see a short (~3 min) overview video. For a longer introduction please see tutorial videos.
Install Python and check that it is available on the command line by running:
It is recommended to use Python virtual environments to isolate different set of Python libraries. Create virtual environment for pyFlies by running:
python -m venv pyflies-venv
This will create folder
pyflies-venv where your libraries will be installed.
You need to activate virtual environment before usage:
source pyflies-venv/bin/activate (for Linux and other POSIX systems) pyflies-venv\Scripts\activate.bat (for Windows)
Now, you can install pyFlies and generator for PsychoPy with:
pip install pyflies-psychopy
To verify that pyFlies is installed you can run:
You can see in the output that the generator pyflies -> psychopy is available.
pyFlies specifications are pure text and can be edited by any textual editor but for a good experience (especially with tables) it is recommended that pyFlies extension for VS Code is used.
Install VS Code either for you OS package manager or by going to VS Code
download page and downloading package
for your operating system. In the list of extensions find pyFlies and click on
In order to run your experiments you need to install software for the target platform you want to generate code for (currently PsychoPy only).
You can watch the process of installation in this video. In the video we are using Linux but most of the information is valid for other OSes.
The best way to start with pyFlies is by watching some of our video tutorials.
Besides language improvement which we are constantly work on, there are two bigger features that will greatly improve overall user experience in working in the pyFlies editor:
- Running generators from the context menu in VS Code and getting feedback and errors.
- "Smart" code-completion and code navigation. Currently, we provide only code
snippets which can help a lot but implementing Language Server
Protocol for pyFlies
we can get much better editing experience. For example, when you type
exec ->editor can offer just the components, or when you are inside the component parameters editor can offer just the parameters for that component (without those that are already specified) with explanation extracted from the component description in the tooltip. Furthermore, navigation will enable to click on a variable and jump to its definition.
Discuss, ask questions
For all questions, ideas, feature requests and bug report please use the GitHub issue tracker.
Screenshots (click for a popup)
Experiment is created and modified in a convenient to use editor.
From an experiment specification a full log of the experiment flow is generated which can be used to investigate and debug the experiment.
Generated PsychoPy code
From an experiment specification Python code for PsychoPy is generated which is used to run the experiment.
pyFlies icon is based on an icon licensed by CC BY 3.0 from Icon Fonts.