From c8553d1e52a2900b70886f860db51de1d427db37 Mon Sep 17 00:00:00 2001
From: Alexander Kreft <akreft@trineo.org>
Date: Tue, 5 Oct 2021 16:27:38 +0200
Subject: [PATCH] ENH: Make jsonschema optional

---
 README_SETUP.md | 11 +++++++++++
 setup.py        |  7 ++++---
 tox.ini         |  1 +
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/README_SETUP.md b/README_SETUP.md
index 9da54839..df073270 100644
--- a/README_SETUP.md
+++ b/README_SETUP.md
@@ -11,6 +11,10 @@ typically be installed automatically):
 - `PyYaml`
 - `PySocks`
 
+Optional packages:
+- `keyring`
+- `jsonschema`
+
 ### How to install ###
 
 #### Linux ####
@@ -66,6 +70,13 @@ cd caosdb-pylib
 pip3 install --user .
 ```
 
+For installation of optional packages, install with an additional option, e.g. for 
+validating with the caosdb json schema:
+
+```sh
+pip3 install --user .[jsonschema]
+```
+
 ## Configuration ##
 
 The  configuration is done using `ini` configuration files.
diff --git a/setup.py b/setup.py
index dfc13a11..d0e12f1a 100755
--- a/setup.py
+++ b/setup.py
@@ -158,10 +158,11 @@ def setup_package():
         python_requires='>=3.6',
         package_dir={'': 'src'},
         install_requires=['lxml>=3.6.4',
-                          'PyYaml>=3.12', 'future', 'PySocks>=1.6.7', 'jsonschema'],
-        extras_require={'keyring': ['keyring>=13.0.0']},
+                          'PyYaml>=3.12', 'future', 'PySocks>=1.6.7'],
+        extras_require={'keyring': ['keyring>=13.0.0'],
+                        'jsonschema': ['jsonschema==4.0.1']},
         setup_requires=["pytest-runner>=2.0,<3dev"],
-        tests_require=["pytest", "pytest-cov", "coverage>=4.4.2", "jsonschema"],
+        tests_require=["pytest", "pytest-cov", "coverage>=4.4.2", "jsonschema==4.0.1"],
         package_data={
             'caosdb': ['cert/indiscale.ca.crt', 'schema-pycaosdb-ini.yml'],
         },
diff --git a/tox.ini b/tox.ini
index 94c2dc8a..22c89f76 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,4 +7,5 @@ deps = .
     nose
     pytest
     pytest-cov
+    jsonschema==4.0.1
 commands=py.test --cov=caosdb -vv {posargs}
-- 
GitLab