fair-cli

Command line interface for the FAIR Data Pipeline

https://github.com/fairdatapipeline/fair-cli

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    2 of 13 committers (15.4%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.4%) to scientific vocabulary

Keywords

data data-pipeline fair

Keywords from Contributors

interactive mesh interpretability sequences generic projection optim hacking network-simulation
Last synced: 6 months ago · JSON representation ·

Repository

Command line interface for the FAIR Data Pipeline

Basic Info
  • Host: GitHub
  • Owner: FAIRDataPipeline
  • License: bsd-2-clause
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 5.98 MB
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • Open Issues: 15
  • Releases: 8
Topics
data data-pipeline fair
Created over 4 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License Citation

README.md

FAIR Data Pipeline Command Line Interface

PyPI PyPI - Python Version DOI PyPI - License CII Best Practices

FAIR Data Pipeline CLI codecov Quality Gate Status

FAIR-CLI forms the main interface for synchronising changes between local and shared remote FAIR Data Pipeline registries, it is also used to instantiate model runs/data submissions to the pipeline. Full documentation of the FAIR Data Pipeline can be found on the project website.

Installation

The package is installed using Pip:

sh pip install fair-cli

To enable tab completion you need to modify your shell:

Bash

_FAIR_COMPLETE=bash_source fair > ~/.config/.fair-complete.bash echo '. ~/.config/.fair-complete.bash' >> ~/.bashrc

zsh

_FAIR_COMPLETE=zsh_source fair > ~/.fair-complete.zsh echo '. ~/.fair-complete.zsh' >> ~/.bashrc

Fish

_FAIR_COMPLETE=bash_source fair > ~/.config/fish/.fair-complete.fish echo '. ~/.config/fish/.fair-complete.fish' >> ~/.bashrc

Uninstallation

To uninstall the CLI run: fair purge --all pip uninstall fair

The User Configuration File

Job runs are configured via config.yaml files. Upon initialisation of a project, FAIR-CLI automatically generates a starter configuration file with all requirements in place. To execute a process (e.g. perform a model run from a compiled binary/script) an additional key of either script or script_path must be provided. Alternatively the command fair run bash can be used to append the key and run a command directly.

By default the shell used to execute a process is sh or batch for UNIX and Windows systems respectively. This can be overwritten by assigning the optional shell key with one of the following values (where {0} is the script file):

| Shell | Command | | ------------ | ------------------------------- | | bash | bash -eo pipefail {0} | | java | java {0} | | julia | julia {0} | | powershell | powershell -command ". '{0}'" | | pwsh | pwsh -command ". '{0}'" | | python2 | python2 {0} | | python3 | python3 {0} | | python | python {0} | | R | R -f {0} | | sh | sh -e {0} | | batch | {0} |

A full description of config.yaml files can be found here.

Available Commands

init

Initialises a new FAIR repository within the given directory. This should ideally be the same location as the .git folder for the current project, however during setup an option is given to specify an alternative. The command will ask the user a series of questions which will provide metadata for tracking run authors, and also allow for the creation of a starter config.yaml file. Initialisation will also configure the CLI itself.

Custom CLI Configuration

After setup is complete, the current CLI configuration can also be saved using the command: fair init --export the created file can then be re-read at a later point during setup. Alternatively, if creating a configuration from scratch the YAML file should contain the following information:

yaml namespaces: input: testing output: testing registries: local: data_store: /path/to/local/data_store/, directory: /local/registry/install/directory uri: http://127.0.0.1:8000/api/ origin: data_store: /remote/registry/data/store/path/ token: /path/to/remote/token uri: https://data.fairdatapipeline.org/api/' user: email: 'test@noreply', family_name: 'Test' given_names: 'Interface' orcid: None, uuid: '2ddb2358-84bf-43ff-b2aa-3ac7dc3b49f1' git: local_repo: /local/repo/path remote: origin description: Testing Project this file is then read during the initialisation:

sh fair init --using <cli-config.yaml file>

For integration into a CI workflow, the setup can be skipped by running:

sh fair init --ci

which will create temporary directories for some of the required location paths.

run

The purpose of run is to execute a model/submission run and submit results to the local registry. Outputs of a run will be stored within the coderun folder in the directory specified under the data_store tag in the config.yaml, by default this is $HOME/.fair/data/coderun.

sh fair run

If you wish to use an alternative config.yaml then specify it as an additional argument:

sh fair run /path/to/config.yaml

You can also launch a bash command directly, this will be automatically written into the config.yaml:

sh fair run --script 'echo "Hello World"'

note the command itself must be quoted as it is a single argument.

By default the CLI will not allow the user to perform a run if the state of the analysis repository is such that it is behind the git remote, or contains uncommitted changes. To override this behaviour use the --dirty flag.

pull

The command pull will update any entries within the config.yaml under the register heading creating external_object and data_product objects on the registry and downloading the data to the local data storage. Any data required for a run is downloaded and stored within the local registry. In addition any data products requested that are available on the remote registry are pulled locally.

sh fair pull /path/to/config.yaml

status

This command displays objects which are awaiting staging or have been staged behaving in a manner similar to git status: sh fair status staged changes are displayed in green, and unstaged in red.

add

Before changes can be pushed to the remote registry they must be staged. This command allows you to stage objects displayed when running fair status so that they can be sent to the remote registry. Data products are displayed and staged in the form namespace:data_product_name@version: sh fair add my_namespace:data_object@v0.1.0

push

The push command will push any staged data products to the remote registry:

sh fair push

purge

The purge command removes setup of the current project so it can bereinitialised:

sh fair purge

To remove all configurations entirely (including those global to all projects) run:

sh fair purge --global

To remove the data directory itself run:

sh fair purge --data

WARNING: This is not recommended as the registry may still have entries pointing to this location!

Finally to remove everything run:

sh fair purge --all

this will remove the current repository .fair folder and the global FAIR directory which also contains the local registry.

You can skip any confirmation messages by running:

sh fair purge --yes

registry

By default the CLI will launch the registry whenever a synchronisation or run is called. The server will only be halted once all ongoing CLI processes (in the case of multiple parallel calls) have been completed.

However the user may also specify a manual launch that will override this behaviour, instead leaving the server running constantly allowing them to view the registry in the browser.

The commands:

sh fair registry start

and

sh fair registry stop

will launch and halt the server respectively.

The registry can be installed using the CLI as well by running: sh fair registry install with the additional options to specify the installation location, and the data registry repository tag to install from: sh fair registry install --directory ~/.fair/my_registry --version v1.0-rc5

log

Runs are logged locally within the local FAIR repository. A full list of runs is shown by running:

sh fair log

This will present a list of runs in a summary analogous to a git log call:

yaml run 0db35c20946a1ebeaafdc3b30103cd74a57eb6b6 Author: Joe Bloggs <jbloggs@noreply.uk> Date: Wed Jun 30 09:09:30 2021

| NOTE | | ----------------------------------------------------------------------------------------------------------------------------------- | | The SHA for a job is not related to a registry code run identifier as multiple code runs can be executed within a single job. |

view

To view the stdout of a run given its SHA as shown by running fair log use the command:

sh fair view <sha>

you do not need to specify the full SHA but rather the first few unique characters.

Template Variables

Within the config.yaml file, template variables can be specified by using the notation ${{ VAR }}, the following variables are currently recognised:

| Variable | Description | | ------------------- | -------------------------------------------------------------------------------- | | DATE | Date in the form %Y%m%d | | DATETIME | Date and time in the form %Y-%m-%sT%H:%M:S | | DATETIME-%Y%H%M | Date and time in custom format (where %Y%H%M can be any valid form) | | USER | The current user as defined in the CLI | | USER_ID | The unique identifier for the current user | | REPO_DIR | The FAIR repository root directory | | CONFIG_DIR | The directory containing the config.yaml after template substitution | | LOCAL_TOKEN | The token for access to the local registry | | SOURCE_CONFIG | Path of the user defined config.yaml | | GIT_BRANCH | Current branch of the git repository | | GIT_REMOTE | The URI of the git repository specified during setup | | GIT_TAG | The latest tag on git |

Owner

  • Name: FAIR Data Pipeline
  • Login: FAIRDataPipeline
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
abstract: "Command Line Interface for the FAIR Data Pipeline system, this software provides commands necessary for integrating analysis and data processing into the FAIR registry."
authors:
- family-names: Zarebski
  given-names: Kristian
  affiliation: United Kingdom Atomic Energy Authority
  orcid: https://orcid.org/0000-0002-6773-1049
- family-names: Reeve
  given-names: Richard
  affiliation: University of Glasgow
  orcid: https://orcid.org/0000-0003-2589-8091
- family-names: Reddyhoff
  given-names: Dennis
  affiliation: University of Sheffield
  orcid: https://orcid.org/0000-0002-4971-2346
- family-names: Cummings
  given-names: Nathan
  affiliation: United Kingdom Atomic Energy Authority
  orcid: https://orcid.org/0000-0003-4359-6337
- family-names: Viola
  given-names: Bruno
  affiliation: United Kingdom Atomic Energy Authority
  orcid: https://orcid.org/0000-0001-5406-5860
- family-names: Field
  given-names: Ryan
  affiliation: University of Glasgow
  orcid: https://orcid.org/0000-0002-4424-9890

date-released: 2025-04-08
keywords:
- FAIR Data Pipeline
- FAIR
- Data Management
- Provenance
license: BSD-2-Clause
message: If you use this software, please cite it using these metadata.
repository-code: https://github.com/FAIRDataPipeline/FAIR-CLI/
title: "The FAIR Data Pipeline command line tool"
version: 0.9.8

