This is a Python binding to the C++ class Mantid::API::ScriptRepository.
Manage the interaction between the users and the Script folder (mantid subproject).
Inside the mantid repository (https://github.com/mantidproject) there is also a subproject called scripts (https://github.com/mantidproject/scripts), created to allow users to share their scripts, as well as to allow Mantid Team to distribute to the Mantid community scripts for analysis and also to enhance the quality of the scripts used for the sake of data analysis.
The ScriptRepository aims to provide a simple way to interact with that repository in order to promote its usage. In order to enhance the usage, it is necessary:
- List all scripts available at the repository
- Download selected scripts.
- Check for updates
- Allow to publish users scripts/folders.
Basically, you will need to install the repository through ::install(local_path). After, you will be able to ::listFiles inside your repository to check the files that are available, eventually, you may want to check the information of a single entry ::fileInfo(path). You may also be interested to know if there is a new version available, or if the file has been modified since last downloaded (::fileStatus(path)). You may want to download scripts through ::download(path), or check for updates through ::update().
‘’‘NOTE:’‘’ Upload is not implemented yet.
Raises an exception This class cannot be instantiated from Python
Return description of the entry inside ScriptRepository.
Arguments:
- path: Path to the entry.
Download from repository into your local file system.
You may give a file or folder. If the later is given, ScriptRepository will download all the files inside that folder from the remote repository to you.
Arguments:
- path (str): Path for the entry do download
Return general information from the entries inside ScriptRepository.
The author, description and publication date are available through this method.
Arguments:
- path(str): Path to the entry.
Returns: n - tuple: (author, last publication date)
Return the status of a given entry.
‘’‘NOTE:’‘’ ScriptRepository recognizes changes locally and remotely only through listFiles method. Arguments:
- path (str): The path for the entry.
Returns:
- str: Status of the entry.
Install the ScriptRepository in your local file system
The installation of the ScriptRepository is very simple. You must only provide a path, existing or new folder, where the ScriptRepository will put the database it requires to run itself. The installation requires network connection, to connect to the central repository but usually takes very few moments to be installed. After installing, all the others methods will be available. Arguments:
- path (str): An existing or path to a new folder to be created, where the ScriptRepository will install itself.
Return an array with all the entries inside the repository.
Folder os files, locally or remotely, all will be listed together through the listFiles. The listFiles has another function, which is related to update the internal cache about the status and information of the files. So, local changes or remote changes will only be available to fileStatus of fileInfo after listFiles.
Returns:
list: entries inside the repository.
Check for updates at the remote repository.
New versions of the files may be available, and the update method will check the remote repository to see if there is anything new. It will not download new versions of the available files unless you ask to do so. You should do this often to check if there is a new script to solve your problem ;)