To validate a full submission, instantiate a FullSubmissionValidator object: from hepdata_validator.full_submission_validator import FullSubmissionValidator, SchemaType full_submission_validator = FullSubmissionValidator () # validate a directory is_dir_valid = full_submission_validator. Or a YAML data file ) to check - see /en/latest/single_yaml.html. d, -directory TEXT Directory to check (defaults to current working Can check eitherĪ directory, an archive file, or the single YAML file format. Offline validation of submission.yaml and YAML data files. To validate a single YAML file in the current directory: $ hepdata-validate -f single_yaml_file.yaml Usage options $ hepdata-validate -help tgz) in the current directory: $ hepdata-validate -a TestHEPSubmission.zip To validate a submission comprising of multiple files in another directory: $ hepdata-validate -d. To validate a submission comprising of multiple files in the current directory: $ hepdata-validate Installing the hepdata-validator package adds the command hepdata-validate to your path, which allows you to validate a The same package is used for validating uploads made to, thereforeįirst validating offline can be more efficient in checking your submission is valid before uploading. yaml.gz file (but not submission.yaml or a YAML data file)Ī submission.yaml file or individual YAML data file (via Python only, not via the command line) tgz) containing all of the files ( full details)Ī single. The hepdata-validator package allows you to validate (via the command line or Python):Ī full directory of submission and data filesĪn archive file (.zip. (hepdata-validator ) $ USE_LIBYAML =False pytest testsuite Usage Tests should be run both with and without LibYAML, as error messages from the different YAML parsers vary: (hepdata-validator ) $ USE_LIBYAML =True pytest testsuite (hepdata-validator ) $ pip install -upgrade -e "." $ source ~/venv/hepdata-validator/bin/activate $ python3 -m venv ~/venv/hepdata-validator Run the following after installing LibYAML via Homebrew: $ LDFLAGS = "-L $(brew -prefix ) /lib" CFLAGS = "-I $(brew -prefix ) /include" pip install -global-option = "-with-libyaml" -force pyyaml Developersĭevelopers should install from GitHub in a virtual environment: $ git clone If you would like to use LibYAML, you may need an additional step if running on an M1 Mac, to ensure pyyaml is built Install from PyPI using pip: $ pip install -user hepdata-validator Not a big deal for small files, but performs markedly better on larger documents. This will allow for the use of CSafeLoader (instead of Python SafeLoader) for faster loading of YAML files. If you can, install LibYAML (a C library for parsing and emitting YAML) on your machine. JSON schema and validation code (in Python 3) for HEPData submissions
0 Comments
Leave a Reply. |