Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: # %% in export script #1350

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion marimo/_server/export/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def export_as_script(
]
code = (
f'\n__generated_with = "{__version__}"\n\n'
+ "\n\n# ---\n\n".join(codes)

Choose a reason for hiding this comment

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

Thanks for implementing this. I'd add # %% before the first cell also.

Copy link
Contributor

Choose a reason for hiding this comment

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

I updated to be right before each cell, and included on the first cell

+ "\n\n# %%\n\n".join(codes)
)

download_filename = get_download_filename(file_manager, ".script.py")
Expand Down
1 change: 1 addition & 0 deletions marimo/_utils/marimo_path.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion tests/_cli/snapshots/script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ __generated_with = "0.0.0"

import marimo as mo

# ---
# %%

slider = mo.ui.slider(0, 10)
Loading