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 #262: JSONErrorsMixin not returning correct results #263

Merged
merged 1 commit into from
Oct 31, 2017

Conversation

kevin-bates
Copy link
Member

After Notebook 5.2.0 is installed, JSONErrorsMixin.write_error is
used to convert errors into JSON responses. Previously, Notebook's
@json_errors decorator performed this action. Since the decorator's
replacement, APIHandler.write_error, doesn't adequately set the
reason field, other tests fail so its not sufficient to drop the
use of JSONErrorsMixin. As a result, JSONErrorsMixin now incorporates
the appropriate code from APIHandler.write_error (in particular the
setting of the traceback field) - in addition to appropriately
setting the reason field. This mixin should continue to be used
in the handler class hierachy until APIHandler is fixed.

I have tested these changes with Notebook 5.1.0 and 5.2.0 installed.

Fixes #262.

After Notebook 5.2.0 is installed, JSONErrorsMixin.write_error is
used to convert errors into JSON responses.  Previously, Notebook's
`@json_errors` decorator performed this action. Since the decorator's
replacement, `APIHandler.write_error`, doesn't adequately set the
`reason` field, other tests fail so its not sufficient to drop the
use of JSONErrorsMixin.  As a result, JSONErrorsMixin now incorporates
the appropriate code from `APIHandler.write_error` (in particular the
setting of the `traceback` field) - in addition to appropriately
setting the `reason` field.  This mixin should continue to be used
in the handler class hierachy until `APIHandler` is fixed.

I have tested these changes with Notebook 5.1.0 and 5.2.0 installed.
@rolweber
Copy link
Contributor

I currently don't have time to dig deeper into the problem, but I had a look at the diff, and it looks good.

@parente
Copy link
Contributor

parente commented Oct 21, 2017

Thanks for digging into this issue. It's not the first time we've found we've found an incompatibility with new notebook versions because KG is definitely touches more than the public API of the notebook server.

Is notebook>=5.2.0 now a requirement after this patch goes in? Or will it work with notebook 5.0 and up? I'm asking to see if we need to (1) bump the required minimum notebook version to 5.2 now and (2) see if this should be a patch release or a minor release, assuming we're sticking with semantic versioning.

@kevin-bates
Copy link
Member Author

Hi @parente. No, this update doesn't introduce any dependency change on notebook versions. When notebook 5.1.0 (or less) is in play @json_errors builds the json exceptions, while with notebook 5.2.0, the JSONErrorsMixin builds the exception. All nosetests pass with this change and either version of notebook.

In addition, once the notebook issue with APIHandler.write_error is fixed (to set the reason field), then JSONErrorsMixin could be removed as a subclass on the various JKG handlers. The tests that call the mixin directly could either be removed or the class could remain (not sure if its needed at that point).

@parente parente merged commit d1b7d9a into jupyter-server:master Oct 31, 2017
@parente
Copy link
Contributor

parente commented Oct 31, 2017

Sorry for the delay on this one. I can work on backporting this to the 2.0.x branch to cut a 2.0.2 release with it soon.

@kevin-bates kevin-bates deleted the fix-262-jsonerrorsmixin branch October 31, 2017 15:45
@rolweber
Copy link
Contributor

rolweber commented Nov 9, 2017

@parente: Can you find some time for cutting a new release?

@parente
Copy link
Contributor

parente commented Nov 11, 2017

@rolweber @kevin-bates I've tagged 2.0.2 and pushed a release to pypi.

@kevin-bates
Copy link
Member Author

@parente - thank you! Does something similar need to happen for anaconda envs? (Sorry, total newbie to this python stuff). Since our tests run via anaconda envs it still looks like they're picking up 2.0.1 from conda-forge.

jupyter_kernel_gateway:             2.0.1-py_0         conda-forge

@parente
Copy link
Contributor

parente commented Nov 15, 2017

@kevin-bates Indeed. I'll cc on the PR over in the conda-forge feedstock.

@kevin-bates
Copy link
Member Author

Awesome. Thank you @parente!

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.

JSONErrorsMixin not returning correct results after Notebook 5.2.0 is installed
3 participants