Skip to content

Commit

Permalink
Merge pull request #1614 from braingram/drop_jsonschema
Browse files Browse the repository at this point in the history
Drop jsonschema
  • Loading branch information
braingram authored Sep 18, 2023
2 parents e2cdf60 + dca4f21 commit 3719a8e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The ASDF Standard is at v1.6.0
- Convert numpy scalars to python types during yaml encoding
to handle NEP51 changes for numpy 2.0 [#1605]
- Vendorize jsonschema 4.17.3 [#1591]
- Drop jsonschema as a dependency [#1614]

2.15.0 (2023-03-28)
-------------------
Expand Down
41 changes: 15 additions & 26 deletions asdf/_jsonschema/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
WEAK_MATCHES: frozenset[str] = frozenset(["anyOf", "oneOf"])
STRONG_MATCHES: frozenset[str] = frozenset()

try:
from jsonschema.exceptions import _unset
except ImportError:
_unset = _utils.Unset()
_unset = _utils.Unset()


class _Error(Exception):
Expand Down Expand Up @@ -161,16 +158,13 @@ def _matches_type(self):
)


try:
from jsonschema import ValidationError
except ImportError:
class ValidationError(_Error):
"""
An instance was invalid under a provided schema.
"""
class ValidationError(_Error):
"""
An instance was invalid under a provided schema.
"""

_word_for_schema_in_error_message = "schema"
_word_for_instance_in_error_message = "instance"
_word_for_schema_in_error_message = "schema"
_word_for_instance_in_error_message = "instance"


class SchemaError(_Error):
Expand All @@ -182,21 +176,16 @@ class SchemaError(_Error):
_word_for_instance_in_error_message = "schema"


try:
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
from jsonschema import RefResolutionError
except ImportError:
@attr.s(hash=True)
class RefResolutionError(Exception):
"""
A ref could not be resolved.
"""
@attr.s(hash=True)
class RefResolutionError(Exception):
"""
A ref could not be resolved.
"""

_cause = attr.ib()
_cause = attr.ib()

def __str__(self):
return str(self._cause)
def __str__(self):
return str(self._cause)


class UndefinedTypeCheck(Exception):
Expand Down
2 changes: 1 addition & 1 deletion docs/asdf/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ a schema, which can then be used to validate a file:
>>> af.validate()
Traceback (most recent call last):
...
jsonschema.exceptions.ValidationError: 'foo' is a required property
asdf._jsonschema.exceptions.ValidationError: 'foo' is a required property
...
>>> af["foo"] = "bar"
>>> af.validate()
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ dependencies = [
# for vendorized jsonschema
"attrs>=20.1.0",
# end of vendorized jsonschema deps
# include jsonschema for all the downstream packages expecting us to provide this
"jsonschema>=4.8",
]
[project.optional-dependencies]
all = [
Expand Down
2 changes: 0 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ git+https://github.com/asdf-format/asdf-unit-schemas.git
git+https://github.com/asdf-format/asdf-wcs-schemas
git+https://github.com/astropy/astropy
#git+https://github.com/yaml/pyyaml.git
# jsonschema 4.18 contains incompatible changes: https://github.com/asdf-format/asdf/issues/1485
#git+https://github.com/python-jsonschema/jsonschema

numpy>=0.0.dev0
scipy>=0.0.dev0

0 comments on commit 3719a8e

Please sign in to comment.