[feature request] List notebooks that depend on a given notebook

Frequently, when I work on a notebook, I wish I could know the list of the notebooks that depend on it. Two particular use cases:

  • I make a breaking change, and I want to go fix my other notebooks that depend on it (or alert other users in the rare cases where somebody else uses my code)
  • I want to delete the notebook, but not to break someone else (or my) code. Obviously, deleting a notebook would also break links from outside Observable or saved as bookmarks, but it’s another problem (generally it’s not a problem for notebooks I want to delete).

For my notebooks, I imagine I could find the import statements using code from My Notebooks / Fil | Observable and Notebook visualizer / Observable | Observable and get a list of my dependencies. For other users’ notebooks, it’s more difficult, even impossible for private notebooks. But maybe Observable could give the count of notebooks that depend on it, or even a boolean (there is at least one dependency, or not)

What do you think? Is it a common need? And is there already any way to do something near?

15 Likes

Cool idea. Once users have access to this data, you could make a tree visualization to show how many notebooks are interconnected.

1 Like

Totally agree, this comes up from time to time.

This is kind of the opposite of what you want, but Mike does have a notebook that recursively visualizes a notebook’s import dependencies: https://observablehq.com/@observablehq/notebook-import-visualizer

That helps you see what a notebook depends on, but not what depends on it. I agree I want that too. For cases where you can enumerate the notebooks you care about (like, if you have an array of notebook IDs), I guess maybe you could fork that to crawl all the transitive dependencies of every notebook in that given set, and then traverse it to check in the other direction…

2 Likes

Here was my previous request for this: Feature idea: way to browse dependent notebook graph

1 Like

yes I want this too. I was half considering building it but it would require scraping all the notebooks. This 10k scrape took 24 hours to run for comparison, so I think its very doable ATM https://observablehq.com/@tomlarkworthy/hacker-favourites-analysis

1 Like

Only to some extent, because Observable limits the maximum number of results that are retrievable in all listings (30/page * 100 = 3000), including recent and search. This limit is enforced by the API.

And wrt to the search, be prepared to wait 10s per request for common phrases.

1 Like

This doesn’t 100% cover all these cases, but with the new Observable search, you can search for (public) notebooks that might import cells from your notebook. Like with Mike’s Safe Local Storage notebook, you can search:

mbostock/safe-local-storage -author:@mbostock

And the search results returns notebooks that mostly likely contain a cell with import {localStorage} from "@mbostock/safe-local-storage". It’s also possible that someone is importing the notebook with the notebook ID or the full url, so you might wanna change the search to cover that

Again, not 100%, someone with better observable search-fu might have a better query, but if I’m curious about who uses my notebooks, or I’m checking to see if a change in one of my public notebooks break something, it’s a good quick litmus test for that.

7 Likes

@tomlarkworthy I completely forgot: The RSS feed for /recent lets you filter back all the way:
https://api.observablehq.com/documents/public.rss?before=2017-06-01T00:00:00.000Z

1 Like

… And /documents/public still supports ?before as well:
https://api.observablehq.com/documents/public?before=2017-06-01T00:00:00.000Z

Could someone file this in the feedback repo? I’d do it myself but we try to keep it community-driven! :angel:

(We’ve continued to talk about this idea internally — we sometimes call it the “megamap” — but people do refer to the feedback repo to prioritize roadmaps and such, so posting there helps build institutional inertia.)

3 Likes

I guess we already have UI: Allow Easy Discovery of (outgoing) Imports on the Notebook I'm Viewing · Issue #70 · observablehq/feedback · GitHub so we should upvote that (I just did) which is in the same ballpark of feature request.

1 Like

oops thanks tom! missed that