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?
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…
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.
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.
Could someone file this in the feedback repo? I’d do it myself but we try to keep it community-driven!
(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.)