Importing functions between notebooks - breaking changes?

When you import a function from another user’s notebook, are you essentially depending on that user to not change/update/delete that function in a way that breaks your notebook?

At this point, during the initial release — yes, you essentially are depending on the other user not to break your notebook.

We hope to introduce pinning very soon for imports of other notebooks and of JavaScript libraries. When pinning is released, the first time you import an external library or notebook, the version that you load will be fixed in your notebook, and you’ll get the same version every time.

(Published notebooks are already versioned on every change, and you can pin your import against that version. In the future it’ll happen by default).

To give an example, here’s an example of an unpinned import that (currently) fetches the latest version of a notebook:

import {slider} from "@jashkenas/inputs"

Here’s an equivalent pinned import that locks the current version of Jeremy’s inputs notebook:

import {slider} from "@jashkenas/inputs@750"

Currently you have to do a little digging in the developer console to discover what the latest published version is. In the future, we’d like automatic pinning where Observable magically rewrites imports of the unpinned form into the pinned form, thereby protecting you from breaking changes. And if you ever want to upgrade to the latest version of an imported notebook, you can simply delete the version number and re-run the import cell.

2 Likes

Cool! The ability to share cells seems really useful.