Feature request: Standardize licensing notebooks

I think a specific feature for adding a license to a notebook would be really beneficial! For things like the unofficial Atom package for rendering local observable notebooks, where it’s pretty easy to import any public Observable notebook, people might be importing and using notebooks that they don’t have the rights to use outside Observable (since the Terms of Service doesn’t let you use Observable notebooks outside of Observable by default, unless the notebook is licensed differently).

This could just be a part of notebook cells - maybe a new builtin variable, License, that a user can use like:

 LICENSE = License`MIT`

(Where MIT could be any SPDX identifier)

In observablehq notebooks, this could render a small HTML element of the license text. Then, in 3rd party extensions, like the Atom package, we could check for licenses like:

const m = runtime.module(define)

const license = await m.value('LICENSE').catch( () => null)

if(license && license.MIT) {
  //  allow import
else {
  // show warning that notebook doesn't have license/not permitted for outside Observable usage

Or maybe instead of it being defined in code, it could be a setting you can change on individual notebooks. This might be hard to check in 3rd party extensions, but if there was an API for Observable notebook metadata, I guess it can be used there.

I’m not really concerned with how a license feature is added (whether it’s in code or a notebook setting or something else entirely), but I would really love to see an easy way for authors to allow for other people to use that notebook outside of observablehq.com (from either embedding or 3rd pary extension).


Some talking points:

  • Adoption is key, so setting a license should be a no-brainer UX-wise. Having something like LICENSE = License`MIT` is (imo) rather obscure.
  • Users may not be familiar with the various licenses and might not care. They should be able to select a license, ideally with a short (non-legal) explanation.
  • I would suggest a clearly visible default (e.g. MIT, ISC) that a user can change for new notebooks.
    As an aside, notebook templates (i.e. preconfigured cells for new notebooks) might be a good idea - somewhat similar to glitch.me starter templates?
  • One option should be “proprietary or embedded”. I’d choose this if I don’t want to provide a license, or if I want to embed a custom/unlisted license directly via a cell.
  • We should research wether a SPDX identifier without the actual license text has any relevance.
  • If embedding is required, it would need to be handled by ObservableHQ (during bundling, and via the UI) for its supported license types.
  • License embedding should not modify cells, but instead
    • add a license header for module files (%slug%.js)
    • add a license file for tarballs (%slug%.tar.gz)
  • How does a license affect notebook embedding, especially since cells get embedded selectively?
  • How does (or should) attribution work for embedded notebooks?
1 Like

GitHub’s https://choosealicense.com has some great data for helping users choose between licenses.


Creative Commons suggests the following:

Different types of content will have different
limitations, but your marker should contain:

  1. The full URL (link) to the license.
    Example: http://creativecommons.org/licenses/by/3.0/us/
  2. Optionally, the Creative Commons license icons,
    including the CC logo.


IANAL, but it appears from reading other sources that the inclusion of a SPDX identifier alone is not enough to grant a license. SPDX only offers metadata about the license, but does not substitute the inclusion of a license notice. As such a work without a license text (or link to a license text) would still have to be treated as unlicensed outside of Observable.

Perhaps linking the identifier to the actual license text might be enough.

Edit: Or do it like @Fil and include the link in a comment:

// This documentation is released under the CC BY-SA 4.0 license.
// https://creativecommons.org/licenses/by-sa/4.0/
LICENSE = "cc-by-sa-4.0"

Closing the loop here: we shipped support for licensing notebooks today. Feedback welcome.