From a670d9123949a41f352c069f766ef08e41aab7e1 Mon Sep 17 00:00:00 2001 From: nsheff Date: Tue, 15 Aug 2023 17:15:24 -0400 Subject: [PATCH 1/5] don't try to count None file sizes --- eido/inspection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eido/inspection.py b/eido/inspection.py index f76726c..3bb7ad0 100644 --- a/eido/inspection.py +++ b/eido/inspection.py @@ -77,7 +77,7 @@ def get_input_files_size(sample, schema): all_inputs.update(required_inputs) with catch_warnings(record=True) as w: input_file_size = sum( - [size(f, size_str=False) or 0.0 for f in all_inputs if f != ""] + [size(f, size_str=False) or 0.0 for f in all_inputs if f != "" and f != None] ) / (1024**3) if w: _LOGGER.warning( From 53fd05b61cb066c101aa81e1e7f1f4a67a8d4e3c Mon Sep 17 00:00:00 2001 From: nsheff Date: Tue, 15 Aug 2023 17:16:21 -0400 Subject: [PATCH 2/5] dev version bump --- eido/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eido/_version.py b/eido/_version.py index 3ced358..a50e1c3 100644 --- a/eido/_version.py +++ b/eido/_version.py @@ -1 +1 @@ -__version__ = "0.2.1" +__version__ = "0.2.2-dev" From f22606dddd0a31e3e51849359407246c626fb84a Mon Sep 17 00:00:00 2001 From: nsheff Date: Wed, 23 Aug 2023 18:32:57 -0400 Subject: [PATCH 3/5] rename object to avoid primitive clash --- eido/validation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eido/validation.py b/eido/validation.py index 528aa85..c15db16 100644 --- a/eido/validation.py +++ b/eido/validation.py @@ -21,19 +21,19 @@ _LOGGER = getLogger(__name__) -def _validate_object(object, schema, sample_name_colname=False): +def _validate_object(obj, schema, sample_name_colname=False): """ Generic function to validate object against a schema - :param Mapping object: an object to validate + :param Mapping obj: an object to validate :param str | dict schema: schema dict to validate against or a path to one from the error. Useful when used ith large projects :raises EidoValidationError: if validation is unsuccessful """ validator = Draft7Validator(schema) - _LOGGER.debug(f"{object},\n {schema}") - if not validator.is_valid(object): - errors = sorted(validator.iter_errors(object), key=lambda e: e.path) + _LOGGER.debug(f"{obj},\n {schema}") + if not validator.is_valid(obj): + errors = sorted(validator.iter_errors(obj), key=lambda e: e.path) errors_by_type = {} # Accumulate and restructure error objects by error type From 9739b9e355ecaa8b75a13054093ead4ba8be8669 Mon Sep 17 00:00:00 2001 From: nsheff Date: Wed, 23 Aug 2023 19:06:52 -0400 Subject: [PATCH 4/5] make eido validation errors nicer --- eido/exceptions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eido/exceptions.py b/eido/exceptions.py index 6067063..ca40145 100644 --- a/eido/exceptions.py +++ b/eido/exceptions.py @@ -43,3 +43,7 @@ class EidoValidationError(EidoException): def __init__(self, message, errors_by_type): super().__init__(message) self.errors_by_type = errors_by_type + self.message = message + + def __str__(self): + return f"EidoValidationError ({self.message}): {self.errors_by_type}" From ced6b8025bcd2af9c262866a1205f7d10eb7cce9 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Thu, 16 Nov 2023 16:24:59 -0500 Subject: [PATCH 5/5] remove unused `exclude-case` from CLI. Prep for 0.2.2 release. Fixes #65 --- docs/api_docs.md | 87 ++++++++++++++++++++++++++----- docs/autodoc_build/eido.md | 14 ++--- docs/changelog.md | 5 ++ docs/plugin_api_docs.md | 20 +++---- eido/_version.py | 2 +- eido/argparser.py | 10 ---- eido/cli.py | 6 +-- eido/inspection.py | 6 ++- requirements/requirements-all.txt | 2 +- webeido/webeido/main.py | 2 +- 10 files changed, 104 insertions(+), 50 deletions(-) diff --git a/docs/api_docs.md b/docs/api_docs.md index 5404629..dd47fac 100644 --- a/docs/api_docs.md +++ b/docs/api_docs.md @@ -1,4 +1,4 @@ -Final targets: convert_project, get_available_pep_filters, inspect_project, read_schema, validate_config, validate_project, validate_sample +Final targets: EidoValidationError, convert_project, get_available_pep_filters, get_input_files_size, inspect_project, read_schema, validate_config, validate_input_files, validate_project, validate_sample -# Built-in `eido` Plugins Documentation +# Package `eido` Documentation + +Project configuration ```python -def basic_pep_filter(p, **kwargs) +def basic_pep_filter(p, **kwargs) -> Dict[str, str] ``` Basic PEP filter, that does not convert the Project object. @@ -48,7 +48,7 @@ This filter can save the PEP representation to file, if kwargs include `path`. ```python -def yaml_pep_filter(p, **kwargs) +def yaml_pep_filter(p, **kwargs) -> Dict[str, str] ``` YAML PEP filter, that returns Project object representation. @@ -62,7 +62,7 @@ This filter can save the YAML to file, if kwargs include `path`. ```python -def csv_pep_filter(p, **kwargs) +def csv_pep_filter(p, **kwargs) -> Dict[str, str] ``` CSV PEP filter, that returns Sample object representations @@ -77,7 +77,7 @@ This filter can save the CSVs to files, if kwargs include ```python -def yaml_samples_pep_filter(p, **kwargs) +def yaml_samples_pep_filter(p, **kwargs) -> Dict[str, str] ``` YAML samples PEP filter, that returns only Sample object representations. @@ -93,4 +93,4 @@ This filter can save the YAML to file, if kwargs include `path`. -*Version Information: `eido` v0.1.5-dev, generated by `lucidoc` v0.4.2* +*Version Information: `eido` v0.2.2-dev, generated by `lucidoc` v0.4.4* diff --git a/eido/_version.py b/eido/_version.py index a50e1c3..b5fdc75 100644 --- a/eido/_version.py +++ b/eido/_version.py @@ -1 +1 @@ -__version__ = "0.2.2-dev" +__version__ = "0.2.2" diff --git a/eido/argparser.py b/eido/argparser.py index f5ae763..e5581f9 100644 --- a/eido/argparser.py +++ b/eido/argparser.py @@ -88,16 +88,6 @@ def build_argparser(): metavar="S", ) - sps[VALIDATE_CMD].add_argument( - "-e", - "--exclude-case", - default=False, - action="store_true", - help="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.", - ) - sps[INSPECT_CMD].add_argument( "-n", "--sample-name", diff --git a/eido/cli.py b/eido/cli.py index a41ebff..3aa2e11 100644 --- a/eido/cli.py +++ b/eido/cli.py @@ -142,19 +142,19 @@ def main(): f"against a schema: {args.schema}" ) validator = validate_sample - arguments = [p, args.sample_name, args.schema, args.exclude_case] + arguments = [p, args.sample_name, args.schema] elif args.just_config: _LOGGER.debug( f"Comparing Project ('{args.pep}') against a schema: {args.schema}" ) validator = validate_config - arguments = [p, args.schema, args.exclude_case] + arguments = [p, args.schema] else: _LOGGER.debug( f"Comparing Project ('{args.pep}') against a schema: {args.schema}" ) validator = validate_project - arguments = [p, args.schema, args.exclude_case] + arguments = [p, args.schema] try: validator(*arguments) except EidoValidationError as e: diff --git a/eido/inspection.py b/eido/inspection.py index 3bb7ad0..2f47ae5 100644 --- a/eido/inspection.py +++ b/eido/inspection.py @@ -77,7 +77,11 @@ def get_input_files_size(sample, schema): all_inputs.update(required_inputs) with catch_warnings(record=True) as w: input_file_size = sum( - [size(f, size_str=False) or 0.0 for f in all_inputs if f != "" and f != None] + [ + size(f, size_str=False) or 0.0 + for f in all_inputs + if f != "" and f != None + ] ) / (1024**3) if w: _LOGGER.warning( diff --git a/requirements/requirements-all.txt b/requirements/requirements-all.txt index 6c9f39c..5517bdc 100644 --- a/requirements/requirements-all.txt +++ b/requirements/requirements-all.txt @@ -1,5 +1,5 @@ jsonschema>=3.0.1 logmuse>=0.2.5 pandas -peppy>=0.35.5 +peppy>=0.35.7 ubiquerg>=0.5.2 diff --git a/webeido/webeido/main.py b/webeido/webeido/main.py index 3375e02..f5e67f2 100644 --- a/webeido/webeido/main.py +++ b/webeido/webeido/main.py @@ -112,7 +112,7 @@ async def validate_pep(request: Request, files: List[UploadFile] = File(...)): def vwrap(p, schema): x = None try: - eido.validate_project(project=p, schema=schema, exclude_case=True) + eido.validate_project(project=p, schema=schema) except Exception as e: x = e print(x)