-
Notifications
You must be signed in to change notification settings - Fork 561
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
Add kernel-specific templates #336
Conversation
Kernel specific templates is something that probably requires more discussion, and I'd be happier if that was separate from the purely mechanistic change of removing caching. It's probably fine to get rid of caching; the caching design itself was a rationalisation of a buggy stateful API. However, our test suite is unlikely to be a good performance test. In particular, if you're always initialising a new Exporter, there's self-evidently no benefit to caching. So I'd like to see some comparisons with an exporter initialised once and then reused many times. If we have to read the template file again each time, it may be meaningful to keep the cache. Jinja appears to have its own cache of templates, but that's on the environment, so if we recreate the environment each time as well, we can't use that. |
we could just cache the environments. and tbh, i mainly removed the caching because i couldn’t get it to work with per-kernel templates. something really weird goes on there |
uuh, this test failure is really weird, can anyone shed light on it? |
I've prodded it to rerun in case it was a sporadic failure. |
And it seems it was. |
oo, how to rerun without closing and reopening again? |
Travis has a button to do it, but it's only available if you have push access to the repo. |
OK, wtf? it says it uses the correct template, but the wrong stuff is put out? or it uses the wrong template, but for some reason in any case i can’t debug it since it works locally. |
That appears to me to be saying it's loading the default template, not your custom one:
|
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
from test.support import EnvironmentVarGuard |
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.
https://docs.python.org/3/library/test.html
The test package is meant for internal use by Python only. It is documented for the benefit of the core developers of Python. Any use of this package outside of Python’s standard library is discouraged as code mentioned here can change or be removed without notice between releases of Python.
We already require testpath for tests, so you can use testpath.modified_env to achieve this.
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.
thanks, will do!
oh, true. but why? here i add the kernel path right after the custom path, so the loader should try (and find) stuff there first. |
Nothing springs to mind, sorry. |
OK, this should help. i’m logging the shit out of this and duplicating the code used to search for template paths |
uuh, my search path isn’t added: ['.',
'.../site-packages/nbconvert/exporters/../templates',
'.../site-packages/nbconvert/exporters/../templates/skeleton'] why? some overeager caching? |
wtf? why is only the python3 kernel found within those kernel dirs
waitbefore i can understand this, please explain how |
The @default decorator is a change in the latest version of traitlets, and that code hasn't been updated yet. It's relying on the older API where a traitlet named |
I suspect the issue is that you need to add the test files to package_data here so that they get installed: Line 55 in a0a4a5f
|
aaah, makes sense. but may i ask why you install tests at all? |
6ac935c
to
1467706
Compare
Different approaches - some people like to be able to install a package and run its tests, and Jupyter code is generally structured that way, with tests inside the package. |
OK. what do you say about this PR? |
Much the same as I said before:
|
i’m happy to split this, but as said: i didn’t get it to work with caching and i suspect this is at least partly due to bugs in caching. so yeah, we should probably decide first if it’s worth to cache, before i adapt this all to caching only to have caching ripped out later for buggyness and uselessness..
i thought about this as well and think it’s also a good idea. maybe we should extend the kernel.json spec to have a |
Just to chime in: I'm also helping out in the development of a environmental kernel manager (register all conda/virtualenv environments as kernels, if they have irkernel or the ipykernel installed: https://github.com/Cadair/jupyter_environment_kernels). Part of that is that we currently (or better after Cadair/jupyter_environment_kernels#24) "set" our own kernel spec dir to get logos to the UI... I'm not sure how hard it would be to find the right dir in the env itself, but this felt easier (and is also the thing which the current conda implementation of such an kernel env manager does). |
Tagging as Also, we are doing our best to enable people to learn how to contribute to the project, and get commits in. If you are missing time or have any other issues that prevent you to work on that, please feel free to tell us, we can try to build on top of what you did. Thanks a lot and looking forward to see this moving forward again. |
There was no progress as I was waiting for an answer to
So what about it? Is caching fixed? Is it going to be removed because it never worked properly in the first place and has no tangible performance impact? |
this adds kernel-specific templates and removes caching. several runs of the test suite showed that caching had no effect on its runtime that is above noise level.