Get help from the marimo community

I downloaded and installed the Marimo extension in VSCode recently but whenever i try to open the file as VSCode notebook, it indicates Loading...
Server tries to connect with localhost but doesn't.
How can i use it in VSCode?
1 comment
s
I've tried the following code:

Plain Text
ztimesbtn = mo.ui.button(value = False, on_click=lambda value: not value, label="Show answer")

ztimeslst = [mo.md(
    r"""
    Note that $\Bbb Z$ is not a group if we instead take the operation to be multiplication.  

    In this example, we do have a set and operation.  The operation is associative.

    In fact, there is even an identity element!  

    It is 


    """), 
    ztimesbtn]


and then in another cell

Plain Text
if ztimesbtn.value:
    mo.vstack(ztimeslst + [mo.md(r""" 1. """)])
else:
    mo.vstack(ztimeslst)


However, the second cell does not render anything. I tried looking at examples of how to use buttons and such but I don't see anything that would fix this.

It might even be helpful to ask something slightly more general: How do you make a cell "return" an HTML object that the cell then renders? In most cases you just write the object and run the cell, but if the object isn't the final thing that the cell evaluates, is there some other way?
Hi everyone, I've pushed a question on the Github regarding the handling of state between multiple data editors. I know there are some experts around, so don't hesitate to check it out if you're looking for a challenge 💪

Thanks 🙏
I'm trying to render a thing like this:

Plain Text
mo.md(
    r"""
    Just as with propositions:
    """ 
)

mo.callout(mo.md(r"""
    Two sentences, $\alpha$ and $\beta$, are **equivalent** 
    """))


where each one returns some kind of markdown object, inside a single cell. Essentially, I want a single cell to have some text in a callout and some not in it.

It's not a big deal if I have to split up the cells but just wondering if this kind of thing is possible.
2 comments
M
d
I'm using Marimo as an API playground. It works very well, Marimo seems very suitable. Can I make it simpler? Now each HTTP request requires two cells - one for request, another for response - and a tuple of some_endpoint, some_endpoint_button. Is it possible to implement it in one cell and/or avoid exposing button variable?

Bonus question: how do I implement a "copy as curl" button? I can't find functionality to deal with system clipbard.

Plain Text
@app.cell
def _(config, private):
    admin_projects, admin_projects_button = private.request('GET', f'/admin/user/{config.user_id}/projects')
    admin_projects
    return admin_projects, admin_projects_button


@app.cell
def _(admin_projects, admin_projects_button):
    admin_projects.run(admin_projects_button)
    return


In this example private.request() returns (Request, mo.ui.run_button) tuple:

Plain Text
def request(self, method, url, *, json = None):
    return (
        Request(
            method,
            f'{self.base_url}{url}',
            json=json,
            auth=self.auth,
            timeout=self.timeout,
            client=self,
        ),
        mo.ui.run_button(label='send'),
    )


And Request.run() uses mo.stop and mo.status.spinner:

Plain Text
def run(self, button):
    mo.stop(not button.value, mo.md('press *send* ☝️'))
    with mo.status.spinner(subtitle='Loading...') as _spinner:
        response = self.send()
    return response
1 comment
M

I'm looking for a way, any way, to highlight text in markdown in marimo, be able to right click or press a button, and add a comment to the highlighted text.
Is this possible in marimo?

Hello everyone, I'm testing out the experimental data editor function and would like to set a configuration of type "dropdown" for one of the columns of the data editor (in a similar fashion to what is done in Streamlit). Does anyone have a tip on how to do that ? If not possible with the experimental data editor in marimo, are there other jupyter widget which could be used and are compatible with marimo ?

Thanks for the help 🙏
2 comments
l
A
Can python turtles be used with marimo?
1 comment
M
Have there been any discussions on adding non-python runtimes? i.e. R is the one I had in mind. I know pyodide is specifically python which would make this quite hard, but just wanted to ask whether there had been any discussion around this already
2 comments
l
I thought asking this here before opening an issue on github.

Consider this notebook with these cells.
(it is a versy small simplified version of hg agents course)

I have attached the screenshot of dependencis,

  1. Cell-1 should be run before cell-2. but as in this there are no explicit dependency between them and the cell-2 is getting the env variables underhood we can not guarantee this execution order.
easy solution to solve this problem is mergin cell-1 and cell-2, but for the next problem we can not do that.

  1. Cell-2 should run before cell-5 and cell-4
to be able to monitor the agent. Again this order is not guaranteed.
One dirty solution would be to define a variable in Cell-2 and reference it in Cell-5 and Cell-4.

