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: marimo config to follow_symlink in StaticFiles #1327

Merged
merged 2 commits into from
May 7, 2024

Conversation

Ubehebe
Copy link
Contributor

@Ubehebe Ubehebe commented May 7, 2024

Hi maintainers, this is a draft of a fix for #1298. It adds a follow_symlink boolean flag to Marimo's ServerConfig (defaulting to false), and propagates it to the call site where the StaticFiles for /assets is constructed. This allows users to set it via their ~/.marimo.toml files like so:

[server]
follow_symlink = true

I've verified this works by patching this PR into my Bazel repo using the setup described here: #1298 (comment). I also verified this PR passes ruff and mypy.

I've kept this PR simple. This is the first time I've tried to change marimo's codebase, so I could definitely have missed things from the discussion in #1298. Suggestions are welcome.

Copy link

vercel bot commented May 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 7, 2024 1:56pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 7, 2024 1:56pm

Copy link

github-actions bot commented May 7, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@@ -31,9 +32,14 @@
# Root directory for static assets
root = os.path.realpath(str(import_files("marimo").joinpath("_static")))

config = UserConfigManager().get_config().get("server", {})
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 wasn't sure how to get the MarimoConfig from a top-level context like this. Most call sites seem to read it off an existing object. Is there a better way than re-instantiating a UserConfigManager?

@Ubehebe
Copy link
Contributor Author

Ubehebe commented May 7, 2024

I have read the CLA Document and I hereby sign the CLA

@@ -31,9 +32,14 @@
# Root directory for static assets
root = os.path.realpath(str(import_files("marimo").joinpath("_static")))

config = UserConfigManager().get_config().get("server", {})
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the best way given the current setup - and fine as is

@Ubehebe
Copy link
Contributor Author

Ubehebe commented May 7, 2024

It looks like the test failures are spurious. I'm also not sure how to sign the CLA. (The bot above told me to post a comment saying I signed it, which I did above, but no luck.)

I fixed a few tests that were asserting on a serialized MarimoConfig. The CLA is now also magically signed.

@mscolnick mscolnick changed the title draft: potential fix for #1298. fix: marimo config to follow_symlink in StaticFiles May 7, 2024
@mscolnick
Copy link
Contributor

@Ubehebe yea the test are snapshot tests - running it once fixes it

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.

looks great! thanks for contribution @Ubehebe

@mscolnick mscolnick merged commit 22a9390 into marimo-team:main May 7, 2024
24 of 25 checks passed
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.

None yet

2 participants