votca / PyVOTCA

Generic tools to interact with Votca using Python
Apache License 2.0
1 stars 1 forks source link

add schema validation to user input #5

Open felipeZ opened 3 years ago

felipeZ commented 3 years ago

Add schema validation

having an input in YAML allows the user to provide in a single file all the options. This has the advantage of avoiding passing every option via the command line. Also the schema package takes care of validating the input. Now the command line can be called like:

 xtp_gradient -i tests/files/example.yml 

where the example.yml file contains all the user keywords that the user wants to supply. The only mandatory keyword is the path to the molecule. For example the following is a valid input:

molecule: tests/files/ethylene.xyz
codecov[bot] commented 3 years ago

Codecov Report

Merging #5 (9979d16) into master (17ef79f) will decrease coverage by 2.13%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #5      +/-   ##
==========================================
- Coverage   25.94%   23.80%   -2.14%     
==========================================
  Files           6        7       +1     
  Lines         212      231      +19     
  Branches       27       27              
==========================================
  Hits           55       55              
- Misses        157      176      +19     
Impacted Files Coverage Δ
PyVOTCA/schemas.py 0.00% <0.00%> (ø)
PyVOTCA/xtp_gradient.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 17ef79f...9979d16. Read the comment docs.

baumeier commented 3 years ago

I'm not sure if I understand when this works. You show the example of when we have a pre-defined tool such as the xtp_gradient. That I can follow.

However, the votca wrapper is freely importable into any custom code, like in the run_python.py in the newly created examples folder. That one will not know about command line options and yaml?

felipeZ commented 3 years ago

You are right there is a schema for each command line. But for the wrapper is not necessary because we assume that the user know what she/he is doing