Skip to content

Commit

Permalink
Merge branch 'main' of github.com:jupyter-server/jupyter_server
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed May 15, 2023
2 parents a0b6218 + d7e3b08 commit 380ec3a
Show file tree
Hide file tree
Showing 30 changed files with 962 additions and 132 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/integration-tests.yml

This file was deleted.

43 changes: 38 additions & 5 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ jobs:
- name: Run the tests on windows
if: ${{ startsWith(matrix.os, 'windows') }}
run: hatch run cov:nowarn -s || hatch run cov:nowarn --lf
- name: Coverage
run: |
pip install codecov coverage[toml]
codecov
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1

test_docs:
name: Test Docs
Expand Down Expand Up @@ -173,10 +170,46 @@ jobs:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

integration_check:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Run the tests
run: hatch run cov:integration
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1

integration_check_pypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "pypy-3.8"
- name: Run the tests
run: hatch run test:nowarn --integration_tests=true

coverage:
runs-on: ubuntu-latest
needs:
- integration_check
- build
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/report-coverage@v1
with:
fail_under: 80

tests_check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- build
- coverage
- integration_check_pypy
- test_docs
- test_lint
- test_examples
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repos:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.260
rev: v0.0.263
hooks:
- id: ruff
args: ["--fix"]
5 changes: 4 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.9"
sphinx:
configuration: docs/source/conf.py
python:
version: 3.8
install:
# install itself with pip install .
- method: pip
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Jupyter Server

