Skip to content

Commit

Permalink
Merge pull request #9 from pepkit/dev
Browse files Browse the repository at this point in the history
v0.0.5
  • Loading branch information
stolarczyk authored Feb 4, 2020
2 parents 2c7b46a + 5a16b45 commit d124573
Show file tree
Hide file tree
Showing 15 changed files with 614 additions and 59 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ peppy.egg-info/
#ipynm checkpoints
*ipynb_checkpoints*
*.egg-info*

# mkdocs website
site
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[PEP](http://pepkit.github.io) validation tool based on [`jsonschema`](https://github.com/Julian/jsonschema) package.

See [this jupyter notebook](docs/demo.ipynb) for usage demonstration
See [this jupyter notebook](docs_jupyter/demo.ipynb) for usage demonstration

---
*Eidos* is a Greek term meaning "form" "essence", "type" or "species". See Plato's theory of Forms and Aristotle's theory of universals
10 changes: 10 additions & 0 deletions docs/README.md
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
78 changes: 78 additions & 0 deletions docs/autodoc_build/eido.md
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*
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.0.5] - 2020-02-04
### Added
- [documentation website](http://eido.databio.org/en/latest/)
- include version in the CLI help

## [0.0.4] - 2020-01-31
### Added
- `validate_sample` function for sample level validation
Expand Down
6 changes: 6 additions & 0 deletions docs/contributing.md
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`.

14 changes: 14 additions & 0 deletions docs/install.md
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
```
51 changes: 51 additions & 0 deletions docs/jupyter_docs/cli.md
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.
Loading

0 comments on commit d124573

Please sign in to comment.