Skip to content

Automagically set the first code cell with only ìmport` statements as a setup cell. #7559

@wwittemancervo

Description

@wwittemancervo

Description

The process to create a new notebook, with a setup cell, is currently not obvious. If you just dive in, none of the cells with just a function in them will be flagged as "reusable", if they include calls to modules or libraries.

I have been using marimo for a year, and I love it, but I never knew about the setup cell. (To be clear, this is a skill issue - it's in the docs!)

Suggested solution

I think it would obey the principle of least astonishment that if your first code cell is only ìmport` statements, it should be automatically flagged as a setup cell.

This is easy to fix if you don't like it, but would make the default organization of code in marimo notebooks work better in marimo.

Are you willing to submit a PR?

  • Yes

Alternatives

I think that #7547 , which suggests the ability to convert a cell into a setup cell, would work, but it is less clear (but perhaps has greater utility, if you want the mechanism to allow converting any cell type to any other).

Additional context

I am not averse to submitting code or a PR, but I have never done either, and I want to learn how before cluttering up the issue with something that inadvertently is a useless distraction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions