Skip to content

Commit c076f60

Browse files
authored
Merge pull request #7 from Darshan808/fix-ci
Fix CI Failures
2 parents 1abbce9 + e966a3c commit c076f60

File tree

3 files changed

+68
-59
lines changed

3 files changed

+68
-59
lines changed

docs/source/developers/extensions.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ Here is basic example:
8787
"""
8888
await asyncio.sleep(.1)
8989
90+
.. note:: The server startup banner (displaying server info and access URLs) is printed before starting asynchronous tasks, so those tasks might still be running even after the banner appears.
91+
92+
.. WARNING: This note is also present in the "Starting asynchronous tasks from an ExtensionApp" section.
93+
If you update it here, please update it there as well.
9094
9195
Making an extension discoverable
9296
--------------------------------
@@ -386,6 +390,11 @@ Here is a basic (pseudo) code example:
386390
async def stop_extension(self):
387391
self.my_background_task.cancel()
388392
393+
.. note:: The server startup banner (displaying server info and access URLs) is printed before starting asynchronous tasks, so those tasks might still be running even after the banner appears.
394+
395+
.. WARNING: This note is also present in the "Starting asynchronous tasks from an extension" section.
396+
If you update it here, please update it there as well.
397+
389398
390399
Distributing a server extension
391400
===============================

examples/simple/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "jupyter-server-example"
77
description = "Jupyter Server Example"
88
readme = "README.md"
9-
license = ""
9+
license = "BSD-3-Clause"
1010
requires-python = ">=3.8"
1111
dependencies = [
1212
"jinja2",

jupyter_server/serverapp.py

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,6 +3061,24 @@ def start_app(self) -> None:
30613061
)
30623062
self.exit(1)
30633063

3064+
info = self.log.info
3065+
for line in self.running_server_info(kernel_count=False).split("\n"):
3066+
info(line)
3067+
info(
3068+
_i18n(
3069+
"Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)."
3070+
)
3071+
)
3072+
if "dev" in __version__:
3073+
info(
3074+
_i18n(
3075+
"Welcome to Project Jupyter! Explore the various tools available"
3076+
" and their corresponding documentation. If you are interested"
3077+
" in contributing to the platform, please visit the community"
3078+
" resources section at https://jupyter.org/community.html."
3079+
)
3080+
)
3081+
30643082
self.write_server_info_file()
30653083

30663084
if not self.no_browser_open_file:
@@ -3070,6 +3088,46 @@ def start_app(self) -> None:
30703088
if self.open_browser and not self.sock:
30713089
self.launch_browser()
30723090

3091+
if self.identity_provider.token and self.identity_provider.token_generated:
3092+
# log full URL with generated token, so there's a copy/pasteable link
3093+
# with auth info.
3094+
if self.sock:
3095+
self.log.critical(
3096+
"\n".join(
3097+
[
3098+
"\n",
3099+
"Jupyter Server is listening on %s" % self.display_url,
3100+
"",
3101+
(
3102+
"UNIX sockets are not browser-connectable, but you can tunnel to "
3103+
f"the instance via e.g.`ssh -L 8888:{self.sock} -N user@this_host` and then "
3104+
f"open e.g. {self.connection_url} in a browser."
3105+
),
3106+
]
3107+
)
3108+
)
3109+
else:
3110+
if self.no_browser_open_file:
3111+
message = [
3112+
"\n",
3113+
_i18n("To access the server, copy and paste one of these URLs:"),
3114+
" %s" % self.display_url,
3115+
]
3116+
else:
3117+
message = [
3118+
"\n",
3119+
_i18n(
3120+
"To access the server, open this file in a browser:",
3121+
),
3122+
" %s" % urljoin("file:", pathname2url(self.browser_open_file)),
3123+
_i18n(
3124+
"Or copy and paste one of these URLs:",
3125+
),
3126+
" %s" % self.display_url,
3127+
]
3128+
3129+
self.log.critical("\n".join(message))
3130+
30733131
async def _cleanup(self) -> None:
30743132
"""General cleanup of files, extensions and kernels created
30753133
by this instance ServerApp.
@@ -3127,64 +3185,6 @@ async def _post_start(self):
31273185
except Exception as err:
31283186
self.log.error(err)
31293187

3130-
info = self.log.info
3131-
for line in self.running_server_info(kernel_count=False).split("\n"):
3132-
info(line)
3133-
info(
3134-
_i18n(
3135-
"Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)."
3136-
)
3137-
)
3138-
if "dev" in __version__:
3139-
info(
3140-
_i18n(
3141-
"Welcome to Project Jupyter! Explore the various tools available"
3142-
" and their corresponding documentation. If you are interested"
3143-
" in contributing to the platform, please visit the community"
3144-
" resources section at https://jupyter.org/community.html."
3145-
)
3146-
)
3147-
3148-
if self.identity_provider.token and self.identity_provider.token_generated:
3149-
# log full URL with generated token, so there's a copy/pasteable link
3150-
# with auth info.
3151-
if self.sock:
3152-
self.log.critical(
3153-
"\n".join(
3154-
[
3155-
"\n",
3156-
"Jupyter Server is listening on %s" % self.display_url,
3157-
"",
3158-
(
3159-
"UNIX sockets are not browser-connectable, but you can tunnel to "
3160-
f"the instance via e.g.`ssh -L 8888:{self.sock} -N user@this_host` and then "
3161-
f"open e.g. {self.connection_url} in a browser."
3162-
),
3163-
]
3164-
)
3165-
)
3166-
else:
3167-
if self.no_browser_open_file:
3168-
message = [
3169-
"\n",
3170-
_i18n("To access the server, copy and paste one of these URLs:"),
3171-
" %s" % self.display_url,
3172-
]
3173-
else:
3174-
message = [
3175-
"\n",
3176-
_i18n(
3177-
"To access the server, open this file in a browser:",
3178-
),
3179-
" %s" % urljoin("file:", pathname2url(self.browser_open_file)),
3180-
_i18n(
3181-
"Or copy and paste one of these URLs:",
3182-
),
3183-
" %s" % self.display_url,
3184-
]
3185-
3186-
self.log.critical("\n".join(message))
3187-
31883188
def start(self) -> None:
31893189
"""Start the Jupyter server app, after initialization
31903190

0 commit comments

Comments
 (0)