Integration with OpenScienceFramework

34 views
Skip to first unread message

Jonathan Peirce

unread,
Mar 30, 2016, 6:51:31 AM3/30/16
to PsychoPy Developers
Hi folks,

A while ago we were approached by Open Science Framework about adding
support for uploading files directly to their website for sharing. The
first version of that is now implemented and available in PsychoPy repos
for you to play with.

I've written this in two steps:
- pyosf is a pure python lib (https://github.com/psychopy/pyosf)
supporting the sync and communication protocols
install it with `pip install pyosf`
- PsychoPy now has a Projects menu (only appears when pyosf is
installed)
- log in with your OSF username/password (an auth token is
stored for future)
- search for projects
- perform two-way sync with projects for which you have
write-access

Obviously this is early days - quite a few things will need smoothing
out - but I thought I'd let you know it's there to try. Let me know if
you run into problems. One thing I haven't provided yet is the means to
*create* an OSF project within PsychoPy (for now you have to go online
to create the project but then you can use PsychoPy to find it and
merge/upload the files). I also want us to be able to *fork* projects
from others. Again, that's possible from the website but not currently
from within PsychoPy (actually that one isn't yet possible to implement
- they need to add some code to the OSF API for us to do it)

It would be great to see people uploading some completed studies that
you're willing to share (and using psychopy as a tag) so that others can
find them.

Feedback welcome, as always.

best wishes
Jon

PS for those that care about such things you'll be delighted to hear
that pyosf:
- is fully py2 and py3 compliant
- has 90% code coverage in its unit tests
- fully(?) PEP8 compliant (according to Spyder editor)

--
Jon Peirce
http://www.peirce.org.uk





This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it.

Please do not use, copy or disclose the information contained in this
message or in any attachment. Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

Erik Kastman

unread,
Mar 31, 2016, 3:25:27 PM3/31/16
to psycho...@googlegroups.com
Jon, this is really cool. I’d love to help out if you’re brainstorming, especially the forking UX. Even github requires you to use the site to create projects; I don’t think that’s a requirement or downside at all but rather a familiar way or working for a lot of people.

I have a bunch of old git hooks that I used to write into all of my experiments (with the idea of preventing RAs from accidentally changing tasks mid-run without recording what they were doing); this might be a good time to revisit folding that into standard builder experiments?

I’ll go throw a few up and try it,
Erik
> --
> You received this message because you are subscribed to the Google Groups "psychopy-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-dev...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jeremy Gray

unread,
Mar 31, 2016, 3:36:31 PM3/31/16
to psycho...@googlegroups.com
Hear hear! Great stuff, Jon. 

For those who don't know, the OSF is a really cool organization, well worth checking out. https://osf.io/

--Jeremy

Jon Peirce

unread,
Apr 1, 2016, 1:22:48 PM4/1/16
to psycho...@googlegroups.com
The project creation should be totally possible - just needs
implementing. I think it will lower the bar for people to upload
projects so I'm keen to add it. Forking too (but that currently isn't
possible given the existing commands).

Sadly none of it links properly to git. All this is being done using
REST commands (altering a url to act like a command).
https://en.wikipedia.org/wiki/Representational_state_transfer
The sync has to up/download files one by one using these REST commands.
The logic of the sync (when a file needs to be added/updated/conflicts)
was something I had to work out from scratch.
https://github.com/psychopy/pyosf/blob/master/pyosf/sync.py

I think the graphical interface needs improving/simplifying. I'm
certainly thinking that I shouldn't have bothered having custom
locations for project files. The user should just specify the root of
the local files and the project should be saved in
~/.psychopy/projects/<projID> rather than in a custom location for each
project.

Jon

Erik Kastman

unread,
Apr 1, 2016, 4:28:29 PM4/1/16
to psycho...@googlegroups.com
Ugh, that logic is ugly. Thanks for figuring it out.

I somehow remember being able to use git directly with the OSF, but now that I'm thinking about it that must have just been their dropbox-style desktop sync. That's too bad; all that logic has been figured out already. Guess now isn't the time to add those git hooks to the builder after all.

One quick thought - might be worth setting 400 permissions (read-only) on the token file in the user's home directory the way that ssh-keys do?

Oliver Clark

unread,
May 4, 2016, 6:51:48 AM5/4/16
to psychopy-dev
Ah - does this explain the NameError: global name 'pyosf' is not defined error I get when I try to run psychopyApp.py from terminal?  I thought it was some sort of Pyo issue (having a lot of those at the moment!).

Richard Höchenberger

unread,
May 4, 2016, 10:16:37 AM5/4/16
to psychopy-dev
On Wed, May 4, 2016 at 12:51 PM, 'Oliver Clark' via psychopy-dev
<psycho...@googlegroups.com> wrote:
> Ah - does this explain the NameError: global name 'pyosf' is not defined
> error I get when I try to run psychopyApp.py from terminal?

This should actually be fixed in master:
https://github.com/psychopy/psychopy/commit/cc60556ba70da0d51fce4ea9c53cd2e4d77a650b

Cheers,

Richard
Reply all
Reply to author
Forward
0 new messages