diff --git a/content/xeus-lua/canvas.ipynb b/content/xeus-lua/canvas.ipynb deleted file mode 100644 index 89f9e52d0..000000000 --- a/content/xeus-lua/canvas.ipynb +++ /dev/null @@ -1,29 +0,0 @@ -{ - "metadata": { - "orig_nbformat": 4, - "language_info": { - "file_extension": ".lua", - "mimetype": "text/x-luasrc", - "name": "lua", - "version": "14.0.0" - }, - "kernelspec": { - "name": "Lua", - "display_name": "Lua", - "language": "lua" - } - }, - "nbformat_minor": 4, - "nbformat": 4, - "cells": [ - { - "cell_type": "code", - "source": "canvas = ilua.canvas.canvas()\nilua.display.display(canvas)\ncanvas:cache()\nfor var=1,100 do\n canvas:begin_path()\n canvas:move_to(canvas:rand_coord())\n for s=1,10 do\n canvas:line_to(canvas:rand_coord())\n end\n canvas.fill_style = canvas:rand_color()\n canvas:fill()\nend\ncanvas:flush()", - "metadata": { - "trusted": true - }, - "execution_count": null, - "outputs": [] - } - ] -} \ No newline at end of file diff --git a/content/xeus-lua/game-of-life.ipynb b/content/xeus-lua/game-of-life.ipynb deleted file mode 100644 index 09dabe4b5..000000000 --- a/content/xeus-lua/game-of-life.ipynb +++ /dev/null @@ -1,92 +0,0 @@ -{ - "metadata":{ - "orig_nbformat":4, - "kernelspec":{ - "name":"Lua", - "display_name":"Lua", - "language":"lua" - }, - "language_info":{ - "file_extension":".lua", - "mimetype":"text/x-luasrc", - "name":"lua", - "version":"14.0.0" - } - }, - "nbformat_minor":5, - "nbformat":4, - "cells":[ - { - "cell_type":"code", - "source":"math = require(\"math\")\n\n-- the game of life class itself\nGameOfLife = {}\nGameOfLife.__index = GameOfLife\nfunction GameOfLife:Create(grid_size)\n local this =\n {\n grid_size = grid_size or {10,10},\n grid = {}\n }\n setmetatable(this, GameOfLife)\n this.size = this.grid_size[1] * this.grid_size[2]\n for i=1,this.size do\n this.grid[i] = 0\n end\n return this\nend", - "metadata":{ - "trusted":true - }, - "execution_count":null, - "outputs":[ - - ], - "id":"61dc1d13-5546-477d-a162-e18ec564e3ee" - }, - { - "cell_type":"code", - "source":"-- member function to initalize with some random values\nfunction GameOfLife:init_random(p)\n for i=1,self.size do\n self.grid[i] = (math.random() < p) and 1 or 0\n end\nend", - "metadata":{ - "trusted":true - }, - "execution_count":null, - "outputs":[ - - ], - "id":"72da5a15-dd9d-4a62-bfa3-5a3ec457c5f4" - }, - { - "cell_type":"code", - "source":"-- helper function to convert a coordinate {x,y} into a \n-- scalar offset\nfunction GameOfLife:to_offset(coord)\n return (coord[1]-1) * self.grid_size[2] + (coord[2] -1) + 1\nend\n-- helper function to access the value of the grid at a coordinate {x,y}\nfunction GameOfLife:at(coord)\n return self.grid[self:to_offset(coord)]\nend", - "metadata":{ - "trusted":true - }, - "execution_count":null, - "outputs":[ - - ], - "id":"0b341677-64f2-4ef3-8ea4-a8e2eb275df2" - }, - { - "cell_type":"code", - "source":"-- the function to do a step\nfunction GameOfLife:step()\n new_grid = {}\n \n for x=1,self.grid_size[1] do\n for y=1, self.grid_size[2] do\n \n local c = 0\n for xx=-1,1 do\n for yy=-1,1 do\n nx = x + xx\n ny = y + yy\n if nx >=1 and ny>=1 and nx <=self.grid_size[1] and ny <=self.grid_size[2] and not (xx==0 and yy ==0) then\n c = c + self:at({nx,ny})\n end\n end\n end\n \n local offset = self:to_offset({x,y})\n local current_state = self:at({x,y})\n \n new_grid[offset] = 0\n if current_state == 0 then\n if c == 3 then\n new_grid[offset] = 1\n end\n else\n if c==2 or c==3 then\n new_grid[offset] = 1\n else\n new_grid[offset] = 0\n end\n end\n-- \n end\n end\n self.grid = new_grid\nend", - "metadata":{ - "trusted":true - }, - "execution_count":null, - "outputs":[ - - ], - "id":"7958dd53-006c-480d-a4ad-9f04b147fd29" - }, - { - "cell_type":"code", - "source":"-- helper function to draw the grid as string\nfunction GameOfLife:__tostring()\n s = \"*\"\n for y=1, self.grid_size[2] do\n s = s .. \"--\"\n end\n s = s .. \"*\\n\"\n for x=1,self.grid_size[1] do\n s = s .. \"|\"\n for y=1, self.grid_size[2] do\n local state = self:at({x,y})\n if state == 0 then\n ss = \" \"\n else\n ss = \"O\"\n end\n s = s .. ss .. \" \"\n end\n s = s .. \"|\\n\"\n end\n s = s .. \"*\"\n for y=1, self.grid_size[2] do\n s = s .. \"--\"\n end\n s = s .. \"*\\n\"\n return s\nend", - "metadata":{ - "trusted":true - }, - "execution_count":null, - "outputs":[ - - ], - "id":"884414f6-8bc9-4719-9671-ef3be310356b" - }, - { - "cell_type":"code", - "source":"-- initalize the game of life\ngrid_size = {20,20}\ngame_of_life = GameOfLife:Create(grid_size)\ngame_of_life:init_random(0.5)\n\n-- a tiny gui\nfunction speed_to_interval(speed)\n return 1.0 / speed\nend\n\nspeed = 0.001\n\nhbox = ilua.widgets.hbox()\n\nplay = ilua.widgets.play({interval=speed_to_interval(speed), max=1000000})\noutput = ilua.widgets.output()\nstep_label = ilua.widgets.label({value=\"Step: \"..tostring(play.value)})\nspeed_label = ilua.widgets.label({value=\"Speed: \"..tostring(speed)})\nspeed_slider = ilua.widgets.slider({min=0.001, max=0.5, step=0.01})\n\nhbox:add(play,step_label,speed_label)\n\nspeed_slider:register_observer(function(value)\n output:captured(function()\n speed = value\n play.interval = speed_to_interval(speed)\n speed_label.value = \"Speed: \" .. tostring(speed)\n end)\nend)\n\nplay:register_observer(function(value)\n if value <= 0.1 then\n game_of_life:init_random(0.24)\n end\n -- use output widget to caputre prints \n output:captured(function()\n ilua.display.clear_output(false)\n step_label.value = \"STEP \"..tostring(play.value)\n game_of_life:step()\n print(tostring(game_of_life))\n end)\nend)\nilua.display.display(hbox,speed_slider, output)", - "metadata":{ - "trusted":true - }, - "execution_count":null, - "outputs":[ - - ], - "id":"40cabf23-7eef-4501-badd-99c1a68c5ced" - } - ] -} \ No newline at end of file diff --git a/content/xeus-lua/widgets.ipynb b/content/xeus-lua/widgets.ipynb deleted file mode 100644 index ef337f048..000000000 --- a/content/xeus-lua/widgets.ipynb +++ /dev/null @@ -1,632 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6d755081-7f9f-4c6a-93e5-a28c8627a0ec", - "metadata": {}, - "source": [ - "Button\n", - "=======" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "be69e205-0c56-44b7-926b-5482d5300a38", - "metadata": {}, - "outputs": [], - "source": [ - "button = ilua.widgets.button({description=\"hello\"})\n", - "output = ilua.widgets.output()\n", - "ilua.display.display(button,output)\n", - "button:on_click(function()\n", - " output:captured(function()\n", - " print(\"clicked\")\n", - " end)\n", - "end)" - ] - }, - { - "cell_type": "markdown", - "id": "d11b0def-5115-4369-9972-4766802c846f", - "metadata": { - "tags": [] - }, - "source": [ - "Box Layout\n", - "==========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5d044224-ac2e-4722-b3fb-6d75b13ec366", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "slider_a = ilua.widgets.slider({min=1, max=2, step=0.1})\n", - "slider_b = ilua.widgets.slider({min=10, max=20, step=1})\n", - "hbox = ilua.widgets.hbox()\n", - "output = ilua.widgets.output()\n", - "hbox:add(slider_a, slider_b)\n", - "ilua.display.display(hbox,output)\n", - "\n", - "slider_a:register_observer(function(value)\n", - " output:captured(function()\n", - " io.write(\"f(x) = x**2; f(\", value ,\")=\", value*value,\"\\n\")\n", - " end)\n", - "end)\n", - "slider_b:register_observer(function(value)\n", - " output:captured(function()\n", - " io.write(\"f(x) = x**3; f(\", value ,\")=\", value*value*value,\"\\n\")\n", - " end)\n", - "end)" - ] - }, - { - "cell_type": "markdown", - "id": "98e79948-9aeb-4c31-a7b9-3c6bce6c026f", - "metadata": {}, - "source": [ - "Accordion\n", - "================" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b755c37d-602a-4b46-97ee-8e044f2f2314", - "metadata": {}, - "outputs": [], - "source": [ - "output = ilua.widgets.output()\n", - "button = ilua.widgets.button({description=\"a button\"})\n", - "button:on_click(function() \n", - " output:captured(function()\n", - " print(\"clicked button\")\n", - " end)\n", - "end)\n", - "slider = ilua.widgets.slider()\n", - "color_picker = ilua.widgets.color_picker()\n", - "audio = ilua.widgets.audio()\n", - "accordion = ilua.widgets.accordion()\n", - "accordion:add(slider,button,color_picker,audio)\n", - "accordion:set_title(1,\"the slider\")\n", - "accordion:set_title(2,\"the button\")\n", - "accordion:set_title(3,\"the color_picker\")\n", - "accordion:set_title(4,\"the audio\")\n", - "ilua.display.display(accordion, output)\n", - "\n", - "slider:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"slider value\", value)\n", - " end)\n", - "end)\n", - "\n", - "color_picker:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"color_picker value\", value)\n", - " end)\n", - "end)" - ] - }, - { - "cell_type": "markdown", - "id": "097d19f7-a0c9-48a9-8eff-6e3e06780c88", - "metadata": { - "tags": [] - }, - "source": [ - "Dropdown\n", - "=========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "95e12c50-4e77-457c-b2c2-6d20421a3bea", - "metadata": {}, - "outputs": [], - "source": [ - "labels = {\"aaa\", \"bb\",\"cc\"}\n", - "dropdown = ilua.widgets.dropdown({_options_labels= labels})\n", - "output = ilua.widgets.output()\n", - "dropdown:register_observer(function(index)\n", - " output:captured(function()\n", - " print(labels[index])\n", - " end)\n", - "end)\n", - "\n", - "ilua.display.display(dropdown, output)" - ] - }, - { - "cell_type": "markdown", - "id": "ca362331-bd0c-4203-9a6f-dc937d309297", - "metadata": {}, - "source": [ - "Html\n", - "=======" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "abc66753-53ba-4361-96a6-48cd9460c8e3", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "src = [[\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "

My First Page

\n", - "

This is my first page.

\n", - "

A secondary header.

\n", - "

Some more text.

\n", - " \n", - "\n", - "]]\n", - "html = ilua.widgets.html({value=src})\n", - "ilua.display.display(html)" - ] - }, - { - "cell_type": "markdown", - "id": "e8eeacfe-350a-4ecb-81a9-c8091af3c22e", - "metadata": { - "tags": [] - }, - "source": [ - "numeral\n", - "========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9c177cfe-2613-43a3-a217-d93bc257420e", - "metadata": {}, - "outputs": [], - "source": [ - "numeral = ilua.widgets.numeral()\n", - "output = ilua.widgets.output()\n", - "numeral:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"value\", value)\n", - " end)\n", - "end)\n", - "ilua.display.display(numeral, output)" - ] - }, - { - "cell_type": "markdown", - "id": "9fede355-2e4f-48c9-b39b-1886e060ce8b", - "metadata": {}, - "source": [ - "password\n", - "========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "455996cf-9b63-4d50-869a-0f479ab3daf4", - "metadata": {}, - "outputs": [], - "source": [ - "password = ilua.widgets.password()\n", - "output = ilua.widgets.output()\n", - "password:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"value\", value)\n", - " end)\n", - "end)\n", - "\n", - "ilua.display.display(password, output)" - ] - }, - { - "cell_type": "markdown", - "id": "6306ce8e-37d3-4dbc-a8cf-955b2dfe684c", - "metadata": {}, - "source": [ - "play\n", - "=====" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "986147ab-c9de-4ad9-b8be-f65260dd815d", - "metadata": {}, - "outputs": [], - "source": [ - "play = ilua.widgets.play({interval=1000})\n", - "output = ilua.widgets.output()\n", - "play:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"value\", value)\n", - " end)\n", - "end)\n", - "\n", - "ilua.display.display(play, output)" - ] - }, - { - "cell_type": "markdown", - "id": "4e03ccf2-3a10-40d6-8273-168a91f3d9a7", - "metadata": {}, - "source": [ - "progress\n", - "=========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a4f194ee-0995-44f3-8636-b629bd5b65ba", - "metadata": {}, - "outputs": [], - "source": [ - "progress = ilua.widgets.progress({min=10, max=20})\n", - "play = ilua.widgets.play({min=10, max=20, interval=100})\n", - "play:register_observer(function(value)\n", - " progress.value = value\n", - "end)\n", - "ilua.display.display(play, progress)" - ] - }, - { - "cell_type": "markdown", - "id": "39714034-99f4-4f36-b50f-33aa3f71d2a6", - "metadata": {}, - "source": [ - "Selection Slider\n", - "=================" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7f6aab9e-b3ce-4df9-83a6-94eb725aceb0", - "metadata": {}, - "outputs": [], - "source": [ - "labels = {\"aaa\", \"bb\",\"cc\"}\n", - "selectionslider = ilua.widgets.selectionslider({_options_labels = labels})\n", - "output = ilua.widgets.output()\n", - "selectionslider:register_observer(function(index)\n", - " output:captured(function()\n", - " print(labels[index])\n", - " end)\n", - "end)\n", - "\n", - "ilua.display.display(selectionslider, output)" - ] - }, - { - "cell_type": "markdown", - "id": "45d72396-3fcc-421e-865e-487d93b333b8", - "metadata": {}, - "source": [ - "Tab\n", - "======" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6d0684e8-62a2-4483-995a-70d7cc2783ac", - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "\n", - "slider_a = ilua.widgets.slider()\n", - "slider_b = ilua.widgets.slider()\n", - "\n", - "titles = {\"aaa\", \"bb\",\"cc\"}\n", - "tab = ilua.widgets.tab({_titles = titles})\n", - "tab:add(slider_a,slider_b)\n", - "output = ilua.widgets.output()\n", - "\n", - "tab:register_observer(function(index)\n", - " -- use output widget to caputre prints \n", - " output:captured(function()\n", - " print(titles[index])\n", - " end)\n", - "end)\n", - "\n", - "ilua.display.display(tab,output)" - ] - }, - { - "cell_type": "markdown", - "id": "7f9f85de-a5b8-4e60-9eff-33b25d819ec9", - "metadata": {}, - "source": [ - "Text\n", - "=====" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "893e92ad-eff2-4adb-ba82-71a9ed2cfe9e", - "metadata": {}, - "outputs": [], - "source": [ - "text = ilua.widgets.text()\n", - "output = ilua.widgets.output()\n", - "text:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"value\", value)\n", - " end)\n", - "end)\n", - "\n", - "text:on_submit(function()\n", - " output:captured(function()\n", - " print(\"on_submit\")\n", - " end)\n", - "end)\n", - "\n", - "ilua.display.display(text, output)" - ] - }, - { - "cell_type": "markdown", - "id": "94572d62-12ea-4026-a531-d0e7bc5b20b9", - "metadata": {}, - "source": [ - "TextArea\n", - "=========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1e76b56f-f087-49f8-a50e-eb794060c63c", - "metadata": {}, - "outputs": [], - "source": [ - "textarea = ilua.widgets.textarea({continuous_update=false})\n", - "output = ilua.widgets.output()\n", - "textarea:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"value\", value)\n", - " end)\n", - "end)\n", - "ilua.display.display(textarea, output)" - ] - }, - { - "cell_type": "markdown", - "id": "68011d67-ac8c-43ff-bae9-4caf95273f98", - "metadata": {}, - "source": [ - "Toggle Button\n", - "=========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cf780275-b2de-48d4-bb2e-3f38e8c45bcd", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "togglebutton = ilua.widgets.togglebutton({\n", - " icon=\"plus\",\n", - " button_style=\"\"\n", - "})\n", - "output = ilua.widgets.output()\n", - "togglebutton:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"value\", value)\n", - " end)\n", - "end)\n", - "\n", - "ilua.display.display(togglebutton, output)" - ] - }, - { - "cell_type": "markdown", - "id": "1bc5c504-cf9c-432f-a91c-2497910d787b", - "metadata": {}, - "source": [ - "ToggleButtons\n", - "=========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f764f285-d71f-4c93-92b4-923484846b0c", - "metadata": {}, - "outputs": [], - "source": [ - "togglebuttons = ilua.widgets.togglebuttons()\n", - "togglebuttons._options_labels = {\"1\", \"2\",\"3\"}\n", - "output = ilua.widgets.output()\n", - "togglebuttons:register_observer(function(value)\n", - " output:captured(function()\n", - " print(\"value\", value)\n", - " end)\n", - "end)\n", - "\n", - "ilua.display.display(togglebuttons, output)" - ] - }, - { - "cell_type": "markdown", - "id": "55447db2-bab0-4282-9a89-f6b9f8fd9e30", - "metadata": {}, - "source": [ - "Image\n", - "========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d21c5e4b-1d27-44e9-9966-0da4ef55f651", - "metadata": {}, - "outputs": [], - "source": [ - "io = require(\"io\")\n", - "file = io.open(\"marie.png\", \"r\")\n", - "content = file:read(\"*all\")\n", - "io.close(file)\n", - "\n", - "image = ilua.widgets.image()\n", - "image.value = content\n", - "ilua.display.display(image)" - ] - }, - { - "cell_type": "markdown", - "id": "ee4e079c-0101-49a9-94f6-2d7e73ad3f59", - "metadata": { - "tags": [] - }, - "source": [ - "Video\n", - "========" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "654c050a-3cff-48d2-b7a1-d8f6acfe042a", - "metadata": {}, - "outputs": [], - "source": [ - "io = require(\"io\")\n", - "file = io.open(\"Big.Buck.Bunny.mp4\", \"r\")\n", - "content = file:read(\"*all\")\n", - "io.close(file)\n", - "\n", - "video = ilua.widgets.video({loop=false})\n", - "video.value = content\n", - "ilua.display.display(video)" - ] - }, - { - "cell_type": "markdown", - "id": "829cf76c-238d-456f-a5b9-51f3a526f45c", - "metadata": {}, - "source": [ - "Audio\n", - "======" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "43922e68-ee53-40bd-bf2c-8dcc810bdb6a", - "metadata": {}, - "outputs": [], - "source": [ - "io = require(\"io\")\n", - "file = io.open(\"hehe.flac\", \"r\")\n", - "content = file:read(\"*all\")\n", - "io.close(file)\n", - "\n", - "audio = ilua.widgets.audio({loop=false})\n", - "audio.value = content\n", - "ilua.display.display(audio)" - ] - }, - { - "cell_type": "markdown", - "id": "2aee848b-a3e6-4ce3-9d2d-8650871bb225", - "metadata": {}, - "source": [ - "Valid\n", - "======" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ef2ae714-2077-4767-9c24-af821fbc2c9d", - "metadata": {}, - "outputs": [], - "source": [ - "valid = ilua.widgets.valid()\n", - "valid.value = false\n", - "ilua.display.display(valid)" - ] - }, - { - "cell_type": "markdown", - "id": "96b64ffe-ac69-4b0e-9299-0a54842a77c1", - "metadata": {}, - "source": [ - "Link Widgets\n", - "============" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "191675ca-c53e-4c83-a0cf-8dcd78b02fae", - "metadata": {}, - "outputs": [], - "source": [ - "slider = ilua.widgets.slider()\n", - "numeral = ilua.widgets.numeral()\n", - "\n", - "link = ilua.widgets.link(slider, \"value\", numeral, \"value\")\n", - "ilua.display.display(link, slider, numeral)" - ] - }, - { - "cell_type": "markdown", - "id": "3d54b0cc-7f2f-4ad7-92a8-9f61abe989f9", - "metadata": {}, - "source": [ - "Directional Link\n", - "===================" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "21499154-6da9-4a4a-a6ce-7637916d26c6", - "metadata": {}, - "outputs": [], - "source": [ - "slider = ilua.widgets.slider()\n", - "numeral = ilua.widgets.numeral()\n", - "\n", - "link = ilua.widgets.directional_link(slider, \"value\", numeral, \"value\")\n", - "ilua.display.display(link, slider, numeral)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Lua 0.2 (XLua)", - "language": "lua", - "name": "xlua" - }, - "language_info": { - "file_extension": ".lua", - "mimetype": "text/x-luasrc", - "name": "lua", - "version": "14.0.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/content/xeus-sqlite/simple-operations.ipynb b/content/xeus-sqlite/simple-operations.ipynb deleted file mode 100644 index 5d4c4a6e9..000000000 --- a/content/xeus-sqlite/simple-operations.ipynb +++ /dev/null @@ -1,392 +0,0 @@ -{ - "metadata": { - "kernelspec": { - "name": "SQLite", - "display_name": "SQLite", - "language": "sql" - }, - "language_info": { - "file_extension": ".sqlite3-console", - "mimetype": "text/x-sqlite3-console", - "name": "sqlite3", - "version": "0.4.0" - } - }, - "nbformat_minor": 4, - "nbformat": 4, - "cells": [ - { - "cell_type": "markdown", - "source": "# JupyterLite `xeus-sqlite` Kernel Demo\n\nThe [`jupyterlite/xeus-sqlite-kernel`](https://github.com/jupyterlite/xeus-sqlite-kernel) wraps the original [`jupyter-xeus/xeus-sqlite`](https://github.com/jupyter-xeus/xeus-sqlite/) kernel for use in JupyterLite.\n\nOriginal kernel docs can be found [here](https://xeus-sqlite.readthedocs.io/en/latest/).\n\nThe kernel provides cell magic for command line database operations, and native execution of SQL code against a connected database.", - "metadata": {} - }, - { - "cell_type": "markdown", - "source": "## Creating a Database\n\nLine magic is used to create an in-memory database:", - "metadata": {} - }, - { - "cell_type": "code", - "source": "%CREATE example_db.db", - "metadata": { - "trusted": true - }, - "execution_count": 1, - "outputs": [] - }, - { - "cell_type": "markdown", - "source": "Currently, there is no ability to:\n\n- save the database to browser storage;\n- export the database;\n- load a database from browser storage;\n- load a database from a URL;\n- load a database from the desktop;\n- connect to a remote sqlite database file.", - "metadata": {} - }, - { - "cell_type": "markdown", - "source": "## Create and Populate Tables\n\nTables are created and populated using SQL:", - "metadata": {} - }, - { - "cell_type": "code", - "source": "CREATE TABLE players (Name STRING, Class STRING, Level INTEGER, Hitpoints INTEGER)", - "metadata": { - "trusted": true - }, - "execution_count": 2, - "outputs": [] - }, - { - "cell_type": "code", - "source": "INSERT INTO players (Name, Class, Level, Hitpoints) VALUES (\"Martin Splitskull\", \"Warrior\", 3, 40)", - "metadata": { - "trusted": true - }, - "execution_count": 3, - "outputs": [] - }, - { - "cell_type": "code", - "source": "SELECT COUNT(*) as rowcount FROM players", - "metadata": { - "trusted": true - }, - "execution_count": 4, - "outputs": [ - { - "execution_count": 4, - "output_type": "execute_result", - "data": { - "text/html": "\n\n\n\n\n\n\n
rowcount
1
", - "text/plain": "+----------+\n| rowcount |\n+----------+\n| 1 |\n+----------+" - }, - "metadata": {} - } - ] - }, - { - "cell_type": "markdown", - "source": "Only one command can be executed from within a single code cell:", - "metadata": {} - }, - { - "cell_type": "code", - "source": "INSERT INTO players (Name, Class, Level, Hitpoints) VALUES (\"Sir Wolf\", \"Cleric\", 2, 20);\n\n-- The following will not be inserted\nINSERT INTO players (Name, Class, Level, Hitpoints) VALUES (\"Sylvain, The Grey\", \"Wizard\", 1, 10);", - "metadata": { - "trusted": true - }, - "execution_count": 5, - "outputs": [] - }, - { - "cell_type": "code", - "source": "SELECT Name, Level, Hitpoints FROM players;", - "metadata": { - "trusted": true - }, - "execution_count": 6, - "outputs": [ - { - "execution_count": 6, - "output_type": "execute_result", - "data": { - "text/html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameLevelHitpoints
Martin Splitskull340
Sir Wolf220
", - "text/plain": "+-------------------+-------+-----------+\n| Name | Level | Hitpoints |\n+-------------------+-------+-----------+\n| Martin Splitskull | 3 | 40 |\n+-------------------+-------+-----------+\n| Sir Wolf | 2 | 20 |\n+-------------------+-------+-----------+" - }, - "metadata": {} - } - ] - }, - { - "cell_type": "code", - "source": "INSERT INTO players (Name, Class, Level, Hitpoints) VALUES (\"Sylvain, The Grey\", \"Wizard\", 1, 10);", - "metadata": { - "trusted": true - }, - "execution_count": 7, - "outputs": [] - }, - { - "cell_type": "code", - "source": "SELECT Name, Level, Hitpoints FROM players;", - "metadata": { - "trusted": true - }, - "execution_count": 8, - "outputs": [ - { - "execution_count": 8, - "output_type": "execute_result", - "data": { - "text/html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameLevelHitpoints
Martin Splitskull340
Sir Wolf220
Sylvain, The Grey110
", - "text/plain": "+-------------------+-------+-----------+\n| Name | Level | Hitpoints |\n+-------------------+-------+-----------+\n| Martin Splitskull | 3 | 40 |\n+-------------------+-------+-----------+\n| Sir Wolf | 2 | 20 |\n+-------------------+-------+-----------+\n| Sylvain, The Grey | 1 | 10 |\n+-------------------+-------+-----------+" - }, - "metadata": {} - } - ] - }, - { - "cell_type": "markdown", - "source": "## Quuerying Tables\n\nA full range of SQL query commands are supported, including aggregation operations:", - "metadata": {} - }, - { - "cell_type": "code", - "source": "SELECT SUM (Level) FROM players", - "metadata": { - "trusted": true - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "markdown", - "source": "Grouping also works:", - "metadata": {} - }, - { - "cell_type": "code", - "source": "SELECT Level, SUM(Hitpoints) AS `Total Hitpoints`\nFROM players\nGROUP BY Level\nORDER BY `Total Hitpoints` DESC;", - "metadata": { - "trusted": true - }, - "execution_count": 11, - "outputs": [ - { - "execution_count": 11, - "output_type": "execute_result", - "data": { - "text/html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
LevelTotal Hitpoints
340
220
110
", - "text/plain": "+-------+-----------------+\n| Level | Total Hitpoints |\n+-------+-----------------+\n| 3 | 40 |\n+-------+-----------------+\n| 2 | 20 |\n+-------+-----------------+\n| 1 | 10 |\n+-------+-----------------+" - }, - "metadata": {} - } - ] - }, - { - "cell_type": "markdown", - "source": "## Charting Using Vega\n\nThe `jupyter-xeus/xeus-sqlite` kernel also bundles Vega charting components.\n\nVega charts can be generated by piping the result of a SQL query into a Vega line magic command.", - "metadata": {} - }, - { - "cell_type": "code", - "source": "%XVEGA_PLOT\n X_FIELD Level\n Y_FIELD Hitpoints\n MARK circle\n WIDTH 100\n HEIGHT 200\n <>\n SELECT Level, Hitpoints FROM players", - "metadata": { - "trusted": true - }, - "execution_count": 12, - "outputs": [ - { - "execution_count": 12, - "output_type": "execute_result", - "data": { - "text/html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
LevelHitpoints
340
220
110
", - "text/plain": "+-------+-----------+\n| Level | Hitpoints |\n+-------+-----------+\n| 3 | 40 |\n+-------+-----------+\n| 2 | 20 |\n+-------+-----------+\n| 1 | 10 |\n+-------+-----------+" - }, - "metadata": {} - }, - { - "execution_count": 12, - "output_type": "execute_result", - "data": { - "application/vnd.vegalite.v3+json": { - "$schema": "https://vega.github.io/schema/vega-lite/v4.json", - "config": { - "axis": { - "grid": true - } - }, - "data": { - "values": [ - { - "Hitpoints": "name", - "Level": "name" - }, - { - "Hitpoints": "40", - "Level": "3" - }, - { - "Hitpoints": "20", - "Level": "2" - }, - { - "Hitpoints": "10", - "Level": "1" - } - ] - }, - "encoding": { - "x": { - "field": "Level", - "type": "quantitative" - }, - "y": { - "field": "Hitpoints", - "type": "quantitative" - } - }, - "height": 200, - "mark": { - "type": "circle" - }, - "width": 100 - }, - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJMAAAD3CAYAAAAZgGZZAAAAAXNSR0IArs4c6QAAFBRJREFUeF7tnQlsFlUXhk9Ly77+gAUryCIgUIWwVQJKEbAGBEWpLFJZQqrmVwFBi1qgSItIoCAgSqSyCT8KyJZIoICyBatYoSxhKwpYbEGBFixr6Z9zzVe6fT132pnp943vTYhgz9w5896n79yZuTPHJycnJ4fQoIAJCvgAJhNURBdKAcAEEExTADCZJiU6AkxgwDQFAJNpUqIjy2G6c+cOXb58merWrZur9t9//02VKlUiX19fjICDFLAcpnHjxtGhQ4do69at9Oeff9KQIUPIz8+Pzpw5Q2+//TYNHz7cQXI681D2HUmlX/+4rA6ucf1a1Ll1YJEHailMGzdupM8++4zYnRim6dOn09WrVyk2NpbS0tKofv36xC5VuXJlZ46CA46KQUrYfzrfkfTq0KRIoCyD6fTp0/Tqq69SVFQUxcTEKJhGjRpFPXv2pEGDBhHfK+XTXEpKCjVp0sQBsjvzEFZuO0ynUv9xJVd7KLAWDekZVOiALYHpxo0b1L17d4qPj6crV65QdHS0gunFF19UfwYMGKASCQgIoMTERGrUqBHt2bOH9u7dmy9BnmeFhIQ4c5S85Kg2/5xK5/7Mys2WzyK2wsTghIaGUseOHSkjI4NOnDhBERERFBgYSNWrV6cxY8ZQdnY21apVS8HmbiL+0UcfUWRkZJnKzg7rCc5ZVnnkPc1lZWWpKYmtpzneaWpqqoLgwIEDFBcXR6tXr6akpCSaP3++cin+N///ffv2uYUFMN2Tpqxg4gxcE3C+Km/Xquj5EsdZcprLS8ePP/6o5k0M0PXr16l379509OhR9feEhAQKDg4GTBreW5YwudKTcrAcpqJ0OnfuHNWrV4/8/f2LlRHO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u9PTTT9PEiRPVs8SpU6cqiN577z2KjY1Vi83Y0XhtUPfu3dVzL35w/fnnn9PFixeJ7zg/8cQTgMkb4TCaszuYVq9eTa7X39lleIXo77//rlZHdujQgfz8/JQbtWrVSq0AeOGFF9Tq0ccee4x69eql3Gz37t20efNmev/99wGT0YHxxnh3MH344YfKfXi5SJMmTXIPLTIyUp3K+L+vv/66Ot2x+/DDY36Ni52MHcrVeJkJP8zFac4b6TCYswumqKgo9TSdG7sOz3P4tMYwvfLKKzRz5kz1/7/55hvil04bNmyoYvv27Uu8EuLSpUtUu3Ztat68OX3xxRe0atUqSkxMpA0bNtAzzzwDmAyOi1eGu2AqmDyvPeLF/rxU5cKFC2r+xAvMnnzySRXKa7ASEhLUqY5Pcdz4FkN0dLRaSclt1qxZ9NZbb6k5Fm4NeCUe5ibNb7WcPXuWGjRooJxJp3F8nTp1yvR1Kp08pRjcGpAUws+1FQBM2lIhUFIAMEkK4efaCgAmbakQKCkAmCSF8HNtBf4PeeHBOWN20+UAAAAASUVORK5CYII=" - }, - "metadata": {} - } - ] - }, - { - "cell_type": "markdown", - "source": "## Database Admininstration\n\nSeveral line magics are defined to support database administration", - "metadata": {} - }, - { - "cell_type": "code", - "source": "%TABLE_EXISTS players", - "metadata": { - "trusted": true - }, - "execution_count": 15, - "outputs": [ - { - "execution_count": 15, - "output_type": "execute_result", - "data": { - "text/plain": "The table players exists." - }, - "metadata": {} - } - ] - }, - { - "cell_type": "code", - "source": "%TABLE_EXISTS npcs", - "metadata": { - "trusted": true - }, - "execution_count": 16, - "outputs": [ - { - "execution_count": 16, - "output_type": "execute_result", - "data": { - "text/plain": "The table npcs doesn't exist." - }, - "metadata": {} - } - ] - }, - { - "cell_type": "code", - "source": "%GET_INFO", - "metadata": { - "trusted": true - }, - "execution_count": 17, - "outputs": [ - { - "execution_count": 17, - "output_type": "execute_result", - "data": { - "text/plain": "Magic header string: SQLite format 3\nPage size bytes: 4096\nFile format write version: 1\nFile format read version: 1\nReserved space bytes: 0\nMax embedded payload fraction 64\nMin embedded payload fraction: 32\nLeaf payload fraction: 32\nFile change counter: 4\nDatabase size pages: 2\nFirst freelist trunk page: 0\nTotal freelist trunk pages: 0\nSchema cookie: 1\nSchema format number: 4\nDefault page cache size bytes: 0\nLargest B tree page number: 0\nDatabase text encoding: 1\nUser version: 0\nIncremental vaccum mode: 0\nApplication ID: 0\nVersion valid for: 4\nSQLite version: 3032003\n" - }, - "metadata": {} - } - ] - }, - { - "cell_type": "markdown", - "source": "## Connecting to a Different Databases\n\nCreating a new database will connect the kernel to the new database instance.", - "metadata": {} - }, - { - "cell_type": "code", - "source": "%CREATE potato.db ", - "metadata": { - "trusted": true - }, - "execution_count": 18, - "outputs": [] - }, - { - "cell_type": "code", - "source": "CREATE TABLE potaters(production INTEGER)", - "metadata": { - "trusted": true - }, - "execution_count": 19, - "outputs": [] - }, - { - "cell_type": "code", - "source": "INSERT INTO potaters (production) VALUES (7)", - "metadata": { - "trusted": true - }, - "execution_count": 20, - "outputs": [] - }, - { - "cell_type": "code", - "source": "SELECT * FROM potaters", - "metadata": { - "trusted": true - }, - "execution_count": 21, - "outputs": [ - { - "execution_count": 21, - "output_type": "execute_result", - "data": { - "text/html": "\n\n\n\n\n\n\n
production
7
", - "text/plain": "+------------+\n| production |\n+------------+\n| 7 |\n+------------+" - }, - "metadata": {} - } - ] - }, - { - "cell_type": "markdown", - "source": "The original database is lost:", - "metadata": {} - }, - { - "cell_type": "code", - "source": "SELECT Name, Level, Hitpoints FROM players;", - "metadata": { - "trusted": true - }, - "execution_count": 23, - "outputs": [ - { - "ename": "Error", - "evalue": "no such table: players", - "traceback": [ - "Error: no such table: players" - ], - "output_type": "error" - } - ] - } - ] -} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e1cf1fef6..1c8f6799c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,25 +1,21 @@ # Core modules (mandatory) -jupyterlite-core==0.2.3 -jupyterlab~=4.0.11 -notebook~=7.0.7 +jupyterlite-core==0.3.0 +jupyterlab~=4.1.6 +notebook~=7.1.2 # Python kernel (optional) -jupyterlite-pyodide-kernel==0.2.3 +jupyterlite-pyodide-kernel==0.3.1 # JavaScript kernel (optional) -jupyterlite-javascript-kernel==0.2.3 +jupyterlite-javascript-kernel==0.3.0 # Language support (optional) jupyterlab-language-pack-fr-FR jupyterlab-language-pack-zh-CN -# SQLite kernel (optional) -jupyterlite-xeus-sqlite==0.2.1 # P5 kernel (optional) jupyterlite-p5-kernel==0.1.0 -# Lua kernel (optional) -jupyterlite-xeus-lua==0.3.1 # JupyterLab: Fasta file renderer (optional) jupyterlab-fasta>=3.3.0,<4