datalight.common.
get_files_path
(fname)[source]¶Function to get the path(s) of the file(s)
Parameters: | fname (str) – Name of the file to get the path or the directory to list |
---|
datalight.common.
zipdata
(files, zipname='data.zip')[source]¶Method to zip files which will be uploaded to the data repository.
Parameters: |
|
---|
Module to contains the configuration of the zenoligth software
Authors: | Nicolas Gruel <nicolas.gruel@manchester.ac.uk> |
---|---|
Copyright: | IT Services, The University of Manchester |
Main module for datalight
Authors: | Nicolas Gruel <nicolas.gruel@manchester.ac.uk> |
---|---|
Copyright: | IT Services, The University of Manchester |
datalight.datalight.
main
(args=None)[source]¶Run datalight scripts to upload file on data repository
Command line:
Usage: datalight [-h | --help] <files>... (-m <metadata> | --metadata=<metadata>) [options]
Options:
-m FILE --metadata=FILE File which contains the metadata information
-z zipname --zipname=FILE Name of the zip file which will be uploaded [default: data.zip]
--nozip Do not create zip file containing the data to upload
-r NAME --repository=NAME Name of a data repository [default: zenodo]
-p --publish If present publish the data
-s --sandbox If present, datalight will use the sandbox data repository
-k --keep Keep zip file created
-h --help Print this help
-v --version Print version of the software
Examples:
datalight file1 file2
datalight directory --metadata=metadata.yml --repository=zenodo
datalight file -m metadata.yml
Raises: |
|
---|
Manage the token creation. modification and reading
This module is implementing high level function to upload and download data on Zenodo.
Authors: | Nicolas Gruel <nicolas.gruel@manchester.ac.uk> |
---|---|
Copyright: | IT Services, The University of Manchester |
datalight.zenodo.
Zenodo
(token, metadata=None, sandbox=False)[source]¶Bases: object
Class to upload and download files on Zenodo
token
¶Token that need to be provided to Zenodo to be able to upload. The attribute is optional.
Type: | str, optional |
---|
sandbox
¶Default False, if True, the record is created on the Zenodo sandbox version which is provided for test purpose.
Type: | bool |
---|
delete
(_id=None)[source]¶Method to delete deposition.
Parameters: |
|
---|
get_deposition_id
()[source]¶Method to obtain the deposition id need to upload documents to Zenodo
deposition_id
¶Deposition id gave by Zenodo deposition api to be used to upload files and metadata.
Type: | int |
---|
Exception
¶---------
ZenodoException
¶raise if token not define (token = None) or if connection return status >= 400
set_metadata
(metadata=None)[source]¶Method to read and validate metadata.
Returns: | metadata – dictionary with one key ‘metadata’ associated to Zenodo metadata, ready to be use for uploading. |
---|---|
Return type: | dict |
upload_files
(filenames, path=None, _id=None)[source]¶Method to upload a file to Zenodo
Parameters: |
|
---|
upload_metadata
(metadata=None, _id=None)[source]¶Upload metadata to Zenodo repository.
After creating the request and upload the file(s) we need to update the metadata needed by Zenodo related to the record.
Parameters: |
|
---|
This module is implementing high level function to upload and download Lightform data.
Note
There are no verification of the validity of the schema used to validate the metadata which will be uploaded to Zenodo. This part should be done somewhere else. In a perfect world, the schema should be provided by Zenodo but it is not (yet) the case.
Authors: | Nicolas Gruel <nicolas.gruel@manchester.ac.uk> |
---|---|
Copyright: | IT Services, The University of Manchester |
datalight.zenodo_metadata.
ZenodoMetadata
(metadata, schema='/home/gruel/PycharmProjects/datalight/datalight/schemas/zenodo/metadata-1.0.0.yml')[source]¶Bases: object
Class to manage the Metadata needed for Zenodo.
get_metadata
()[source]¶Method which will return Zenodo metadata
This method will return a dictionary which contains Zenodo metadata.
Returns: | metadata – Dictionary which contains Zenodo metadata. |
---|---|
Return type: | dict |
validate
()[source]¶Method which is verifying that the metadata does have the correct type and if the dependencies are respected.
The dependencies have to be check because the value of a metadata can implied the presence of another one. For example, if upload_type (which is a necessary metadata) has the value publication that implied the presence of the metadata publication_type.