From 79b06d3bf77ff722c1236f53ebde6643f8aedd0a Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Fri, 7 Jul 2023 00:56:55 +0100 Subject: [PATCH 1/9] Rename old visualization generator script To make filenames in a future commit less ambiguous. --- scripts/build-docs.sh | 2 +- .../{gen_benchcomp_schemas.py => gen_visualization_schemas.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/{gen_benchcomp_schemas.py => gen_visualization_schemas.py} (100%) diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh index dfa34737bba1..d308a64146f1 100755 --- a/scripts/build-docs.sh +++ b/scripts/build-docs.sh @@ -62,7 +62,7 @@ fi echo "Building user documentation..." # Generate benchcomp documentation from source code mkdir -p gen_src -"${SCRIPT_DIR}/gen_benchcomp_schemas.py" gen_src +"${SCRIPT_DIR}/gen_visualization_schemas.py" gen_src # Build the book into ./book/ mkdir -p book diff --git a/scripts/gen_benchcomp_schemas.py b/scripts/gen_visualization_schemas.py similarity index 100% rename from scripts/gen_benchcomp_schemas.py rename to scripts/gen_visualization_schemas.py From fc8b6b56d7c1fb8751c4cbd49c3781cebcc918ef Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Fri, 7 Jul 2023 19:36:37 +0100 Subject: [PATCH 2/9] Add CSS comment style to copyright check --- scripts/ci/copyright_check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/copyright_check.py b/scripts/ci/copyright_check.py index 3b07fb56da58..5e2133539d21 100755 --- a/scripts/ci/copyright_check.py +++ b/scripts/ci/copyright_check.py @@ -10,8 +10,8 @@ COMMENT_OR_EMPTY_PATTERN = '^(//.*$|#.*$|\\s*$)' -STANDARD_HEADER_PATTERN_1 = '(//|#) Copyright Kani Contributors' -STANDARD_HEADER_PATTERN_2 = '(//|#) SPDX-License-Identifier: Apache-2.0 OR MIT' +STANDARD_HEADER_PATTERN_1 = '(//|#|/\\*) Copyright Kani Contributors' +STANDARD_HEADER_PATTERN_2 = '(//|#| \\*) SPDX-License-Identifier: Apache-2.0 OR MIT' MODIFIED_HEADER_PATTERN_1 = '(//|#) SPDX-License-Identifier: Apache-2.0 OR MIT' MODIFIED_HEADER_PATTERN_2 = COMMENT_OR_EMPTY_PATTERN From 11f3ffed3ee3f4e6b306637f9584e6427f8c9173 Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Fri, 7 Jul 2023 19:38:17 +0100 Subject: [PATCH 3/9] Add `schema` schema for benchcomp config file This commit switches the data validation package from `cerberus` to `schema`. This is because schema is able to emit the schema in a standardized format that can later be rendered into HTML. This will be implemented in a future commit. --- tools/benchcomp/benchcomp/__init__.py | 100 ++++++++---------------- tools/benchcomp/requirements.txt | 2 +- tools/benchcomp/test/unit/test_utils.py | 1 + 3 files changed, 33 insertions(+), 70 deletions(-) diff --git a/tools/benchcomp/benchcomp/__init__.py b/tools/benchcomp/benchcomp/__init__.py index eedd6ebc1f32..0d0ead2d77aa 100644 --- a/tools/benchcomp/benchcomp/__init__.py +++ b/tools/benchcomp/benchcomp/__init__.py @@ -16,56 +16,34 @@ import yaml -class ConfigFile(collections.UserDict): - _schema: str = textwrap.dedent("""\ -variants: - type: dict - keysrules: - type: string - valuesrules: - schema: - config: - type: dict - keysrules: - type: string - valuesrules: - allow_unknown: true - schema: - command_line: - type: string - directory: - type: string - env: - type: dict - keysrules: - type: string - valuesrules: - type: string -run: - type: dict - keysrules: - type: string - schema: - suites: - type: dict - keysrules: - type: string - valuesrules: - schema: - variants: - type: list - parser: - type: dict - keysrules: - type: string - valuesrules: - anyof: - - schema: - type: {} -filter: {} -visualize: {} -""") +class _SchemaValidator: + """Validate data structures with a schema + + Objects of this class are callable, with a single `data` argument. The data + is validated and returned if the `schema` packages is installed, or returned + if not. + """ + + + def __init__(self, schema_name): + """ + schema_name: the name of a class in benchcomp.schemas + """ + + try: + import benchcomp.schemas + klass = getattr(benchcomp.schemas, schema_name) + self.validate = klass()().validate + except ImportError: + self.validate = (lambda data: data) + + def __call__(self, data): + return self.validate(data) + + + +class ConfigFile(collections.UserDict): def __init__(self, path): super().__init__() @@ -76,27 +54,11 @@ def __init__(self, path): raise argparse.ArgumentTypeError( f"{path}: file not found") from exc - schema = yaml.safe_load(self._schema) + validate = _SchemaValidator("BenchcompYaml") try: - import cerberus - validate = cerberus.Validator(schema) - if not validate(data): - for error in validate._errors: - doc_path = "/".join(error.document_path) - msg = ( - f"config file '{path}': key " - f"'{doc_path}': expected " - f"{error.constraint}, got '{error.value}'") - if error.rule: - msg += f" (rule {error.rule})" - msg += f" while traversing {error.schema_path}" - logging.error(msg) - logging.error(validate.document_error_tree["variants"]) - raise argparse.ArgumentTypeError( - "failed to validate configuration file") - except ImportError: - pass - self.data = data + self.data = validate(data) + except BaseException as exc: + sys.exit(exc.code) @dataclasses.dataclass diff --git a/tools/benchcomp/requirements.txt b/tools/benchcomp/requirements.txt index 7f2c80e4e24f..b9666dbbaae5 100644 --- a/tools/benchcomp/requirements.txt +++ b/tools/benchcomp/requirements.txt @@ -1,2 +1,2 @@ -cerberus +schema pyyaml diff --git a/tools/benchcomp/test/unit/test_utils.py b/tools/benchcomp/test/unit/test_utils.py index 95c42b258d3e..15797d906960 100644 --- a/tools/benchcomp/test/unit/test_utils.py +++ b/tools/benchcomp/test/unit/test_utils.py @@ -43,4 +43,5 @@ def test_1(self): - variant_2 parser: module: test + visualize: [] """))) From b0be71f037e744ff8ead38cbee0bf89a792a2387 Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Fri, 7 Jul 2023 23:37:01 +0100 Subject: [PATCH 4/9] Fix error in build-docs.sh --- scripts/build-docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh index d308a64146f1..cddd0480954e 100755 --- a/scripts/build-docs.sh +++ b/scripts/build-docs.sh @@ -12,7 +12,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR if [ $(uname -m) = "arm64" ]; then - if ! $(which xmdbook >/dev/null 2>&1); then + if ! $(which mdbook >/dev/null 2>&1); then >&2 echo "Pre-built mdbook binaries for Apple ARM are not available." >&2 echo 'Run `cargo install mdbook` and try again.' exit 1 From e4d95b298ca5509371f4bafc13e051318518e50a Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Fri, 7 Jul 2023 23:37:54 +0100 Subject: [PATCH 5/9] Generate benchcomp documentation from schemas This commit adds the schema of benchcomp.yaml to the Kani book to document how benchcomp configuration files are written. The code will be used in future commits for documenting the parser and visualizer formats. --- docs/book.toml | 1 + docs/src/benchcomp-conf.md | 52 +++++++++++- docs/src/schema.css | 28 +++++++ docs/src/schema.jinja2.html | 62 ++++++++++++++ scripts/build-docs.sh | 2 + scripts/gen_format_schemas.py | 56 +++++++++++++ scripts/setup/ubuntu/install_doc_deps.sh | 7 ++ tools/benchcomp/benchcomp/schemas.py | 102 +++++++++++++++++++++++ tools/benchcomp/requirements.txt | 1 + 9 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 docs/src/schema.css create mode 100644 docs/src/schema.jinja2.html create mode 100755 scripts/gen_format_schemas.py create mode 100644 tools/benchcomp/benchcomp/schemas.py diff --git a/docs/book.toml b/docs/book.toml index b7cfc21b9b64..c8e7c39af559 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -12,6 +12,7 @@ multilingual = false site-url = "/kani/" git-repository-url = "https://github.com/model-checking/kani" edit-url-template = "https://github.com/model-checking/kani/edit/main/docs/{path}" +additional-css = ["src/schema.css"] [output.html.playground] runnable = false diff --git a/docs/src/benchcomp-conf.md b/docs/src/benchcomp-conf.md index 77236d0917bf..963cc1f55f21 100644 --- a/docs/src/benchcomp-conf.md +++ b/docs/src/benchcomp-conf.md @@ -1,8 +1,58 @@ # `benchcomp` configuration file `benchcomp`'s operation is controlled through a YAML file---`benchcomp.yaml` by default or a file passed to the `-c/--config` option. -This page lists the different visualizations that are available. +This section documents the top-level schema and the different visualizations +that are available. +## Configuration file + +The schema for `benchcomp.yaml` is shown below: + +{{#include ../gen_src/BenchcompYaml.md}} + +A minimal example of such a file is: + +```yaml +run: + suites: + suite_1: + parser: + command: ./parse_suite1.py + variants: + - suite_1_old + - suite_1_new + suite_2: + parser: + module: kani_perf + variants: + - suite_2_env + - suite_2_noenv +variants: + suite_1_old: + config: + command: ./scripts/run_benchmarks.sh + directory: suites/suite_1_old + env: {} + suite_1_new: + config: + command: ./scripts/run_benchmarks.sh + directory: suites/suite_1_new + env: {} + suite_2_env: + config: + command: make benchmarks + directory: suites/suite_2 + env: + RUN_FAST: "true" + suite_2_noenv: + config: + command: make benchmarks + directory: suites/suite_2 + env: {} +visualize: +- type: run_command + command: ./my_visualization.py +``` ## Built-in visualizations diff --git a/docs/src/schema.css b/docs/src/schema.css new file mode 100644 index 000000000000..dd8fc47d04bb --- /dev/null +++ b/docs/src/schema.css @@ -0,0 +1,28 @@ +/* Copyright Kani Contributors + * SPDX-License-Identifier: Apache-2.0 OR MIT + */ + +.schema_key { + font-weight: bold !important; + color: #d00 !important; +} +.schema_type { + color: #0a0 !important; + text-decoration: underline !important; +} +.schema_desc { + opacity: 35% !important; + margin-left: 1em !important; + font-style: italic !important; +} +.schema_comb { + color: #06d !important; +} +ul.schema li { + list-style: none !important; +} +ul.schema { + padding-left: 2em !important; + background-color: #00000005 !important; + border-left: solid 2px #00000005 !important; +} diff --git a/docs/src/schema.jinja2.html b/docs/src/schema.jinja2.html new file mode 100644 index 000000000000..25a42d55f72d --- /dev/null +++ b/docs/src/schema.jinja2.html @@ -0,0 +1,62 @@ +{# Copyright Kani Contributors #} +{# SPDX-License-Identifier: Apache-2.0 OR MIT #} + +{% if schema.type_name == "list" %} +
    + {% for sub_property in schema.iterate_properties %} +
  • - {{ sub_property.property_name }}
  • + {% endfor %} +
+{% endif %} + +{% if schema.type_name == "object" %} +
    + {% for sub_property in schema.iterate_properties %} + {% if sub_property.property_name %} +
  • + {% if sub_property.property_name == "_str" %} + {% set name = "string" %} + {% set type = "schema_type" %} + {% else %} + {% set name = sub_property.property_name %} + {% set type = "schema_key" %} + {% endif %} + + {% if name == sub_property.property_name %}"{% endif -%} + {{ name }} + {%- if name == sub_property.property_name %}"{% endif -%} + : + {% if sub_property.type_name != "object" %} + {% if name == sub_property.type_name %} + {{ name }} + {% endif %} + {{ sub_property.type_name }} + {% else %} + {% if name == sub_property.type_name %} + {{ name }}: + {% endif %} + {% endif %} + {{ sub_property.description }} +
  • + {% endif %} + {% with schema=sub_property %} + {% include "schema.jinja2.html" %} + {% endwith %} + {% endfor %} +
+{% endif %} + +{% if schema.kw_any_of%} +One of: + {% for sub_property in schema.kw_any_of.array_items %} + {% if sub_property.property_name %} +
  • + {{ sub_property.property_name }} + {{ sub_property.description }} +
  • + {% endif %} + {% with schema=sub_property %} + {% include "schema.jinja2.html" %} + {% endwith %} + {% endfor %} +{% endif %} diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh index cddd0480954e..0f2a58cc8527 100755 --- a/scripts/build-docs.sh +++ b/scripts/build-docs.sh @@ -63,6 +63,7 @@ echo "Building user documentation..." # Generate benchcomp documentation from source code mkdir -p gen_src "${SCRIPT_DIR}/gen_visualization_schemas.py" gen_src +"${SCRIPT_DIR}/gen_format_schemas.py" gen_src # Build the book into ./book/ mkdir -p book @@ -74,6 +75,7 @@ echo "Building RFC book..." cd $RFC_DIR ${MDBOOK} build -d $KANI_DIR/docs/book/rfc + # Testing of the code in the documentation is done via the usual # ./scripts/kani-regression.sh script. A note on running just the # doc tests is in README.md. We don't run them here because diff --git a/scripts/gen_format_schemas.py b/scripts/gen_format_schemas.py new file mode 100755 index 000000000000..3cc3e3d5b433 --- /dev/null +++ b/scripts/gen_format_schemas.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +# Copyright Kani Contributors +# SPDX-License-Identifier: Apache-2.0 OR MIT + +import inspect +import json +import pathlib +import sys +import tempfile + +import json_schema_for_humans as jsfh +import json_schema_for_humans.generation_configuration +import json_schema_for_humans.generate +import schema + +sys.path.append(str(pathlib.Path(__file__).parent.parent / "tools" / "benchcomp")) + +# autopep8: off +import benchcomp.schemas +# autopep8: on + + +def main(): + out_dir = pathlib.Path(sys.argv[1]).resolve() + out_dir.mkdir(exist_ok=True, parents=True) + + template = ( + pathlib.Path(__file__).parent.parent / + "docs/src/schema.jinja2.html").resolve() + config = jsfh.generation_configuration.GenerationConfiguration( + template_name="md", examples_as_yaml=True, with_footer=False, + copy_css=False, copy_js=False, custom_template_path=template) + + with tempfile.TemporaryDirectory() as tmpdir: + tmpdir = pathlib.Path(tmpdir) + for name, klass in inspect.getmembers(benchcomp.schemas): + if not inspect.isclass(klass): + continue + if name.startswith("_"): + continue + + s = schema.Schema(klass().get_raw_schema()["schema"]) + schema_docs = s.json_schema( + f"https://github.com/model-checking/kani/benchcomp/{name}") + + with open(tmpdir / f"{name}.json", "w") as handle: + print(json.dumps(schema_docs, indent=2), file=handle) + with open(f"/tmp/{name}.json", "w") as handle: + print(json.dumps(schema_docs, indent=2), file=handle) + + jsfh.generate.generate_from_filename( + tmpdir, out_dir / f"{name}.md", config=config) + + +if __name__ == "__main__": + main() diff --git a/scripts/setup/ubuntu/install_doc_deps.sh b/scripts/setup/ubuntu/install_doc_deps.sh index e3f4dd2c0d74..bafad3089688 100755 --- a/scripts/setup/ubuntu/install_doc_deps.sh +++ b/scripts/setup/ubuntu/install_doc_deps.sh @@ -6,3 +6,10 @@ set -eux cargo install mdbook-graphviz DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends --yes graphviz + +PYTHON_DEPS=( + json_schema_for_humans # Render a Draft-07 JSON schema to HTML + schema # Validate data structures +) + +python3 -m pip install "${PYTHON_DEPS[@]}" diff --git a/tools/benchcomp/benchcomp/schemas.py b/tools/benchcomp/benchcomp/schemas.py new file mode 100644 index 000000000000..6c786d0c3c38 --- /dev/null +++ b/tools/benchcomp/benchcomp/schemas.py @@ -0,0 +1,102 @@ +# Copyright Kani Contributors +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# Schemas for different file formats. Contained in a separate file so that +# validation is optional. + + +import textwrap + +import schema + + + +class _Schema: + + # This is to work around a problem with `schema` where it does not dump a + # sub-schema to JSON when it is a schema.Literal with a type (e.g. + # schema.Literal(str, ...). All subclasses of _Schema should use `_str` in + # place of `str`; this method will transform it to the correct type for + # validation. The documentation generator (which uses the JSON dumper) + # avoids doing this and renders the raw schema directly. + + def _replace_types(self, schema_dict): + if not isinstance(schema_dict, (dict, schema.Literal)): + return schema_dict + + if not isinstance(schema_dict, (dict, )): + if schema_dict.schema == "_str": + return schema.Literal(str, schema_dict.description) + return schema_dict + + tmp = {} + for k, v in schema_dict.items(): + if k == "_str": + tmp[str] = self._replace_types(v) + elif isinstance(k, (schema.Literal)): + if k.schema == "_str": + new_lit = schema.Literal(str, k.description) + tmp[new_lit] = self._replace_types(v) + else: + tmp[k] = self._replace_types(v) + else: + tmp[k] = self._replace_types(v) + return tmp + + + def __call__(self): + s = self.get_raw_schema() + name, description = s["name"], s["description"] + ret = self._replace_types(s["schema"]) + return schema.Schema(ret, name=name, description=description) + + + +class BenchcompYaml(_Schema): + def get_raw_schema(self): + return { + "schema": { + "run": { + schema.Literal("suites", description=( + "a collection of benchmarks in a directory")): { + schema.Literal("_str", description="ID for the suite"): { + schema.Literal("variants", description=( + "list of variant IDs to run for this suite")): [ str ], + schema.Literal("parser", description=textwrap.dedent( + "program used to read the results of a suite after the run.")): + schema.Or({ + schema.Literal("command", description=( + "path to an executable parser")): str + }, { + schema.Literal("module", description=( + "name of a parser module in benchcomp.parsers")): str + }) + }, + }, + }, + schema.Literal("variants", description=( + "configurations under which benchcomp will run the suites")): { + schema.Literal("_str", description="ID for the variant"): { + "config": { + schema.Literal("command_line", description=( + "command for running a suite using this variant")): str, + schema.Literal("directory", description=( + "path where this variant runs")): str, + schema.Optional(schema.Literal("env", description=( + "overrides for environment variables"))): { + schema.Literal("_str"): schema.Literal("_str"), + }, + }, + }, + }, + schema.Literal("visualize", description=textwrap.dedent("""\ + visualizations to apply to the result, see + built-in visualizations + below """)): [ + dict + ]}, + "name": "benchcomp.yaml", + "description": textwrap.dedent("""\ + A configuration file that controls how benchcomp runs and combines + the results of benchmark suites.""") + } diff --git a/tools/benchcomp/requirements.txt b/tools/benchcomp/requirements.txt index b9666dbbaae5..5740eef76b4e 100644 --- a/tools/benchcomp/requirements.txt +++ b/tools/benchcomp/requirements.txt @@ -1,2 +1,3 @@ schema +json-schema-for-humans pyyaml From f5f9118b9c02cacc6a9a11a07ea478f3f24f6f21 Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Mon, 10 Jul 2023 17:18:56 +0100 Subject: [PATCH 6/9] Only use one suite --- docs/src/benchcomp-conf.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/docs/src/benchcomp-conf.md b/docs/src/benchcomp-conf.md index 963cc1f55f21..dbe3df148cab 100644 --- a/docs/src/benchcomp-conf.md +++ b/docs/src/benchcomp-conf.md @@ -21,12 +21,6 @@ run: variants: - suite_1_old - suite_1_new - suite_2: - parser: - module: kani_perf - variants: - - suite_2_env - - suite_2_noenv variants: suite_1_old: config: @@ -38,17 +32,6 @@ variants: command: ./scripts/run_benchmarks.sh directory: suites/suite_1_new env: {} - suite_2_env: - config: - command: make benchmarks - directory: suites/suite_2 - env: - RUN_FAST: "true" - suite_2_noenv: - config: - command: make benchmarks - directory: suites/suite_2 - env: {} visualize: - type: run_command command: ./my_visualization.py From 8ffdaed41c1c96128226ed87cdfcfb53cb86a4f0 Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Mon, 10 Jul 2023 17:42:42 +0100 Subject: [PATCH 7/9] remove spurious blank line --- scripts/build-docs.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh index 0f2a58cc8527..0526d35bf132 100755 --- a/scripts/build-docs.sh +++ b/scripts/build-docs.sh @@ -75,7 +75,6 @@ echo "Building RFC book..." cd $RFC_DIR ${MDBOOK} build -d $KANI_DIR/docs/book/rfc - # Testing of the code in the documentation is done via the usual # ./scripts/kani-regression.sh script. A note on running just the # doc tests is in README.md. We don't run them here because From 7137231f3434e69e31b467cf1d3bfe6e9f740a1c Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Mon, 10 Jul 2023 17:48:04 +0100 Subject: [PATCH 8/9] Use more accessible/less garish colors --- docs/src/schema.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/schema.css b/docs/src/schema.css index dd8fc47d04bb..788949908d49 100644 --- a/docs/src/schema.css +++ b/docs/src/schema.css @@ -4,10 +4,10 @@ .schema_key { font-weight: bold !important; - color: #d00 !important; + color: #dc322f !important; } .schema_type { - color: #0a0 !important; + color: #6c71c4 !important; text-decoration: underline !important; } .schema_desc { @@ -16,7 +16,7 @@ font-style: italic !important; } .schema_comb { - color: #06d !important; + color: #268bd2 !important; } ul.schema li { list-style: none !important; From f6519de0ef42ff2f3e0ee583b05ea4fabf3fc02a Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Thu, 13 Jul 2023 09:32:06 +0100 Subject: [PATCH 9/9] Minor fixes --- scripts/gen_format_schemas.py | 12 ++++++++++-- tools/benchcomp/benchcomp/__init__.py | 2 +- tools/benchcomp/benchcomp/schemas.py | 3 +-- tools/benchcomp/requirements.txt | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/gen_format_schemas.py b/scripts/gen_format_schemas.py index 3cc3e3d5b433..390c743aa5f6 100755 --- a/scripts/gen_format_schemas.py +++ b/scripts/gen_format_schemas.py @@ -1,6 +1,16 @@ #!/usr/bin/env python3 # Copyright Kani Contributors # SPDX-License-Identifier: Apache-2.0 OR MIT +# +# Generate documentation for every public class in the `benchcomp.schemas` +# module. This script generates one Markdown file for each class; these Markdown +# files can then be included in the Kani book. +# +# The script first dumps the schema into JSON Draft-07 [1] format, and then used +# the json_schema_for_humans package to render that into Markdown. +# +# [1] https://json-schema.org/draft-07/json-schema-release-notes.html + import inspect import json @@ -45,8 +55,6 @@ def main(): with open(tmpdir / f"{name}.json", "w") as handle: print(json.dumps(schema_docs, indent=2), file=handle) - with open(f"/tmp/{name}.json", "w") as handle: - print(json.dumps(schema_docs, indent=2), file=handle) jsfh.generate.generate_from_filename( tmpdir, out_dir / f"{name}.md", config=config) diff --git a/tools/benchcomp/benchcomp/__init__.py b/tools/benchcomp/benchcomp/__init__.py index 0d0ead2d77aa..8cc9583d9bdd 100644 --- a/tools/benchcomp/benchcomp/__init__.py +++ b/tools/benchcomp/benchcomp/__init__.py @@ -20,7 +20,7 @@ class _SchemaValidator: """Validate data structures with a schema Objects of this class are callable, with a single `data` argument. The data - is validated and returned if the `schema` packages is installed, or returned + is validated and returned if the `schema` package is installed, or returned if not. """ diff --git a/tools/benchcomp/benchcomp/schemas.py b/tools/benchcomp/benchcomp/schemas.py index 6c786d0c3c38..2708c692c9db 100644 --- a/tools/benchcomp/benchcomp/schemas.py +++ b/tools/benchcomp/benchcomp/schemas.py @@ -46,9 +46,8 @@ def _replace_types(self, schema_dict): def __call__(self): s = self.get_raw_schema() - name, description = s["name"], s["description"] ret = self._replace_types(s["schema"]) - return schema.Schema(ret, name=name, description=description) + return schema.Schema(ret, name=s["name"], description=s["description]") diff --git a/tools/benchcomp/requirements.txt b/tools/benchcomp/requirements.txt index 5740eef76b4e..6c344fa3c238 100644 --- a/tools/benchcomp/requirements.txt +++ b/tools/benchcomp/requirements.txt @@ -1,3 +1,3 @@ -schema json-schema-for-humans pyyaml +schema