Merge pull request #1321 from willingc/doc-services

Add autodoc of services and update services.auth for OAuth
This commit is contained in:
Min RK
2017-08-09 11:37:16 +02:00
committed by GitHub
13 changed files with 88 additions and 36 deletions

View File

@@ -4,6 +4,7 @@ channels:
dependencies: dependencies:
- nodejs - nodejs
- python=3.5 - python=3.5
- alembic
- jinja2 - jinja2
- pamela - pamela
- requests - requests

View File

@@ -1,6 +1,6 @@
{ {
"name": "jupyterhub-docs-build", "name": "jupyterhub-docs-build",
"version": "0.0.0", "version": "0.8.0",
"description": "build JupyterHub swagger docs", "description": "build JupyterHub swagger docs",
"scripts": { "scripts": {
"rest-api": "bootprint openapi ./rest-api.yml source/_static/rest-api" "rest-api": "bootprint openapi ./rest-api.yml source/_static/rest-api"
@@ -8,7 +8,7 @@
"author": "", "author": "",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"devDependencies": { "devDependencies": {
"bootprint": "^0.10.0", "bootprint": "^1.0.0",
"bootprint-openapi": "^0.17.0" "bootprint-openapi": "^1.0.0"
} }
} }

View File

@@ -424,9 +424,6 @@ paths:
responses: responses:
'200': '200':
description: The user or service identified by the API token description: The user or service identified by the API token
schema:
$ref: '#/definitions/User'
$ref: '#/definitions/Service'
'404': '404':
description: A user or service is not found. description: A user or service is not found.
/authorizations/cookie/{cookie_name}/{cookie_value}: /authorizations/cookie/{cookie_name}/{cookie_value}:

View File

@@ -2,9 +2,15 @@
Application configuration Application configuration
========================= =========================
Module: :mod:`jupyterhub.app`
=============================
.. automodule:: jupyterhub.app
.. currentmodule:: jupyterhub.app .. currentmodule:: jupyterhub.app
:class:`JupyterHub` :class:`JupyterHub`
------------------- -------------------
.. autoconfigurable:: JupyterHub .. autoconfigurable:: JupyterHub

View File

@@ -9,13 +9,20 @@ Module: :mod:`jupyterhub.auth`
.. currentmodule:: jupyterhub.auth .. currentmodule:: jupyterhub.auth
:class:`Authenticator`
----------------------
.. autoconfigurable:: Authenticator .. autoconfigurable:: Authenticator
:members: :members:
:class:`LocalAuthenticator`
---------------------------
.. autoconfigurable:: LocalAuthenticator .. autoconfigurable:: LocalAuthenticator
:members: :members:
:class:`PAMAuthenticator`
-------------------------
.. autoconfigurable:: PAMAuthenticator .. autoconfigurable:: PAMAuthenticator

View File

@@ -1,8 +1,8 @@
.. _api-index: .. _api-index:
#################### ##################
The JupyterHub API The JupyterHub API
#################### ##################
:Release: |release| :Release: |release|
:Date: |today| :Date: |today|
@@ -31,6 +31,7 @@ JupyterHub API Reference:
spawner spawner
proxy proxy
user user
service
services.auth services.auth

View File

@@ -9,11 +9,15 @@ Module: :mod:`jupyterhub.proxy`
.. currentmodule:: jupyterhub.proxy .. currentmodule:: jupyterhub.proxy
:class:`Proxy`
--------------
.. autoconfigurable:: Proxy .. autoconfigurable:: Proxy
:members: :members:
:class:`ConfigurableHTTPProxy`
------------------------------
.. autoconfigurable:: ConfigurableHTTPProxy .. autoconfigurable:: ConfigurableHTTPProxy
:members: debug, auth_token, check_running_interval, api_url, command :members: debug, auth_token, check_running_interval, api_url, command

View File

@@ -0,0 +1,17 @@
========
Services
========
Module: :mod:`jupyterhub.services.service`
==========================================
.. automodule:: jupyterhub.services.service
.. currentmodule:: jupyterhub.services.service
:class:`Service`
----------------
.. autoconfigurable:: Service
:members: name, admin, url, api_token, managed, kind, command, cwd, environment, user, oauth_client_id, server, prefix, proxy_spec

View File

@@ -1,5 +1,5 @@
======================= =======================
Authenticating Services Services Authentication
======================= =======================
Module: :mod:`jupyterhub.services.auth` Module: :mod:`jupyterhub.services.auth`
@@ -10,9 +10,16 @@ Module: :mod:`jupyterhub.services.auth`
.. currentmodule:: jupyterhub.services.auth .. currentmodule:: jupyterhub.services.auth
:class:`HubAuth`
----------------
.. autoconfigurable:: HubAuth .. autoconfigurable:: HubAuth
:members: :members:
:class:`HubAuthenticated`
-------------------------
.. autoclass:: HubAuthenticated .. autoclass:: HubAuthenticated
:members: :members:

View File

@@ -1,6 +1,6 @@
============== ========
Spawners Spawners
============== ========
Module: :mod:`jupyterhub.spawner` Module: :mod:`jupyterhub.spawner`
================================= =================================
@@ -15,4 +15,8 @@ Module: :mod:`jupyterhub.spawner`
.. autoconfigurable:: Spawner .. autoconfigurable:: Spawner
:members: options_from_form, poll, start, stop, get_args, get_env, get_state, template_namespace, format_string :members: options_from_form, poll, start, stop, get_args, get_env, get_state, template_namespace, format_string
:class:`LocalProcessSpawner`
----------------------------
.. autoconfigurable:: LocalProcessSpawner .. autoconfigurable:: LocalProcessSpawner

View File

@@ -1,6 +1,6 @@
============= =====
Users Users
============= =====
Module: :mod:`jupyterhub.user` Module: :mod:`jupyterhub.user`
============================== ==============================
@@ -9,11 +9,16 @@ Module: :mod:`jupyterhub.user`
.. currentmodule:: jupyterhub.user .. currentmodule:: jupyterhub.user
:class:`UserDict`
-----------------
.. autoclass:: UserDict
:members:
:class:`User` :class:`User`
------------- -------------
.. class:: Server
.. autoclass:: User .. autoclass:: User
:members: escaped_name :members: escaped_name
@@ -29,3 +34,4 @@ Module: :mod:`jupyterhub.user`
.. attribute:: spawner .. attribute:: spawner
The user's :class:`~.Spawner` instance. The user's :class:`~.Spawner` instance.

View File

@@ -1,12 +1,14 @@
"""Authenticating services with JupyterHub """Authenticating services with JupyterHub.
Cookies are sent to the Hub for verification, replying with a JSON model describing the authenticated user. Cookies are sent to the Hub for verification. The Hub replies with a JSON
model describing the authenticated user.
HubAuth can be used in any application, even outside tornado. ``HubAuth`` can be used in any application, even outside tornado.
``HubAuthenticated`` is a mixin class for tornado handlers that should
authenticate with the Hub.
HubAuthenticated is a mixin class for tornado handlers that should authenticate with the Hub.
""" """
import os import os
import re import re
import socket import socket

View File

@@ -1,16 +1,15 @@
"""A service is a process that talks to JupyterHub """A service is a process that talks to JupyterHub.
Cases:
Types of services:
Managed: Managed:
- managed by JupyterHub (always subprocess, no custom Spawners) - managed by JupyterHub (always subprocess, no custom Spawners)
- always a long-running process - always a long-running process
- managed services are restarted automatically if they exit unexpectedly - managed services are restarted automatically if they exit unexpectedly
Unmanaged: Unmanaged:
- managed by external service (docker, systemd, etc.) - managed by external service (docker, systemd, etc.)
- do not need to be long-running processes, or processes at all - do not need to be long-running processes, or processes at all
URL: needs a route added to the proxy. URL: needs a route added to the proxy.
- Public route will always be /services/service-name - Public route will always be /services/service-name
- url specified in config - url specified in config
@@ -30,13 +29,14 @@ An externally managed service running on a URL::
'api_token': 'super-secret', 'api_token': 'super-secret',
} }
A hub-managed service with no URL: A hub-managed service with no URL::
{ {
'name': 'cull-idle', 'name': 'cull-idle',
'command': ['python', '/path/to/cull-idle'] 'command': ['python', '/path/to/cull-idle']
'admin': True, 'admin': True,
} }
""" """
import pipes import pipes