Airtable is an unparalleled tool for managing data. Pyodide/python/numpy/matplotlib is an unparalleled tool for analyzing and visualizing data. The Chrysopelea (flying snakes!) block puts these things together, enabling any user to write scripts for analyzing and visualizing Airtable data using python/numpy/matplotlib.
The open-source Pyodide framework is the key to this block, and does all the hard work. Pyodide provides versions of the python interpreter and libraries that run in the browser.
This block is simply an integration of Pyodide with Airtable.
What it does
The Chrysopelea (flying snakes!) block enables the user to define script variables that are populated with user-selected Airtable data to feed into Python scripts. The user defines the script variable names, and what tables/views should be used to populate each variable. The user also defines the table to be used to store the Python scripts. Finally, the user can select a script and run it. Plots generated by the script are rendered in the block, and the script results are displayed. In case of script error, the error is displayed. The user can also define tables to store the results of Python scripts.
How I built it
This block starts and ends with pyodide: https://pyodide.readthedocs.io/en/latest/. The people who built Pyodide implemented 99.9% of what this block does. The tiny contribution of the "Chrysopelea" block is lots of trial and error towards getting Pyodide integrated into something that makes sense in the context of Airtable.
Challenges I ran into
Learning react was a key challenge. Also, there is something I don't understand about transpiling in the react environment that caused some of my 'async' handler functions to be transpiled to not-async, causing some issues with trying to invoke airtable functions with "await". I had to work around this which was a bit of a pain. I think it's something about trying to combine the React processing model with how the block invokes the python script interpreter.
Accomplishments that I'm proud of
It actually works!
What I learned
React; the airtable blocks API.
What's next for Chrysopelea
See the README.