-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from pepkit/dev
v0.0.5
- Loading branch information
Showing
15 changed files
with
614 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,3 +78,6 @@ peppy.egg-info/ | |
#ipynm checkpoints | ||
*ipynb_checkpoints* | ||
*.egg-info* | ||
|
||
# mkdocs website | ||
site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# eido | ||
|
||
[![Build Status](https://travis-ci.org/pepkit/eido.svg?branch=master)](https://travis-ci.org/pepkit/eido) | ||
[![Coverage Status](https://coveralls.io/repos/github/pepkit/eido/badge.svg?branch=master)](https://coveralls.io/github/pepkit/eido?branch=master) | ||
[![PEP compatible](http://pepkit.github.io/img/PEP-compatible-green.svg)](http://pepkit.github.io) | ||
|
||
[PEP](http://pepkit.github.io) validation tool based on [`jsonschema`](https://github.com/Julian/jsonschema) package. | ||
|
||
--- | ||
*Eidos* is a Greek term meaning "form" "essence", "type" or "species". See Plato's theory of Forms and Aristotle's theory of universals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<script> | ||
document.addEventListener('DOMContentLoaded', (event) => { | ||
document.querySelectorAll('h3 code').forEach((block) => { | ||
hljs.highlightBlock(block); | ||
}); | ||
}); | ||
</script> | ||
|
||
<style> | ||
h3 .content { | ||
padding-left: 22px; | ||
text-indent: -15px; | ||
} | ||
h3 .hljs .content { | ||
padding-left: 20px; | ||
margin-left: 0px; | ||
text-indent: -15px; | ||
martin-bottom: 0px; | ||
} | ||
h4 .content, table .content, p .content, li .content { margin-left: 30px; } | ||
h4 .content { | ||
font-style: italic; | ||
font-size: 1em; | ||
margin-bottom: 0px; | ||
} | ||
|
||
</style> | ||
|
||
|
||
# Package `eido` Documentation | ||
|
||
```python | ||
def validate_project(project, schema, exclude_case=False) | ||
``` | ||
|
||
Validate a project object against a schema | ||
#### Parameters: | ||
|
||
- `project` (`peppy.Sample`): a project object to validate | ||
- `schema` (`str | dict`): schema dict to validate against or a path to one | ||
- `exclude_case` (`bool`): whether to exclude validated objects from the error.Useful when used ith large projects | ||
|
||
|
||
|
||
|
||
```python | ||
def validate_sample(project, sample_name, schema, exclude_case=False) | ||
``` | ||
|
||
Validate the selected sample object against a schema | ||
#### Parameters: | ||
|
||
- `project` (`peppy.Project`): a project object to validate | ||
- `sample_name` (`str | int`): name or index of the sample to validate | ||
- `schema` (`str | dict`): schema dict to validate against or a path to one | ||
- `exclude_case` (`bool`): whether to exclude validated objects from the error.Useful when used ith large projects | ||
|
||
|
||
|
||
|
||
```python | ||
def validate_config(project, schema, exclude_case=False) | ||
``` | ||
|
||
Validate the config part of the Project object against a schema | ||
#### Parameters: | ||
|
||
- `project` (`peppy.Project`): a project object to validate | ||
- `schema` (`str | dict`): schema dict to validate against or a path to one | ||
- `exclude_case` (`bool`): whether to exclude validated objects from the error.Useful when used ith large projects | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
*Version Information: `eido` v0.0.5-dev, generated by `lucidoc` v0.4.2* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Contributing | ||
|
||
Pull requests or issues are welcome. After adding a new feature, please add tests in the `tests` folder and run the test suite. The only additional dependencies needed beyond those for the package can be installed with: `pip install -r requirements/requirements-dev.txt`. | ||
|
||
Once those are installed, run the tests with `pytest` or `python setup.py test`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Installing eido | ||
|
||
Install from [GitHub releases](https://github.com/pepkit/eido/releases) or from PyPI using `pip`: | ||
|
||
- `pip install --user eido`: install into user space. | ||
- `pip install --user --upgrade eido`: update in user space. | ||
- `pip install eido`: install into an active virtual environment. | ||
- `pip install --upgrade eido`: update in virtual environment. | ||
|
||
See if your install worked by calling `eidp -h` on the command line. If the `eido` executable in not in your `$PATH`, append this to your `.bashrc` or `.profile` (or `.bash_profile` on macOS): | ||
|
||
```{console} | ||
export PATH=~/.local/bin:$PATH | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
jupyter:True | ||
# `eido` command line usage | ||
|
||
To use the command line application one just needs two required paths as arguments to the `eido` command: | ||
|
||
- a path to a project configuration file (`-p`/`--pep` option) | ||
- a path to a YAML formatted schema (`-s`/`--schema` option) | ||
|
||
Optionally, to validate just the config part of the PEP or a specific sample, `-n`/`--sample-name` or `-c`/`--just-config` arguments should be used, respectively. Please refer to the help for more details: | ||
|
||
``` | ||
~ eido -h | ||
``` | ||
``` | ||
version: 0.0.5 | ||
usage: eido [-h] [-V] -p PEP -s SCHEMA [-e] [-n SAMPLE_NAME | -c] [--silent] | ||
[--verbosity V] [--logdev] | ||
eido - validate project metadata against a schema | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
-V, --version show program's version number and exit | ||
-p PEP, --pep PEP PEP configuration file in yaml format. | ||
-s SCHEMA, --schema SCHEMA | ||
PEP schema file in yaml format. | ||
-e, --exclude-case Whether to exclude the validation case from an error. | ||
Only the human readable message explaining the error | ||
will be raised. Useful when validating large PEPs. | ||
-n SAMPLE_NAME, --sample-name SAMPLE_NAME | ||
Name or index of the sample to validate. Only this | ||
sample will be validated. | ||
-c, --just-config Whether samples should be excluded from the | ||
validation. | ||
--silent Silence logging. Overrides verbosity. | ||
--verbosity V Set logging level (1-5 or logging module level name) | ||
--logdev Expand content of logging message format. | ||
https://github.com/pepkit/eido | ||
``` | ||
|
||
Successful validation of the project is confirmed with an appropriate message: | ||
``` | ||
~ eido -p config.yaml -s tests/data/schemas/test_schema.yaml | ||
``` | ||
``` | ||
Reading sample annotations sheet: '/Users/mstolarczyk/Uczelnia/UVA/code/ppqc/ppqc_annotation_revised.csv' | ||
Validation successful | ||
``` | ||
|
||
Alternatively, a [`jsonschema.exceptions.ValidationError`](https://python-jsonschema.readthedocs.io/en/stable/errors/#jsonschema.exceptions.ValidationError) is raised with a discrepancy description. |
Oops, something went wrong.