-
-
Notifications
You must be signed in to change notification settings - Fork 590
Make better loop performance more intuitive #310
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
Conversation
It's failing on this error with building the docs:
Anyone already familiar with what's causing that error? |
8bf6968
to
c2c0dc7
Compare
Had to make 2 changes to make tests pass:
|
Hi! Thanks for the PR! Cherry picked the docfix immediately, I noticed it yesterday but hadn't had a chance to fix it yet. Appreciated. The travis change though drops builds (the docs and style ones), so can't take that one -- I'd prefer to just actually install the newer pypy3 as a command (or to pin pip for that build in tox.ini, but knowing how long travis takes to merge in new interpreters that way is probably not the best.) Same for running coverage on tests -- you specifically do want to run coverage on tests files, it finds test bugs, like ones where you accidentally named two tests the same thing. As for the actual core thing here -- I'm not sure I like the idea of adding yet a third way to validate things. Can you elaborate on
why would a new user find it more difficult to learn that API than this one? (Thanks again regardless, definitely appreciate the fixes + discussion) |
9544d1d
to
d80ce25
Compare
d80ce25
to
6a817f0
Compare
I removed the commit for removing test coverage on the tests and fixed the name of that test. I learned you can made it so tox-travis still builds docs and do style checking in the environments you choose using the
That's based on my own experience. I didn't realize each call of Using Draft4Validator (or the new schema class) directly is a big performance improvement when you're running validate with the same schema multiple times. It took 10 loops of validate X 1000 from taking 4.1 secs to only taking 0.16 secs. Also, there are a few other popular parsing libraries that have this same sort of intuitive Schema class syntax: |
Now it's running style checking for both python 2.7 and 3.5, and to get the style checking test to pass in 3.5 I had to make this change: bf1962f |
It seems like the issue then is more about discoverability of where to go after |
0f344a69 Merge pull request #313 from leadpony/issue309 46c44747 Replace the control escape \\a with \\t 1ffe03e5 Merge pull request #312 from gregsdennis/master de004798 better descripttions eea7f249 arrays have characters too 7c02d06d added unevaluatedProperties test file; resolves #310 1899a5aa Merge pull request #308 from aznan2/master 4a5010b3 Update the version list. 37569b13 issue #307 - made test compatible with draft4 e3087307 issue #307 - removed issue reference from description e13d3275 issue #307 - removed pound sign from description a3b9f723 issue #307 - test that oneOf handles missing optional property git-subtree-dir: json git-subtree-split: 0f344a698f6657441adf4ebf4ceeacd596683422
This PR adds a
Schema
class to be used like:When the
Schema
object is initialized, it will check if the schema is valid and will initialize the validator class. This allows you to initialize the validator and check the schema only once, instead of doing it each timevalidate
is called.The goal is to make it a lot more intuitive for new users to get better performance in loops or web application endpoints without needing to learn about
Draft4Validator.validate()
and why it's faster. It's also a better alternative to directly usingDraft4Validator.validate()
because it will still validate the schema.Here's a gist I was using to benchmark: https://gist.github.com/pawl/382c655f31dad631ab29775a6c8cad05