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

fix: Base URI for jsonschema.RefResolver has better behavior #1976

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

kratsg
Copy link
Contributor

@kratsg kratsg commented Aug 31, 2022

Pull Request Description

jsonschema has traditionally been not the greatest with resolving references. More recent development has definitely aimed to improve this behavior (thanks to @Julian) and it seems it highlighted an issue with how we defined our RefResolver. This PR moves the version up to the baseuri instead of being part of the document name.

Resolves #1975.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* update baseuri to include the version of the HiFa JSON schema to provide forward-compatibility for jsonschema>=4.15.0

@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Base: 98.24% // Head: 98.24% // No change to project coverage 👍

Coverage data is based on head (e406547) compared to base (9842e82).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1976   +/-   ##
=======================================
  Coverage   98.24%   98.24%           
=======================================
  Files          68       68           
  Lines        4378     4378           
  Branches      726      726           
=======================================
  Hits         4301     4301           
  Misses         45       45           
  Partials       32       32           
Flag Coverage Δ
contrib 26.58% <ø> (ø)
doctest 60.57% <ø> (ø)
unittests-3.10 96.13% <ø> (ø)
unittests-3.7 96.12% <ø> (ø)
unittests-3.8 96.16% <ø> (ø)
unittests-3.9 96.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pyhf/schema/validator.py 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kratsg kratsg merged commit 925769a into master Aug 31, 2022
@kratsg kratsg deleted the fix/jsonschemaBaseURIChanges branch August 31, 2022 20:57
@kratsg
Copy link
Contributor Author

kratsg commented Aug 31, 2022

I'm going to go ahead and use my admin powers to merge this in so we fix up the main branch.

@matthewfeickert
Copy link
Member

matthewfeickert commented Sep 2, 2022

@kratsg this is breaking the Minimum supported dependencies workflow.

def test_schema_changeable(datadir, monkeypatch, self_restoring_schema_globals):

and

def test_schema_changeable_context(datadir, monkeypatch, self_restoring_schema_globals):

are now failing (c.f. https://github.com/scikit-hep/pyhf/runs/8148172028?check_suite_focus=true).

I'll see if I can identify the version of jsonschema we'll need to bump

pyhf/setup.cfg

Line 41 in 925769a

jsonschema>=3.0.0 # for utils

and

jsonschema==3.0.0

to.

edit: I'm assuming it is v4.15.0 given https://github.com/orgs/python-jsonschema/discussions/995 (thanks for opening it).

kratsg pushed a commit that referenced this pull request Sep 2, 2022
… v1.4.0 (#1979)

* Update lower bound of the supported jsonschema versions to v4.15.0 to use the
  required improvements to jsonschema.RefResolver used in PR #1976.
   - c.f. https://github.com/orgs/python-jsonschema/discussions/995
   - Amends PR #1976.
* Update lower bound of the supported importlib-resources versions to v1.4.0 as
  > jsonschema 4.15.0 depends on importlib-resources>=1.4.0; python_version < "3.9"
* Update tests/constraints.txt to use jsonschema==4.15.0 and importlib_resources==1.4.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jsonschema RefResolutionError for 0.6.3 or lower
2 participants