Skip to content

Conversation

@koaning
Copy link
Contributor

@koaning koaning commented Nov 18, 2025

When dealing with sphinx builds that need marimo to convert files this force flag sure would be nice to have around.

This is the difference:

> uv run marimo convert demo.py -o out.py                                     
Warning: The file 'out.py' already exists. Overwrite? [y/N]: 

> uv run marimo convert demo.py -o out.py --force
Converted notebook saved to out.py

I copied how this test tests a similar feature and noticed that we don't generally expect a non-zero status code. It's because we check for non interactive shells here I think.

Either way, feels like a useful flag, hence the PR.

@vercel
Copy link

vercel bot commented Nov 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Nov 18, 2025 2:32pm

@mscolnick
Copy link
Contributor

cc api change codeowners: @dmadisetti @akshayka

Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does "marimo -y" not work? Which is used to con

if output:
output_path = Path(output)
if prompt_to_overwrite(output_path):
if force or prompt_to_overwrite(output_path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does "marimo -y" not work? Not sure if it's wired up but that should confirm any prompts

Copy link
Contributor Author

@koaning koaning Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I guess I hadn't tried that, mainly because the CLI docs don't point that out. That does totally work!

Related question maybe, why does the marimo export command have a --force flag? Doesn't the marimo -y apply there too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could change this PR to a documentation PR so this is made clear there. Might be better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could add a --force here as well. it is more common and natural than the marimo -y (as you just experienced yourself). im open to adding a --force as well, but want to let the api codeowners (@dmadisetti @akshayka) chime in

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv run marimo convert demo.py > out.py should also work. I don't think we need the extra flag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

Still worth it to turn this PR into a docs PR that mentions the -y flag? It feels hard to discover that one right now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely agree. as a note, -y provides auto accept for everything

@koaning
Copy link
Contributor Author

koaning commented Nov 19, 2025

Made a new PR for the docs update here

@koaning koaning deleted the force-flag-convert branch November 19, 2025 12:05
akshayka added a commit that referenced this pull request Nov 20, 2025
Replaces #7199. 

No need to add a `--force` flag, but would be nice to make the user more
aware. This is a natural place to mention it.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dylan Madisetti <[email protected]>
Co-authored-by: Akshay Agrawal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants