Skip to content

Commit

Permalink
fix-failing-CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Darshan808 authored and Zsailer committed Feb 13, 2025
1 parent 8aa6b1e commit 78b7654
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion examples/simple/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "jupyter-server-example"
description = "Jupyter Server Example"
readme = "README.md"
license = "MIT"
license = "BSD-3-Clause"
requires-python = ">=3.9"
dependencies = [
"jinja2",
Expand Down
116 changes: 58 additions & 58 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3060,6 +3060,24 @@ def start_app(self) -> None:
)
self.exit(1)

info = self.log.info
for line in self.running_server_info(kernel_count=False).split("\n"):
info(line)
info(
_i18n(
"Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)."
)
)
if "dev" in __version__:
info(
_i18n(
"Welcome to Project Jupyter! Explore the various tools available"
" and their corresponding documentation. If you are interested"
" in contributing to the platform, please visit the community"
" resources section at https://jupyter.org/community.html."
)
)

self.write_server_info_file()

if not self.no_browser_open_file:
Expand All @@ -3069,6 +3087,46 @@ def start_app(self) -> None:
if self.open_browser and not self.sock:
self.launch_browser()

if self.identity_provider.token and self.identity_provider.token_generated:
# log full URL with generated token, so there's a copy/pasteable link
# with auth info.
if self.sock:
self.log.critical(
"\n".join(
[
"\n",
"Jupyter Server is listening on %s" % self.display_url,
"",
(
"UNIX sockets are not browser-connectable, but you can tunnel to "
f"the instance via e.g.`ssh -L 8888:{self.sock} -N user@this_host` and then "
f"open e.g. {self.connection_url} in a browser."
),
]
)
)
else:
if self.no_browser_open_file:
message = [
"\n",
_i18n("To access the server, copy and paste one of these URLs:"),
" %s" % self.display_url,
]
else:
message = [
"\n",
_i18n(
"To access the server, open this file in a browser:",
),
" %s" % urljoin("file:", pathname2url(self.browser_open_file)),
_i18n(
"Or copy and paste one of these URLs:",
),
" %s" % self.display_url,
]

self.log.critical("\nDP_DAI2\n" + "\n".join(message))

async def _cleanup(self) -> None:
"""General cleanup of files, extensions and kernels created
by this instance ServerApp.
Expand Down Expand Up @@ -3126,64 +3184,6 @@ async def _post_start(self):
except Exception as err:
self.log.error(err)

info = self.log.info
for line in self.running_server_info(kernel_count=False).split("\n"):
info(line)
info(
_i18n(
"Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)."
)
)
if "dev" in __version__:
info(
_i18n(
"Welcome to Project Jupyter! Explore the various tools available"
" and their corresponding documentation. If you are interested"
" in contributing to the platform, please visit the community"
" resources section at https://jupyter.org/community.html."
)
)

if self.identity_provider.token and self.identity_provider.token_generated:
# log full URL with generated token, so there's a copy/pasteable link
# with auth info.
if self.sock:
self.log.critical(
"\n".join(
[
"\n",
"Jupyter Server is listening on %s" % self.display_url,
"",
(
"UNIX sockets are not browser-connectable, but you can tunnel to "
f"the instance via e.g.`ssh -L 8888:{self.sock} -N user@this_host` and then "
f"open e.g. {self.connection_url} in a browser."
),
]
)
)
else:
if self.no_browser_open_file:
message = [
"\n",
_i18n("To access the server, copy and paste one of these URLs:"),
" %s" % self.display_url,
]
else:
message = [
"\n",
_i18n(
"To access the server, open this file in a browser:",
),
" %s" % urljoin("file:", pathname2url(self.browser_open_file)),
_i18n(
"Or copy and paste one of these URLs:",
),
" %s" % self.display_url,
]

self.log.critical("\n".join(message))

def start(self) -> None:
"""Start the Jupyter server app, after initialization
Expand Down

0 comments on commit 78b7654

Please sign in to comment.