-
Notifications
You must be signed in to change notification settings - Fork 57
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
Vendorize jsonschema #1591
Merged
braingram
merged 12 commits into
asdf-format:main
from
braingram:vendorize_jsonschema_w_tests
Aug 7, 2023
Merged
Vendorize jsonschema #1591
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
caf5a07
add jsonschema 4.17.3 to asdf/_jsonschema
braingram 61ea88d
remove a few remaining uses of installed jsonschema
braingram d2251df
remove pyrsistent usage in jsonschema
braingram ec107b6
remove automatic http fetching in jsonschema
braingram 847f2f5
add __slots__ to asdf.schema._ValidationContext
braingram 483b588
update changelog
braingram 20725df
add missing file
braingram 276dd57
add top level licenses directory
braingram 14d659a
add what's new page to docs
braingram 391827c
unskip ValidationError in asdf.exceptions docs
braingram 20f97fa
fix licenses folder link
braingram ef8821f
allow ValidationError doc generation
braingram File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,6 @@ build | |
eggs | ||
.eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2013 Julian Berman | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
The files in this directory were originally cloned from | ||
|
||
jsonschema 4.17.3 | ||
|
||
https://github.com/python-jsonschema/jsonschema/releases/tag/v4.17.3 | ||
|
||
See COPYING for use restrictions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
""" | ||
An implementation of JSON Schema for Python | ||
|
||
The main functionality is provided by the validator classes for each of the | ||
supported JSON Schema versions. | ||
|
||
Most commonly, `asdf._jsonschema.validators.validate` is the quickest way to simply | ||
validate a given instance under a schema, and will create a validator | ||
for you. | ||
""" | ||
import warnings | ||
|
||
from asdf._jsonschema._format import FormatChecker | ||
from asdf._jsonschema._types import TypeChecker | ||
from asdf._jsonschema.exceptions import ( | ||
ErrorTree, | ||
FormatError, | ||
RefResolutionError, | ||
SchemaError, | ||
ValidationError, | ||
) | ||
from asdf._jsonschema.protocols import Validator | ||
from asdf._jsonschema.validators import ( | ||
Draft3Validator, | ||
Draft4Validator, | ||
Draft6Validator, | ||
Draft7Validator, | ||
Draft201909Validator, | ||
Draft202012Validator, | ||
RefResolver, | ||
validate, | ||
) | ||
|
||
|
||
def __getattr__(name): | ||
format_checkers = { | ||
"draft3_format_checker": Draft3Validator, | ||
"draft4_format_checker": Draft4Validator, | ||
"draft6_format_checker": Draft6Validator, | ||
"draft7_format_checker": Draft7Validator, | ||
"draft201909_format_checker": Draft201909Validator, | ||
"draft202012_format_checker": Draft202012Validator, | ||
} | ||
ValidatorForFormat = format_checkers.get(name) | ||
if ValidatorForFormat is not None: | ||
warnings.warn( | ||
f"Accessing asdf._jsonschema.{name} is deprecated and will be " | ||
"removed in a future release. Instead, use the FORMAT_CHECKER " | ||
"attribute on the corresponding Validator.", | ||
DeprecationWarning, | ||
stacklevel=2, | ||
) | ||
return ValidatorForFormat.FORMAT_CHECKER | ||
|
||
raise AttributeError(f"module {__name__} has no attribute {name}") |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to include this in a more obvious location, something along the lines of astropy's top-level licenses directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a great question. I never looked at the atropy top-level licenses (thanks for mentioning it!).
I stuck it in the source directory so that it would be packaged with the source (I'm not sure if this is necessary but it does seem like it should satisfy the requirement that the "copyright notice and this permission notice shall be included in all copies or substantial portions of the Software".
It doesn't appear that astropy packages the licenses they include in the top-level folder (looking at the
DataTables
license it mentions copyright byAllan Jardine
and I find no mention of that name in the installed package).What do you think about mentioning (perhaps in the README) that the vendorized jsonschema is subject to copyright and use restrictions by the license found in the
_jsonschema_
submodule (or hopefully something more elegantly worded). I don't see a license notice at the moment so perhaps adding it to the end of the README and also mentioning the broader license in LICENSE?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a good solution. I suspect people who are concerned about licenses are apt to look in the repo root but may not realize they need to drill down into other directories. A obvious pointer of some kind to nested license file would do the trick (could even check in a soft link?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a top level licenses directory with soft links to the included licenses (good idea!) and a link in the readme.