GitHub Events

Total
  • Release event: 1
  • Delete event: 1
  • Issue comment event: 7
  • Push event: 12
  • Pull request event: 9
  • Create event: 4
Last Year
  • Release event: 1
  • Delete event: 1
  • Issue comment event: 7
  • Push event: 12
  • Pull request event: 9
  • Create event: 4

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 815
  • Total Committers: 13
  • Avg Commits per committer: 62.692
  • Development Distribution Score (DDS): 0.477
Past Year
  • Commits: 21
  • Committers: 2
  • Avg Commits per committer: 10.5
  • Development Distribution Score (DDS): 0.048
Top Committers
Name Email Commits
Kristian Zarębski k****i@u****k 426
Ryan J Field R****d 132
Richard Reeve g****t@r****t 52
DennisReddyhoff d****f@s****k 51
Ryan Field r****m 51
dependabot[bot] 4****] 30
Nathan Cummings n****s@u****k 28
bruvio b****a@p****e 26
Robert (Bob) Turner r****r@s****k 12
Ryan J Field R****d 3
nathan-cummings-ukaea 5****a 2
bruvio b****a@p****m 1
Ryan Field R****d@u****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 27
  • Total pull requests: 109
  • Average time to close issues: 4 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 6
  • Total pull request authors: 6
  • Average comments per issue: 2.07
  • Average comments per pull request: 2.44
  • Merged pull requests: 48
  • Bot issues: 0
  • Bot pull requests: 63
Past Year
  • Issues: 0
  • Pull requests: 7
  • Average time to close issues: N/A
  • Average time to close pull requests: 20 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.86
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • RyanJField (16)
  • bobturneruk (4)
  • kzscisoft (3)
  • DennisReddyhoff (2)
  • richardreeve (1)
  • bruvio (1)
Pull Request Authors
  • dependabot[bot] (63)
  • RyanJField (33)
  • bruvio (5)
  • kzscisoft (4)
  • fossabot (2)
  • bobturneruk (2)
Top Labels
Issue Labels
bug (12) enhancement (4) priority: low (4) priority: high (2) priority: medium (2) documentation (2) wontfix (1) discussion (1)
Pull Request Labels
dependencies (63) enhancement (3) priority: high (1) bug (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 165 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 26
  • Total maintainers: 4
pypi.org: fair-cli

Synchronization interface for the SCRC FAIR Data Pipeline registry

  • Versions: 26
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 165 Last month
Rankings
Dependent packages count: 10.1%
Dependent repos count: 21.5%
Average: 21.7%
Stargazers count: 23.1%
Downloads: 24.0%
Forks count: 29.8%
Last synced: 6 months ago

Dependencies

poetry.lock pypi
  • 104 dependencies
pyproject.toml pypi
  • bandit ^1.7.2 develop
  • black ^22.1 develop
  • coverage ^6.3 develop
  • deepdiff ^5.5.0 develop
  • flake8 ^3.9.2 develop
  • isort ^5.10.1 develop
  • loremipsum ^1.0.5 develop
  • mypy ^0.931 develop
  • poetry ^1.1.12 develop
  • pre-commit ^2.16.0 develop
  • pycodestyle ^2.7.0 develop
  • pydocstyle ^6.0.0 develop
  • pylama ^7.7.1 develop
  • pytest ^7.0.0 develop
  • pytest-cov ^3.0.0 develop
  • pytest-dependency ^0.5.1 develop
  • pytest-mock ^3.7.0 develop
  • pytest-virtualenv ^1.7.0 develop
  • requests-mock ^1.9.3 develop
  • GitPython ^3.1.18
  • Jinja2 ^3.0.1
  • PyYAML >=5.4.1,<7.0.0
  • click ^8.0.0
  • email-validator ^1.1.3
  • netCDF4 ^1.5.8
  • pre-commit ^2.15.0
  • pydantic ^1.9.0
  • python ^3.8.0,<4.0
  • requests ^2.23.0
  • rich >=10.2.3,<12.0.0
  • semver ^2.13.0
  • simplejson ^3.17.5
  • toml ^0.10.2
  • validators ^0.18.2
.github/workflows/deploy.yaml actions
  • WyriHaximus/github-action-get-previous-tag v1 composite
  • actions/checkout v3 composite
  • actions/download-artifact v1 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • actions/upload-artifact v1 composite
  • softprops/action-gh-release v1 composite
.github/workflows/fair-cli.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/gh-pages.yaml actions
  • sphinx-notes/pages v3 composite
.github/workflows/implementations.yml actions
  • actions/checkout v3 composite
  • actions/setup-java v3 composite
  • actions/setup-python v4 composite
  • julia-actions/setup-julia v1 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
docs/requirements.txt pypi
  • myst_parser >=1.0.0
  • sphinx-rtd-theme >=1.0.0