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

non GPL format option #619

Merged
merged 4 commits into from
Nov 8, 2019
Merged

Conversation

naimetti
Copy link
Contributor

@naimetti naimetti commented Oct 23, 2019

The format extra includes two libs (rfc3987 and strict_rfc3339) that are distributed under GPL licence, which renders jsonschema package to GPL, althought it is licensed under an MIT-like license.

To get rid of these two GPL libs dependencies I have implemented the uri, uri-reference, and date-time validators built-in in the lib, and added the format_nongpl extra to add format validators dependencies without rfc3987 and strict-rfc3339.

An older pull request (#261) suggest using rfc3986 to replace rfc3987, but I have found the RFC3986 validation poorly implemented in that lib.

I have taken the idea to add the new extra in order to maintain backward compatibility from this comment

Docs are still pending upon discussion about this pull request.

Note: the iri and iri-reference validators provided by rfc3987 are not implemented in this pull request.

@Julian
Copy link
Member

Julian commented Oct 24, 2019

Hi, thanks a lot for trying to tackle this!

I'm definitely still open to the idea of having non-GPL implementations available.

On the other hand though I don't want to maintain those here in this library -- (I actually don't want to maintain any format related code :) GPL or otherwise).

Meaning -- if you want to create libraries that essentially contain each of these pieces of functionality, and promise to maintain them (or obviously find existing such libraries :) then I'm happy to depend on those, but yeah I can't be maintaining huge monstrous regexes here within this library.

Hopefully that makes sense enough, but happy to hear your thoughts.

@naimetti
Copy link
Contributor Author

Hi, Julian! Thank you for your prompt response.

It makes sense to me. I will create two separate libraries (validate-rfc3339 and validate-rfc3986) and refactor the PR code to use both libraries. In fact, when I was developing the validators I created them as two different projects with their UT and all, so I think it will be the best approach.

@naimetti
Copy link
Contributor Author

naimetti commented Oct 24, 2019

If you have any other suggestions I am eager to hear them.

@Julian
Copy link
Member

Julian commented Oct 24, 2019

Cool! Let me have a more careful review (likely will be tomorrow) and will probably have a few other comments yeah.

And thanks again!

@naimetti
Copy link
Contributor Author

Hi again, @Julian !
I have created two separate modules (rfc3339-validator and rfc3986-validator) to implement the validations and refactored the code to use them if these libs are present instead of strict_rfc3339 and rfc3987.
In the unit test of both repos I've have include code to compare the behavior of the new code with the GPL versions libs used by jsconschema.

Copy link
Member

@Julian Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, well done!

I assume you're willing to also maintain those going forward hopefully right (i.e. triage issues)? (With no hard commitment, it's open source hooray...)

Also -- did you happen to check all the transitive dependencies (of everything) to ensure the non-GPL one really doesn't pull in any non-GPL code beyond just the direct format dependencies?

The only other thing left is probably just modifying the section of the docs on format: https://python-jsonschema.readthedocs.io/en/stable/validate/#jsonschema.FormatError

Do you think you could take a stab at adding a sentence or two there about the bare vs. non-GPL options, and modifying that table?

I have a sneaky suspicion we maybe should mention something like "the non-GPL extra is intended to not install any direct dependencies that are non-GPL [but that of course end-users should do their own verification], and that this may mean some formats are unavailable" or some such, whereas the bare extra will install as much functionality as is available anywhere.

jsonschema/_format.py Outdated Show resolved Hide resolved
jsonschema/_format.py Outdated Show resolved Hide resolved
@naimetti
Copy link
Contributor Author

I assume you're willing to also maintain those going forward hopefully right (i.e. triage issues)? (With no hard commitment, it's open source hooray...)

Yes, I am willing to also maintain these libs. No problem with that at all.

Also -- did you happen to check all the transitive dependencies (of everything) to ensure the non-GPL one really doesn't pull in any non-GPL code beyond just the direct format dependencies?

I've checked and the only two dependencies with MIT incompatible licenses are rfc3987 and strict_rfc3339.

I have also solved the style issues and added some words about these changes in the docs.

