Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jsonschema as a hard dependency #159

Merged
merged 2 commits into from Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions dice_ml/counterfactual_explanations.py
@@ -1,4 +1,5 @@
import json
import jsonschema
import os

from dice_ml.diverse_counterfactuals import CounterfactualExamples
Expand Down Expand Up @@ -124,11 +125,7 @@ def _check_cf_exp_output_against_json_schema(
with open(schema_path, 'r') as schema_file:
schema_json = json.load(schema_file)

try:
import jsonschema
jsonschema.validate(cf_dict, schema_json)
except ImportError:
pass
jsonschema.validate(cf_dict, schema_json)

def to_json(self):
""" Serialize Explanations object to json.
Expand Down
9 changes: 4 additions & 5 deletions requirements-test.txt
@@ -1,10 +1,9 @@
flake8
flake8-nb
ipython
jupyter
nbformat
pytest
pytest-cov
twine
ipython
jsonschema
nbformat
jupyter
pytest-mock
pytest-mock
1 change: 1 addition & 0 deletions requirements.txt
@@ -1,3 +1,4 @@
jsonschema
numpy # if you are using tensorflow 1.x, it requires numpy<=1.16
pandas
scikit-learn
Expand Down