-
Notifications
You must be signed in to change notification settings - Fork 0
whats_new_alfred3
Quite a lot actually. Let's dive in!
- In each script.py, you define the
expName
,expVersion
andexpType
(now calledEXP_NAME
,EXP_VERSION
andEXP_TYPE
, see below). In Alfred 3, we added thte fieldEXP_AUTHOR_MAIL
, which is meant to contain the email address of the experiment author. If you do not set this constant, Alfred will throw an error.
Why did we do this?
- This change is most meaningful if you work with Mortimer to host and manage your experiments: You will only be able to download your experimental data via mortimer, if the
EXP_AUTHOR_MAIL
is identical to the email address that belongs to your mortimer account. This way, we can make sure that only you can access your experimental data. - This change also means, that experiment titles now only need to be unique for each author. Up until now, all experiment titles had to be unique.
This is a major change. Python 2.7 will retire on January 1, 2020, so we made the change to the future in time. Your Alfred code will now follow the state of the art of Python. Let's take a closer look at what the upgrade to Python 3 means.
-
All strings in Python 3 are unicode by default. In Python 2.7, strings with umlauts like ä, ö or ü needed to be preceded by a u to turn them into unicode-strings:
u"Example strüng."
. Otherwise, the code would not work. This often lead to unnecessary errors and is not necessary anymore. -
Printing works a little differently. You used to be able to print output to the console with a command like
print "this string"
. This syntax is now deprecated and will throw errors. From now on, you need to use the print statement like any normal function:print("this string")
. -
Integer division works differently. In Python 2.7, if you divided one integer by another, Python would execute modulo division:
3 / 2 = 1
. In Python 3, normal integer division will work as expected:3 / 2 = 1.5
. For modulo division, you can use a double slash:3 // 2 = 1
. -
A more detailed overview can be found here: https://docs.python.org/3.0/whatsnew/3.0.html
Don't worry about having to change all your existing code to be compatible with Python 3.7. We prepared a script for you that automatically updates your old script.py.
We completed a major overhaul of our naming system in order to follow the most recent PEP (Python Enhancement Proposal) guidelines and make some important terms more clear (Don't worry about having to change all your existing code. We prepared a script for you that automatically updates your old script.py). The most important changes are these:
-
Question
becomesPage
. In general, we changed all occurences ofQuestion
toPage
, because that is a better reflection of how an alfred experiment is structured: A single page can contain multiple elements, which might also be regarded as questions. -
QuestionGroup
/QG
becomesSection
. Parallel to the change fromQuestion
toPage
, we changedQuestionGroup
andQG
toSection
. We think this is a more concise label for the structure of Alfred Experiments. -
lowerCamelCase
becomesunderscore_case
. The remaining changes reflect our effort to adhere to the Python Enhancement Proposal (PEP - click for more info) by switching fromlowerCamelCase
(starting a new word in function or variable names with a capital letter) tounderscore_case
(separating words in function or variable names with an underscore). ATTENTION: This change affects almost every function call! - The experiment metadata variables
expName
,expVersion
andexpType
are now writtten asEXP_NAME
,EXP_VERSION
andEXP_TYPE
in order to reflect their importance and their status as constants.
An overview of all changed names can be found here: Overview of all changed names
In web experiments, subjects used to be able to cause trouble by using the browser controls (forward, backward, refresh) instead of the experiment controls at the bottom of the page to move through an experiment. In some cases, this could render the subject's data unusable. Now, when a subject uses the browser controls, Alfred will always return the current state of the experiment. This way, no more data should be lost.
When quickly moving through an experiment, the saving agent sometimes didn't complete it's tasks correctly and basically crashed. This does not happen anymore.
We implemented a three-step process to access database login data:
- Provide encrypted login data in environment variables
- Provide encrypted login data in config.conf
- Provide raw login data in config.conf (not recommended, use only for testing)
The first two options make it much safer to share your code, e.g. on the OSF, because you don't have to worry about accidentally sharing secrets anymore.
If your databse is correctly equipped with a valid commercial SSL certificate, you can now simply set the option use_ssl = true
in the config.conf
to enable a secure connection via SSL.
You can also use self-signed SSL certificates, if you set the option ca_file_path
to the file path of your Certificate Authority (CA) public key file (often a .pem file).
We completely removed pure QT experiments from the framework. Those have recently seen very little use and have some drawbacks compared to web experiments and qt-webkit (qt-wk) experiments.
If you have trouble getting your code to work, you can contact our support via [email protected]. Please make sure to test your code diligently before asking for help.