Refactor and enhance Marimo session files with new functionality and improved structure

This commit is contained in:
2025-09-08 02:52:33 +02:00
parent c10a4ea114
commit 2e7c80bae8
6 changed files with 297 additions and 63 deletions
@@ -0,0 +1,60 @@
{
"version": "1",
"metadata": {
"marimo_version": "0.15.2"
},
"cells": [
{
"id": "Hbol",
"code_hash": "1d0db38904205bec4d6f6f6a1f6cec3e",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "jNiy",
"code_hash": "ed0e59fac5eadee837eb138b47d09a4e",
"outputs": [
{
"type": "data",
"data": {
"text/html": "<span class=\"markdown prose dark:prose-invert\"><h1 id=\"python-cargar-librerias-desde-rutas-locales-para-ediciones\">Python: Cargar librerias desde rutas locales para ediciones</h1></span>"
}
}
],
"console": []
},
{
"id": "MJUe",
"code_hash": "161ebcb820075ae0ed102ae0a00f47c2",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "vblA",
"code_hash": "50bee6be6f844ae38ba836c4d509cda2",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
}
]
}
@@ -7,49 +7,111 @@
{
"id": "Hbol",
"code_hash": "1d0db38904205bec4d6f6f6a1f6cec3e",
"outputs": [],
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "MJUe",
"code_hash": "161ebcb820075ae0ed102ae0a00f47c2",
"outputs": [],
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "vblA",
"code_hash": "f7f5821d3695ae3da07f153aa5a1a7a6",
"outputs": [],
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "bkHC",
"code_hash": "dad9563ab733290d13df7d9f3c1f904b",
"outputs": [],
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "lEQa",
"code_hash": "eea45b0636482cfa9d88aa3c65db2599",
"outputs": [],
"console": []
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": [
{
"type": "stream",
"name": "stdout",
"text": "Script guardado en scripts/mi_script.sh y listo para ejecutarse.\n"
}
]
},
{
"id": "PKri",
"code_hash": "de1dd307acb19774134d7d0913854010",
"outputs": [],
"code_hash": "4cc7a1b87ff12543d3fffe238e2a2d60",
"outputs": [
{
"type": "data",
"data": {
"text/html": "<marimo-ui-element object-id='PKri-0' random-id='963c369a-5d28-d0ed-5c6b-98916d27f0c0'><marimo-anywidget data-initial-value='{&quot;command&quot;: &quot;cd /; ls -la&quot;, &quot;working_directory&quot;: &quot;.&quot;}' data-label='null' data-js-url='&quot;./@file/13084-67400-jTwu0X5C.js&quot;' data-js-hash='&quot;9055546e1ba28284347070d3b4da988a&quot;' data-css='&quot;&quot;' data-buffer-paths='[]'></marimo-anywidget></marimo-ui-element>"
}
}
],
"console": []
},
{
"id": "Xref",
"code_hash": "9a13086a1230097669e15deae4b7eb72",
"outputs": [],
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "SFPL",
"code_hash": null,
"outputs": [],
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
}
]
@@ -0,0 +1,60 @@
{
"version": "1",
"metadata": {
"marimo_version": "0.15.2"
},
"cells": [
{
"id": "Hbol",
"code_hash": "1d0db38904205bec4d6f6f6a1f6cec3e",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "jNiy",
"code_hash": "ed0e59fac5eadee837eb138b47d09a4e",
"outputs": [
{
"type": "data",
"data": {
"text/html": "<span class=\"markdown prose dark:prose-invert\"><h1 id=\"python-cargar-librerias-desde-rutas-locales-para-ediciones\">Python: Cargar librerias desde rutas locales para ediciones</h1></span>"
}
}
],
"console": []
},
{
"id": "MJUe",
"code_hash": "161ebcb820075ae0ed102ae0a00f47c2",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "vblA",
"code_hash": "50bee6be6f844ae38ba836c4d509cda2",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
}
]
}
@@ -0,0 +1,60 @@
{
"version": "1",
"metadata": {
"marimo_version": "0.15.2"
},
"cells": [
{
"id": "Hbol",
"code_hash": "1d0db38904205bec4d6f6f6a1f6cec3e",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "CKaf",
"code_hash": "51c9f6fae7a49cf2ab61edf5a1909ddc",
"outputs": [
{
"type": "data",
"data": {
"text/html": "<span class=\"markdown prose dark:prose-invert\"><h1 id=\"shell-ejecucion-de-comandos-de-terminal\">Shell: Ejecucion de comandos de terminal</h1></span>"
}
}
],
"console": []
},
{
"id": "vblA",
"code_hash": "6223d6d79d5e4a56fa0fb9a4d7d96559",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "PKri",
"code_hash": "4cc7a1b87ff12543d3fffe238e2a2d60",
"outputs": [
{
"type": "data",
"data": {
"text/html": "<marimo-ui-element object-id='PKri-0' random-id='0e533e76-0386-a83a-5155-ec662b39a7dd'><marimo-anywidget data-initial-value='{&quot;command&quot;: &quot;cd /; ls -la&quot;, &quot;working_directory&quot;: &quot;.&quot;}' data-label='null' data-js-url='&quot;./@file/13084-77871-sFDEdVSb.js&quot;' data-js-hash='&quot;9055546e1ba28284347070d3b4da988a&quot;' data-css='&quot;&quot;' data-buffer-paths='[]'></marimo-anywidget></marimo-ui-element>"
}
}
],
"console": []
}
]
}
@@ -7,6 +7,12 @@ app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _(mo):
mo.md(r"""# Python: Cargar librerias desde rutas locales para ediciones""")
return
@@ -83,6 +89,7 @@ def _():
@app.cell
def _(import_local_libs):
LIBS = {
# "nombre de la libreria" : "ruta de la libreria"
"moutils": "/home/lucas/DataProyects/git_proyects/moutils"
}
@@ -90,59 +97,6 @@ def _(import_local_libs):
# Ahora ya puedes importar normal
from moutils import shell, ShellWidget
return (ShellWidget,)
@app.cell
def _():
bash_code = """#!/bin/bash
# Espera input del usuario
read -p "Write the host to ping" destino
# Ejecuta ping indefinidamente
ping "$destino"
"""
return (bash_code,)
@app.cell
def _(bash_code):
import os
# Crear la carpeta scripts si no existe
os.makedirs("scripts", exist_ok=True)
# Ruta del archivo .sh dentro de scripts
script_path = os.path.join("scripts", "mi_script.sh")
# Guardar el contenido en el archivo
with open(script_path, "w") as f:
f.write(bash_code)
# Dar permisos de ejecución
os.chmod(script_path, 0o755)
print(f"Script guardado en {script_path} y listo para ejecutarse.")
return
@app.cell
def _(ShellWidget):
console = ShellWidget(command="bash -x ./scripts/mi_script.sh", run=True)
console
return
@app.cell
def _():
# console.kill()
return
@app.cell
def _():
return
+38
View File
@@ -0,0 +1,38 @@
import marimo
__generated_with = "0.15.2"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _(mo):
mo.md(r"""# Shell: Ejecucion de comandos de terminal""")
return
@app.cell
def _():
import sys
import os
sys.path.append(os.path.join(os.environ["SNIPPETS_ROUTE"], "widgets"))
# Ahora ya puedes importar normal
from marimo_shell import shell, ShellWidget
return (ShellWidget,)
@app.cell
def _(ShellWidget):
console = ShellWidget(command="cd /; ls -la", run=True)
console
return
if __name__ == "__main__":
app.run()