[![Build Status](https://github.com/jupyter-server/jupyter_server/actions/workflows/python-tests.yml/badge.svg?query=branch%3Amain++)](https://github.com/jupyter-server/jupyter_server/actions/workflows/python-tests.yml/badge.svg?query=branch%3Amain++)
[![codecov](https://codecov.io/gh/jupyter-server/jupyter_server/branch/main/graph/badge.svg?token=S9WiBg2iL0)](https://codecov.io/gh/jupyter-server/jupyter_server)
[![Documentation Status](https://readthedocs.org/projects/jupyter-server/badge/?version=latest)](http://jupyter-server.readthedocs.io/en/latest/?badge=latest)

The Jupyter Server provides the backend (i.e. the core services, APIs, and REST endpoints) for Jupyter web applications like Jupyter notebook, JupyterLab, and Voila.
Expand Down
16 changes: 0 additions & 16 deletions codecov.yml

This file was deleted.

6 changes: 6 additions & 0 deletions docs/source/api/jupyter_server.gateway.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Submodules
----------


.. automodule:: jupyter_server.gateway.connections
:members:
:undoc-members:
:show-inheritance:


.. automodule:: jupyter_server.gateway.gateway_client
:members:
:undoc-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
"ipython": ("https://ipython.readthedocs.io/en/stable/", None),
"nbconvert": ("https://nbconvert.readthedocs.io/en/stable/", None),
"nbformat": ("https://nbformat.readthedocs.io/en/stable/", None),
"jupyter_core": ("https://jupyter_core.readthedocs.io/en/stable/", None),
"jupyter_core": ("https://jupyter-core.readthedocs.io/en/stable/", None),
"tornado": ("https://www.tornadoweb.org/en/stable/", None),
"traitlets": ("https://traitlets.readthedocs.io/en/stable/", None),
}
Expand Down
2 changes: 1 addition & 1 deletion docs/source/operators/multiple-extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Managing multiple extensions
One of the major benefits of Jupyter Server is that you can run serve multiple
Jupyter frontend applications above the same Tornado web server.
That's because every Jupyter frontend application is now a server extension.
When you run a Jupyter Server will multiple extensions enabled, each extension
When you run a Jupyter Server with multiple extensions enabled, each extension
appends its own set of handlers and static assets to the server.

Listing extensions
Expand Down
21 changes: 17 additions & 4 deletions docs/source/operators/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ Other required fields will be filled with `None`.
Identity Model
^^^^^^^^^^^^^^

The identity model is the model accessed at `/api/me`,
and describes the currently authenticated user.
The identity model is the model accessed at `/api/me`, and describes the currently authenticated user.

It has the following fields:

Expand Down Expand Up @@ -179,6 +178,20 @@ color
such as for collaboration cursors.
May be `null` if unavailable.


The default implementation of the identity provider is stateless, meaning it doesn't store user information
on the server side. Instead, it utilizes session cookies to generate and store random user information on the
client side.

When a user logs in or authenticates, the server generates a session cookie that is stored on the client side.
This session cookie is used to keep track of the identity model between requests. If the client does not
support session cookies or fails to send the cookie in subsequent requests, the server will treat each request
as coming from a new anonymous user and generate a new set of random user information for each request.

To ensure proper functionality of the identity model and to maintain user context between requests, it's
important for clients to support session cookies and send it in subsequent requests. Failure to do so may
result in the server generating a new anonymous user for each request, leading to loss of user context.

Authorization
*************

Expand Down Expand Up @@ -209,8 +222,8 @@ request handler. Each request is labeled as either a "read", "write", or "execut
to ~all other permissions via other means.

The ``resource`` being accessed refers to the resource name in the Jupyter Server's API endpoints.
In most cases, this is matches the field after `/api/`.
For instance, values for ``resource`` in the endpoints provided by the base jupyter server package,
In most cases, this is the field after `/api/`.
For instance, values for ``resource`` in the endpoints provided by the base Jupyter Server package,
and the corresponding permissions:

.. list-table::
Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/_sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def pkg_commit_hash(pkg_path):
if p.exists(p.join(cur_path, ".git")):
try:
proc = subprocess.Popen(
["git", "rev-parse", "--short", "HEAD"],
["git", "rev-parse", "--short", "HEAD"], # noqa
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=pkg_path,
Expand Down
17 changes: 15 additions & 2 deletions jupyter_server/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,13 @@ def wrapper(self, *args, **kwargs):


class FileFindHandler(JupyterHandler, web.StaticFileHandler):
"""subclass of StaticFileHandler for serving files from a search path"""
"""subclass of StaticFileHandler for serving files from a search path
The setting "static_immutable_cache" can be set up to serve some static
file as immutable (e.g. file name containing a hash). The setting is a
list of base URL, every static file URL starting with one of those will
be immutable.
"""

# cache search results, don't search for files more than once
_static_paths: dict = {}
Expand All @@ -951,8 +957,15 @@ class FileFindHandler(JupyterHandler, web.StaticFileHandler):
def set_headers(self):
"""Set the headers."""
super().set_headers()

immutable_paths = self.settings.get("static_immutable_cache", [])

# allow immutable cache for files
if any(self.request.path.startswith(path) for path in immutable_paths):
self.set_header("Cache-Control", "public, max-age=31536000, immutable")

# disable browser caching, rely on 304 replies for savings
if "v" not in self.request.arguments or any(
elif "v" not in self.request.arguments or any(
self.request.path.startswith(path) for path in self.no_cache_paths
):
self.set_header("Cache-Control", "no-cache")
Expand Down
40 changes: 40 additions & 0 deletions jupyter_server/event_schemas/gateway_client/v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"$id": https://events.jupyter.org/jupyter_server/gateway_client/v1
version: 1
title: Gateway Client activities.
personal-data: true
description: |
Record events of a gateway client.
type: object
required:
- status
- msg
properties:
status:
enum:
- error
- success
description: |
Status received by Gateway client based on the rest api operation to gateway kernel.
This is a required field.
Possible values:
1. error
Error response from a rest api operation to gateway kernel.
2. success
Success response from a rest api operation to gateway kernel.
status_code:
type: number
description: |
Http response codes from a rest api operation to gateway kernel.
Examples: 200, 400, 502, 503, 599 etc.
msg:
type: string
description: |
Description of the event being emitted.
gateway_url:
type: string
description: |
Gateway url where the remote server exist.
71 changes: 71 additions & 0 deletions jupyter_server/event_schemas/kernel_actions/v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"$id": https://events.jupyter.org/jupyter_server/kernel_actions/v1
version: 1
title: Kernel Manager activities
personal-data: true
description: |
Record events of a kernel manager.
type: object
required:
- action
- kernel_id
- msg
properties:
action:
enum:
- start
- interrupt
- shutdown
- restart
description: |
Action performed by the Kernel Manager.
This is a required field.
Possible values:
1. start
A kernel has been started with the given kernel id.
2. interrupt
A kernel has been interrupted for the given kernel id.
3. shutdown
A kernel has been shut down for the given kernel id.
4. restart
A kernel has been restarted for the given kernel id.
kernel_id:
type: string
description: |
Kernel id.
This is a required field.
kernel_name:
type: string
description: |
Name of the kernel.
status:
enum:
- error
- success
description: |
Status received from a rest api operation to kernel server.
This is a required field.
Possible values:
1. error
Error response from a rest api operation to kernel server.
2. success
Success response from a rest api operation to kernel server.
status_code:
type: number
description: |
Http response codes from a rest api operation to kernel server.
Examples: 200, 400, 502, 503, 599 etc
msg:
type: string
description: |
Description of the event specified in action.
Loading

0 comments on commit 380ec3a

Please sign in to comment.