Does Marimo provides a proper solution for this promblem?
8 comments
A
H
e
How would I go about using wasm export in isolated run mode with dependencies from an internal index?
1 comment
t
I need one cell to load a file browser and open the file and another cell to plot the data. I cannot figure out how to get the 2nd cell to resolve the dependency on the first. Here is my code:

Plain Text
@app.cell
def _(mo, np):
    def handle_file_select(info):
        global img
        for f in info:
            img = np.load(f.path)["arr_0"]

    mo.ui.file_browser(
        initial_path="/mnt/notchpeak/transfer/new_worms/",
        on_change=handle_file_select,
        multiple=False,
    )

    return img


@app.cell
def _(plt, img):
    if img is not None:
        plt.imshow(img)
        plt.tight_layout()
        plt.show()
heya, I often call methods one after the other (e.g. using polars or pandas) but I only see the interactive docstring for the first method as the type of the ouptut cannot be inferred, is that the expected behaviour?
7 comments
M
l
i am using a shared server to run the notebooks on, and don't like the idea of having api keys stored on plain text in files accessible by all.
so i wondered, is there a way to use openai without storing the api key in the marimo.toml in plain text?
5 comments
M
r
Hello! I have some question regarding the edit server: https://huggingface.co/spaces/YoanSallami/synalinks-noteboooks I did this, which is working fine, I took care to not write into env variables to avoid leak between users, but I would want to disable the editing (but not be in app more) is that possible ? The password protection, to my understanding is to access it right, not do enable/disable editing?
2 comments
A
Y
While setting up our Marimo notebook, I found a problem with importing the postgres library.

Is there a way to input a custom wheel or pull from another source, potentially forge?

I am new to notebooks, and I enjoy the python only sytax. Thank you development team for your amazing work with this product.
1 comment
M
I'd like to use the mo.ui.refresh https://docs.marimo.io/api/inputs/refresh/?h=refresh functionality in my app to periodically update some figures in my app, but I would rather not display the refresh button in the app, is there a way to get the refresh functionality without rendering the refresh button in the app?
8 comments
S
A
M
is there an equivalent to nbviewer.org for Marimo, where I can drop a link to a .py file hosted on GitHub and view it online?
11 comments
M
A
H
a
R
RyanFras
·
R
Solved

Copy Paste Vim

Hi Team, this seems like such an obvious thing but I can't figure it out. I'm new to vim. Are there any recommended resources for learning the vim keybindings used in Marimo?

In particular, how can I copy / paste? <CNTRL>+c + <CNTRL>+p doesn't seem to work for me? I'm using the vscode extension to run embedded Marimo notebooks.

If I press <ESC> how do I go with my cursor inside the cell block again?
4 comments
A
R
I created some beautiful slides with marimo... is there an easy way to print them, 1 slide per page? Tried using the browser printing function but I have to go slide by slide, and fitting the frame in the page is not working quite well either.
1 comment
M
Hey, I've got some notebooks where I use UI components (selectors) that have some default values. I'd expect the default behaviour is that the variables assigned to those components would simply use those values when running the notebooks as scripts but I am unsure that's the expected/designed behaviour but i don't see my script returning an error or warning either
7 comments
l
S
M

My personal use case of Marimo so far has been to add notebooks to existing python codebases. This has been working really well since the notebook code can easily import my own code from outside the notebook. However, this doesn't seem compatible with the WASM export functionality at the moment. It seems like the WASM export functionality simply takes the code explicitly defined in the notebook and converts it to WASM via pyodide, but really, in my use case I'd need the export to pass all of my python source code to pyodide so that my notebook actually works.


Here's a minimal example:

Python
# test_file.py
def test_external_func() -> str:
    return "Some string from external func!"
Python
# TestExternal.py
import marimo

__generated_with = "0.11.5"
app = marimo.App(width="medium")


@app.cell
def _():
    import marimo as mo
    return (mo,)


@app.cell
def _():
    from test_file import test_external_func

    test_external_func()
    return (test_external_func,)


if __name__ == "__main__":
    app.run()


The above notebook runs as expected when invoked via marimo edit TestExternal.py :

But fails when run as a WASM export:


I know that there's been a recent addition to support loading data files into the WASM export. Is there any analogous way to include additional python code that I have locally (not just 3rd party libraries on pypi)?

Is script metadata intended to work in edit mode also? I don't think it is for me / i find that the ScriptConfigManager always has filename set to the dir where I start marimo from
3 comments
M
R
Hi, new to marimo and obsessed!

mo.ui.table is giving me a lot of flexibility for displaying my data but for my purpose I just want to use the table as an output so I don't need the checkboxes on the left that allow for selecting elements.

Is there a way I can implement this?
2 comments
S
S