A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
Fix for Incorrect OS Version Displayed for Windows 11 in `marimo env` Command (#1410)
Srihari Thyagarajan43a07c4795c3
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.mdnew file mode 100644index 0000000000..bd39740c9b--- /dev/null+++ b/.github/PULL_REQUEST_TEMPLATE.md@@ -0,0 +1,42 @@+# Pull Request Template++## 📝 Summary++<!--+Provide a brief summary of what this pull request is addressing. Describe the changes made and the main issue fixed or feature implemented. Keep it concise and informative.+-->++## 🔍 Description of Changes++<!--+Detail the specific changes made in this pull request. Explain the problem addressed and how it was resolved. If applicable, provide before and after comparisons or any relevant details to help reviewers understand the changes easily.+-->++## 🛠️ Additional Information++<!--+Include any additional information or context that might be helpful for reviewers. This could include additional dependencies, screenshots, performance improvements, or any other relevant information.+-->++## 📋 Checklist Before Submitting++- [ ] I have read the [contributor guidelines](../CONTRIBUTING.md) and the Pull Request section.+- [ ] This PR fixes an issue (If applicable, specify issue number #).+- [ ] This change was discussed or approved through an issue or the community [discussions](https://github.com/marimo-team/marimo/discussions) (Please provide a link if applicable).+- [ ] I have added necessary tests for the changes made.+- [ ] I have run the code and verified that it works as expected.++## 🧩 Related Issues++<!--+If this PR fixes any issues, list them here by number (e.g., Fixes #123).+-->++## 📜 Who Can Review?++<!--+Tag potential reviewers from the community or maintainers who might be interested in reviewing this pull request. This helps expedite the review process and ensures that the PR receives timely attention.+-->++<!-- Your PR will be reviewed more quickly if you can figure out the right person to tag with @ -->+@akshayka OR @mscolnickdiff --git a/marimo/_cli/envinfo.py b/marimo/_cli/envinfo.pyindex dad99a20f4..c3c66e5746 100644--- a/marimo/_cli/envinfo.py+++ b/marimo/_cli/envinfo.py@@ -2,21 +2,30 @@from __future__ import annotationsimport platform+import sysfrom typing import Unionfrom marimo import __version__-from marimo._utils.health import (- get_chrome_version,- get_node_version,- get_required_modules_list,-)+from marimo._utils.health import get_chrome_version, get_node_version, get_required_modules_list+def is_win11() -> bool:+ """+ Check if the operating system is Windows 11.++ Returns:+ bool: True if the OS is Windows 11, False otherwise.+ """+ return sys.getwindowsversion().build >= 22000def get_system_info() -> dict[str, Union[str, dict[str, str]]]:+ os_version = platform.release()+ if platform.system() == "Windows" and is_win11():+ os_version = "11"+info = {"marimo": __version__,"OS": platform.system(),- "OS Version": platform.release(),+ "OS Version": os_version,# e.g., x86 or arm"Processor": platform.processor(),"Python Version": platform.python_version(),diff --git a/marimo/_islands/island_generator.py b/marimo/_islands/island_generator.pyindex adf1a3c34c..61417d4f37 100644--- a/marimo/_islands/island_generator.py+++ b/marimo/_islands/island_generator.py@@ -6,7 +6,7 @@ from textwrap import dedentfrom typing import TYPE_CHECKING, List, Optional, Union, castfrom marimo import __version__, _loggers-from marimo._ast.app import App, InternalApp, _AppConfig+from marimo._ast.app import App, InternalAppfrom marimo._ast.cell import Cell, CellConfigfrom marimo._ast.compiler import compile_cellfrom marimo._messaging.cell_output import CellOutput@@ -14,10 +14,6 @@ from marimo._output.formatting import as_htmlfrom marimo._output.utils import uri_encode_componentfrom marimo._plugins.stateless.json_output import json_outputfrom marimo._plugins.ui import code_editor-from marimo._server.export import run_app_until_completion-from marimo._server.file_manager import AppFileManager-from marimo._server.file_router import AppFileRouter-from marimo._utils.marimo_path import MarimoPathif TYPE_CHECKING:from marimo._server.session.session_view import SessionView@@ -182,42 +178,6 @@ class MarimoIslandGenerator:self._app_id = app_idself._app = InternalApp(App())self._stubs: List[MarimoIslandStub] = []- self._config = _AppConfig()-- @staticmethod- def from_file(- filename: str,- display_code: bool = False,- ) -> MarimoIslandGenerator:- """- Create a MarimoIslandGenerator and populate MarimoIslandStubs- using code cells from a marimo *.py file.-- *Args:*-- - filename (str): Marimo .py filename to convert to reactive HTML.- - display_code (bool): Whether to display the code in HTML snippets.- """- path = MarimoPath(filename)- file_router = AppFileRouter.from_filename(path)- file_key = file_router.get_unique_file_key()- assert file_key is not None- file_manager = file_router.get_file_manager(file_key)-- generator = MarimoIslandGenerator()- stubs = []- for cell_data in file_manager.app.cell_manager.cell_data():- stubs.append(- generator.add_code(- cell_data.code,- display_code=display_code,- )- )-- generator._stubs = stubs- generator._config = file_manager.app.config-- return generatordef add_code(self,@@ -270,6 +230,9 @@ class MarimoIslandGenerator:- App: The built app."""+ from marimo._server.export import run_app_until_completion+ from marimo._server.file_manager import AppFileManager+if self.has_run:raise ValueError("You can only call build() once")@@ -294,11 +257,6 @@ class MarimoIslandGenerator:"""Render the header for the app.This should be included in the <head> tag of the page.-- *Args:*-- - version_override (str): Marimo version to use for loaded js/css.- - _development_url (str): If True, uses local marimo islands js."""# This loads:@@ -358,100 +316,6 @@ class MarimoIslandGenerator:""").strip()- def render_body(- self,- *,- max_width: Optional[str] = None,- margin: Optional[str] = None,- style: Optional[str] = None,- ) -> str:- """- Render the body for the app.- This should be included in the <body> tag of the page.-- *Args:*-- - max_width (str): CSS style max_width property.- - margin (str): CSS style margin property.- - style (str): CSS style. Overrides max_width and margin.- """-- rendered_stubs = []- for stub in self._stubs:- rendered_stubs.append(stub.render())-- body = "\n".join(rendered_stubs)-- if margin is None:- margin = "auto"- if max_width is None:- width = self._config.width- if width == "normal":- max_width = "740px"- elif width == "medium":- max_width = "1110px"- else:- max_width = "none"-- if style is None:- style = f"margin: {margin}; max-width: {max_width};"-- return dedent(- f"""- <div style="{style}">- {body}- </div>- """- ).strip()-- def render_html(- self,- *,- version_override: str = __version__,- _development_url: Union[str | bool] = False,- max_width: Optional[str] = None,- margin: Optional[str] = None,- style: Optional[str] = None,- ) -> str:- """- Render reactive html for the app.-- *Args:*-- - version_override (str): Marimo version to use for loaded js/css.- - _development_url (str): If True, uses local marimo islands js.- - max_width (str): CSS style max_width property.- - margin (str): CSS style margin property.- - style (str): CSS style. Overrides max_width and margin.- """- head = self.render_head(- version_override=version_override,- _development_url=_development_url,- )- body = self.render_body(- max_width=max_width, margin=margin, style=style- )- title = (- self._app_id- if self._config.app_title is None- else self._config.app_title- )-- return dedent(- f"""<!doctype html>- <html lang="en">- <head>- <meta charset="UTF-8" />- <title> {title} </title>- {head}- </head>- <body>- {body}- </body>- </html>- """- ).strip()-def remove_empty_lines(text: str) -> str:return "\n".join([line for line in text.split("\n") if line.strip() != ""])diff --git a/marimo/_server/export/__init__.py b/marimo/_server/export/__init__.pyindex d48ebf1baa..b603c93959 100644--- a/marimo/_server/export/__init__.py+++ b/marimo/_server/export/__init__.py@@ -78,24 +78,6 @@ async def run_app_then_export_as_html(return html, filename-async def run_app_then_export_as_reactive_html(- path: MarimoPath,- include_code: bool,-) -> tuple[str, str]:- import os-- from marimo._islands.island_generator import MarimoIslandGenerator-- generator = MarimoIslandGenerator.from_file(- path.absolute_name, display_code=include_code- )- await generator.build()- html = generator.render_html()- basename = os.path.basename(path.absolute_name)- filename = f"{os.path.splitext(basename)[0]}.html"- return html, filename--async def run_app_until_completion(file_manager: AppFileManager,cli_args: SerializedCLIArgs,