@naimetti naimetti marked this pull request as ready for review October 31, 2019 22:35
@codecov
Copy link

codecov bot commented Oct 31, 2019

Codecov Report

Merging #619 into master will decrease coverage by 0.66%.
The diff coverage is 9.52%.

@@            Coverage Diff            @@
##           master    #619      +/-   ##
=========================================
- Coverage   96.16%   95.5%   -0.67%     
=========================================
  Files          18      18              
  Lines        2451    2468      +17     
  Branches      306     309       +3     
=========================================
  Hits         2357    2357              
- Misses         79      95      +16     
- Partials       15      16       +1

@naimetti
Copy link
Contributor Author

About the coverage reports, I don't know exactly what could we do to test both format and format-nongpl at the same time. Maybe using some environment variables to set the lib preference for the checkers could do the trick to run the unit tests for the gpl and the non-gpl code together.

@Julian
Copy link
Member

Julian commented Nov 3, 2019

Thanks! Awesome, think this probably is ready to merge, gonna take one last look first.

The coverage thing -- yeah that's something that's "broken" even before this, e.g. we should really be combining coverage across Py2+Py3 too to get the right unioned number, so I don't think that needs to hold this change specifically back, you're right, really we should union the format+formatNonGPL extras probably too.

@Julian Julian merged commit f7ea84d into python-jsonschema:master Nov 8, 2019
@Julian
Copy link
Member

Julian commented Nov 8, 2019

Merged! Thanks again.

@naimetti
Copy link
Contributor Author

naimetti commented Nov 8, 2019

Glad to help!
When I have some time I'll try to add support for rfc3987 too.
Thank you!

@nicola-lunghi
Copy link

@naimetti thanks this is really useful

to have this is enough to include the patches:

  • 10f8a3e Add format validators as separate modules
  • af37707 non GPL format option
    ???
    There's still something missing?
    @Julian are you going to do a new release soon to include those changes ? -> I am preaparing to update a recipe in yocto to add this so I can wait for a release if its not too far away)

@Julian
Copy link
Member

Julian commented Nov 14, 2019

Probably in the next 4-5 days yeah.

@naimetti
Copy link
Contributor Author

to have this is enough to include the patches:

  • 10f8a3e Add format validators as separate modules
  • af37707 non GPL format option
    ???

I think these two commits are enought.

Julian added a commit that referenced this pull request Dec 19, 2022
6b3cac42b Merge pull request #624 from json-schema-org/gregsdennis/propertyDependencies-fixups
ef6fb9981 update unevaluatedProperties test to define foo with properties
19130148b add definition for expectedTypes
197cb33ad fixed propertyDependencies $schema & $id; removed invalid test cases
a390e321b Merge pull request #619 from json-schema-org/gregsdennis/output-tests
b538fe75a Bump the validator version used for suite sanity checks.
c26440107 Blacked.
8ee43236d add some more detail in readme; add redundant keyword to some tests
c88355294 absoluteKeywordLocation is not required when there is no `$ref`
1a860cfb2 added $id to all output schemas; reindexed test cases to 0 (instead of 1)
930e87e77 add clarification on no changes between 2019 and 2020
f5197e087 Fix the output check to ignore output-schema.json.
a8b280571 Minor style tweaks.
3413863a7 Inline the relevant parts of the test schema to output tests.
dc6e82046 Merge remote-tracking branch 'origin/main' into gregsdennis/output-tests
b1267590c Update bin/jsonschema_suite
b40a6cacb Update bin/jsonschema_suite
691d039c1 update $dynamic* value in schemas
d263bf014 add blank lines at the end of all the files
daf42a748 attempt to update ci for output tests
46bc7ace4 add readme note about output-schema.json files
efeee1d4e update tests to reference output schemas
147df4867 add output schemas
fe25ba954 updated readme; fixed $schema typo; tests for 2020-12
87c184d20 add .editorconfig; rearrange folders
e9f540020 initial run at creating output tests

git-subtree-dir: json
git-subtree-split: 6b3cac42b95196783d628182061a4e235b109b66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants