jkuhl-uni / git-annex-remote-zenodo

Use Zenodo as a special remote for git-annex
GNU General Public License v3.0
0 stars 1 forks source link

git-annex special remote for Zenodo

This is a git-annex special remote for Zenodo. It allows the user to initialize a new special remote to use as a backend on Zenodo to store and/or publish.

The backend could be defined on either the sandbox or the official Zenodo deposits. The used needs to create an access key according to the platforme before initializing the remote.

Disclaimer

This code is in beta version and should be considered as a work in progress. Use at your own risk. Do not use it in production for the moment and report any issue you would identify through GitHub.

Features

Usage

Requirements

Installation

  1. Export the path to where git-annex-remote-zenodo is. export PATH=$PATH:path-program
  2. Make sure the git-annex-remote-zenodo is executable (chmod +x git-annex-remote-zenodo)

Initializing a remote

  1. Create a git-annex repository (https://git-annex.branchable.com/walkthrough/).
  2. Initialize the remote by providing the needed information through the command line options. Example: git annex initremote Myproject type=external externaltype=zenodo key=ACCESS_TOKEN encryption=none

Disabling the remote and publishing the files on the deposit

Once the user has finished using the remote, they can disable it using the script git-annex-disableremote.py. This can be done by executing the program and giving it information about the deposit we want to publish.

Example: git-annex-disableremote.py -i deposit_id -k ACCESS_TOKEN -p `which restore_archive.py`

Initializing a new version of a deposit

This can be done is the same was as when initializing a new Zenodo remote but this time the user should specify that it's a new version of a deposit and not an empty deposit.

Example: git annex initremote Myprojectv2 type=external newversion=id_olddeposit externaltype=zenodo key=ACCESS_TOKEN encryption=none

Restoring an archive

Since the structure of a Zenodo deposit is flat (no file hierarchy), it may be hard to exploit. This is why when a deposit is published on Zenodo through the disableremote mechanism, we also store an archive of the current branch in another Zenodo deposit, a git-annex-info.json file that allows to map annexed files to their zenodo counterpart, and a script (restore_archive.py) that can be used to restore this archive. The options are explained below.

Example: restore_archive.py -k ACCESS_TOKEN -o simpledownload -u sandbox

Options

When initializing the remote

Options specific to git-annex-remote-zenodo:

General git-annex options:

When publishing a deposit

These are the options given to the program git-annex-disableremote.py when archiving a deposit.

When restoring an archive

These options are given to the program restore_archive.py when restoring an archive.

Tutorial

A complete tutorial that showcases all the features of this program is available in the file walkthrough.org. It could be read through before using this remote and reexecuted to grasp the functionalities of the remote.

You need to have the access token to Zenodo in order to execute it.