Hi. At first as a new observable user, because I saw a fair amount of “github + observable”-related topics, and because you can sign in with git creds, I expected that you could save your observable code to a git repo as a backup and load it from there.
Having spent a bit more time here, I now think there’s no such workflow. Rather, the observable + git workflow that’s possible is something like:
- develop your notebooks in observable.
- download them to a git repo locally if you want to.
- push your changes to git from your local repo as one would normally do.
Is this understanding correct?
“Why would you want to work in observable from git?”, you inquire. My only motivation is that sometimes you want to use your d3 code elsewhere, so it’s nice to have it backed up in git. And concomitantly, it’s nice to run out of one spot without having to do the extra backups.
You can do this today with the following VS Code extension: Observable JS - Visual Studio Marketplace - but it is a one way trip as there is no way to push changes back to ObservableHQ, see Ability to import a notebook. · Issue #477 · observablehq/feedback (github.com)
Mind you with the advent of GitHub Blocks (githubnext.com) you may not want to:
1 Like
Thanks Gordon! I’ve been out traveling or would have replied earlier. Anyway, in the github blocks workflow, you expect to do the work in github, and use some observable extension to visualize the git code blocks as needed, correct? If correct, that sounds like it would be great for versioning, but I wonder how the data connections and related security would work.
Think of Blocks as a new way to write custom viewers for “any” file type stored in GitHub (my examples above are for an Observable Notebook JSON file and a Parquet file viewer using a specific Observable Notebook) - I believe the plan is to have access to secrets the same way any GH Marketplace item may have access to a secret (but I don’t know to what extent that means).
The real workflow would be via the VS Code extension for editing / viewing and version controlling either the Notebook, OJS file or OMD file.
How and where those files end up getting hosted is up to you… For example rendering the above notebook from GitHub back here on ObservableHQ: GitHub hosted Notebook! / Gordon Smith | Observable