[HN Gopher] Interesting ideas in Observable Framework
       ___________________________________________________________________
        
       Interesting ideas in Observable Framework
        
       Author : simonw
       Score  : 90 points
       Date   : 2024-03-03 18:01 UTC (4 hours ago)
        
 (HTM) web link (simonwillison.net)
 (TXT) w3m dump (simonwillison.net)
        
       | simonw wrote:
       | In a way, Observable Framework is the Avengers: Endgame of the
       | Mike Bostock Cinematic Universe.
       | 
       | It brings together d3, Observable, Observable Plot, HTL and
       | layers on a bunch of new ideas as well.
        
         | codetrotter wrote:
         | Thanks for your writeup on Observable Framework. I had
         | bookmarked both Observable, and Observable Framework before,
         | but not started looking into the details of it.
         | 
         | Today I was beginning to look at how to host a static Jupyter
         | Notebook, or hosting it interactive with WASM.
         | 
         | But actually I think that for most of my purposes Observable
         | Framework will be a better fit.
        
       | floodle wrote:
       | I just feel like they are limiting their user base by only
       | supporting Javascript.
       | 
       | It's of course the de-facto language for interactive display in
       | browsers. The use case for dashboards and data visualisation is
       | clear. But it's an awful language for data science and data
       | analysis, compared to Python or R.
        
         | no_wizard wrote:
         | >It's of course the de-facto language for interactive display
         | in browsers
         | 
         | This is it, more or less.
         | 
         | It is far, far easier to build an app like this where you want
         | a plethora of users as a web application than a native one, for
         | instance.
         | 
         | For anything JavaScript as a runtime / language is missing,
         | WASM can boost as well. For math and data science, WASM is a
         | natural choice for any missing pieces
        
         | simonw wrote:
         | One of the neat new features of Observable Framework is you can
         | drop in a build script to gather the data that's written in any
         | language you like. https://observablehq.com/framework/loaders
         | 
         | So you absolutely can do the data processing step in R or
         | Python and have that output JSON or CSV which is then
         | visualized at the end using JavaScript.
         | 
         | Not a small feature, but I bet it would be possible to use
         | WebAssembly to add support for Markdown blocks that get
         | executed in other languages as well, using Pyodide for Python
         | for example.
        
       | willmeyers wrote:
       | The author's spot on about framework.
       | 
       | I tried out Observable Framework and built a little interactive
       | plot (https://github.com/willmeyers/observable-ssta). It was
       | incredibly easy to setup and get data plotted.
       | 
       | My only gripe is that I wish you could configure Python data
       | loaders to use virtualenvs.
        
         | simonw wrote:
         | Can you put a shebang line in a .sh data loader that points to
         | the full path to bin/python within the virtual environment
         | directory?
        
           | timmattison wrote:
           | You can. But then the only time it realizes that the code has
           | been updated is when you update the script or touch it. It's
           | a minor annoyance but it adds up when making lots of changes.
           | Periodically deleting the cache works too but also annoying.
        
         | learned wrote:
         | I have a setup with poetry that runs the python data loaders in
         | the poetry-managed virtualenv.
         | 
         | I just created a python project and then instead of `yarn run
         | dev` to start the dev server, just run `poetry run yarn run
         | dev` so the python is executed within the virtualenv.
         | 
         | This setup also lets you use a custom python package to define
         | reusable and unit-testable code for the dataloaders that you
         | can import into the *.json.py files to keep those really
         | simple.
        
       | llimllib wrote:
       | Framework is also super easy to publish to a github site, I wrote
       | up a note with the steps and a sample github action:
       | https://notes.billmill.org/programming/observable_framework/...
        
       | qwertox wrote:
       | My issue with Observable is that it appears to be the examples-
       | resource for d3 [0], but you can't just copy-paste the code
       | because it is designed to run in that framework.
       | 
       | And it's not like d3 is easy to use so that you can use it
       | without examples, specially considering that changes between
       | versions are often incompatible.
       | 
       | But apart from this, there's a lot of incredible graphics to find
       | on the site.
       | 
       | [0] https://observablehq.com/@d3/gallery
        
       ___________________________________________________________________
       (page generated 2024-03-03 23:00 UTC)