-
Notifications
You must be signed in to change notification settings - Fork 61
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
🤖 Make name
& display_name
required properties for KernelSpec
#1490
Conversation
🦋 Changeset detectedLatest commit: 9688ccd The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Looks good, haven't tested. Let me know if you want me to do that, but the changes look straight forward.
|
||
// Build a hash from notebook state | ||
return createHash('md5') | ||
.update(kernelSpec.name) |
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 suppose all hashes will change. That is fine though.
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.
Yes, I made a note of that in the description. It's unfortunate, and we could add some backwards-compat logic, but I think it's early enough in the project's history to just break it.
@@ -281,6 +284,15 @@ export type Options = { | |||
*/ | |||
export async function kernelExecutionTransform(tree: GenericParent, vfile: VFile, opts: Options) { | |||
const log = opts.log ?? console; | |||
|
|||
// We need the kernelspec to proceed | |||
if (opts.frontmatter.kernelspec === undefined) { |
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.
This should never be triggered in the current CLI workflow, right? Because we always have a valid object coming out of frontmatter validation?
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.
If you don't define frontmatter.kernelspec, you don't get a kernelspec object:
kernelspec?: KernelSpec; |
@rowanc1 are you happy to merge this in now? |
The
nbformat
spec requires thatname
anddisplay_name
are set in a kernelspec object. Presently, we don't require either of these fields.This is a problem when e.g. invoking
jupytext
on a notebook that only hasname
:which fails with:
This PR makes
name
anddisplay_name
"soft" required; default values will be chosen if they're missing, but warnings will also be issued.In future, we can eventually just make them required.
This PR also changes our execution hash key strategy. Now, it includes the kernelspec name! It's highly unlikely to be a common bug, but users could e.g. switch from one Python kernel to another, and the cache would remain unchanged. This would definitely be a problem if different kernels had different environments.
As a result of this change, existing caches will be invalidated. But, I think that's OK given how young execution is (I don't think we advertise it as stable yet).