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

Readd compatibility with jsonschema<4.18 (for easier deployment in spack) #243

Merged
merged 2 commits into from
Nov 9, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Changelog
=========

Version v2.0.2
--------------

Improvements
~~~~~~~~~~~~
- Readded compatibility with ``jsonschema<4.18``


Version v2.0.1
--------------

Bug Fixes
~~~~~~~~~
- Fixed pylint ``cyclic-import`` issues
- Fixed docstrings of ``Nodes.get``, ``Edges.get``
- Added basic testing to ``_plotting.py``


Version v2.0.0
--------------

Expand Down Expand Up @@ -28,9 +46,11 @@ Bug Fixes
Breaking Changes
~~~~~~~~~~~~~~~~
- ``nodes.get`` and ``edges.get`` (and ``network.get``) no longer return a dataframe

- returns a generator yielding tuples of ``(<population_name>, <dataframe>)`` instead
- to get the previous behavior (all in one dataframe): ``pd.concat(df for _, df in circuit.nodes.get(*args, **kwargs))``
- Removed ``Network.property_dtypes``, ``CircuitIds.index_schema``

- ``Circuit.node_sets``, ``Simulation.node_sets`` returns ``NodeSets`` object initialized with empty dict when node sets file is not present
- ``NodeSet.resolved`` is no longer available
- ``FrameReport.node_set`` returns node_set name instead of resolved node set query
Expand Down
9 changes: 2 additions & 7 deletions bluepysnap/schemas/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import importlib_resources
import jsonschema
import numpy as np
import referencing
import yaml

from bluepysnap.exceptions import BluepySnapValidationError
Expand Down Expand Up @@ -217,7 +216,7 @@ def _resolve_types(resolver, types):

def _resolve_type(type_):
if type_ not in cache:
type_ = resolver.lookup(type_).contents["properties"]["datatype"]["const"]
type_ = resolver.resolve(type_)[1]["properties"]["datatype"]["const"]
if hasattr(np, type_):
cache[type_] = getattr(np, type_)
elif type_ == "utf-8":
Expand All @@ -230,11 +229,7 @@ def _resolve_type(type_):

def _get_reference_resolver(schema):
"""Get reference resolver for the given schema."""
resource = referencing.Resource(
contents=schema,
specification=referencing.jsonschema.DRAFT202012,
)
return referencing.Registry().with_resource("", resource=resource).resolver()
return jsonschema.validators.RefResolver("", schema)


def nodes_schema_types(nodes_type):
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def __init__(self, *args, **kwargs):
"cached_property>=1.0",
"h5py>=3.0.1,<4.0.0",
"importlib_resources>=5.0.0",
"jsonschema>=4.18.0,<5.0.0",
"referencing>=0.28.4",
"jsonschema>=4.0.0,<5.0.0",
"libsonata>=0.1.24,<1.0.0",
"morphio>=3.0.0,<4.0.0",
"morph-tool>=2.4.3,<3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def test__get_reference_resolver():
expected = {"const": "test_value"}
schema = {"$mock_reference": expected}
resolver = test_module._get_reference_resolver(schema)
assert resolver.lookup("#/$mock_reference").contents == expected
assert resolver.resolve("#/$mock_reference")[1] == expected


def test_nodes_schema_types():
Expand Down