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
Make 127.0.0.1 the default host (#909)
Akshay Agrawal2de69c5e0b08
diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.pyindex e2cc62e848..952f7de5e1 100644--- a/marimo/_cli/cli.py+++ b/marimo/_cli/cli.py@@ -173,7 +173,7 @@ edit_help_msg = "\n".join()@click.option("--host",- default="",+ default="127.0.0.1",show_default=True,type=str,help="Host to attach to.",@@ -248,7 +248,7 @@ Example:)@click.option("--host",- default="",+ default="127.0.0.1",show_default=True,type=str,help="Host to attach to.",@@ -367,7 +367,7 @@ Recommended sequence:)@click.option("--host",- default="",+ default="127.0.0.1",show_default=True,type=str,help="Host to attach to.",diff --git a/marimo/_server/api/lifespans.py b/marimo/_server/api/lifespans.pyindex d1d8be4a08..6685b946e6 100644--- a/marimo/_server/api/lifespans.py+++ b/marimo/_server/api/lifespans.py@@ -3,6 +3,7 @@ from __future__ import annotationsimport asyncioimport contextlib+import socketimport sysif sys.version_info < (3, 9):@@ -108,6 +109,20 @@ async def logging(app: Starlette) -> AsyncIterator[None]:port = app.state.portbase_url = app.state.base_url+ try:+ # pretty printing:+ # if the address maps to localhost, print "localhost" to stdout+ if (+ socket.getnameinfo((host, port), socket.NI_NOFQDN)[0]+ == "localhost"+ ):+ host = "localhost"+ except Exception:+ # aggressive try/except in case of platform-specific quirks;+ # nothing to handle, since the `try` logic is just for pretty+ # printing the host name+ ...+# Startup messageif not manager.quiet:print_startup(