From 0e10d87292e31a6331db67d29f3b44cfbfa00a46 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 1 Jun 2015 13:06:33 -0700 Subject: [PATCH] Implement @takluyver's doc generation API --- .gitignore | 1 + docs/Makefile | 7 +- docs/autogen_config.py | 46 ++++++ docs/source/config.rst | 307 ----------------------------------------- 4 files changed, 53 insertions(+), 308 deletions(-) create mode 100644 docs/autogen_config.py delete mode 100644 docs/source/config.rst diff --git a/.gitignore b/.gitignore index d142057e4..5f0ebca85 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ dist _build docs/man/*.gz docs/source/api/generated +docs/source/config.rst docs/gh-pages notebook/static/components notebook/static/style/*.min.css* diff --git a/docs/Makefile b/docs/Makefile index a752654ba..66550b6d2 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -50,12 +50,17 @@ help: clean: rm -rf $(BUILDDIR)/* + rm -rf source/config.rst -html: +html: source/config.rst $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." +source/config.rst: + python3 autogen_config.py + @echo "Created docs for config options" + dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo diff --git a/docs/autogen_config.py b/docs/autogen_config.py new file mode 100644 index 000000000..c48a24d54 --- /dev/null +++ b/docs/autogen_config.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +from qtconsole.qtconsoleapp import JupyterQtConsoleApp + +header = """\ +.. _config: + +Config +====== + +The notebook server can be run with a variety of command line arguments. +A list of available options can be found below in the :ref:`options section +`. + +Defaults for these options can also be set by creating a file named +``jupyter_notebook_config.py`` in your Jupyter *profile folder*. The profile +folder is a subfolder of your Jupyter directory; to find out where it is +located, run:: + + $ jupyter locate + +To create a new set of default configuration files, with lots of information +on available options, use:: + + $ jupyter profile create + +.. seealso:: + + :ref:`public_server` + + +.. _options: + +Options +------- + +This list of options can be generated by running the following and hitting +enter:: + + $ jupyter notebook --help + +""" + +with open("source/config.rst", 'w') as f: + f.write(header) + f.write(JupyterQtConsoleApp().document_config_options()) diff --git a/docs/source/config.rst b/docs/source/config.rst deleted file mode 100644 index 9ca9b8172..000000000 --- a/docs/source/config.rst +++ /dev/null @@ -1,307 +0,0 @@ -.. _config: - -Config -====== - -The notebook server can be run with a variety of command line arguments. -A list of available options can be found below in the :ref:`options section -`. - -Defaults for these options can also be set by creating a file named -``jupyter_notebook_config.py`` in your Jupyter *profile folder*. The profile -folder is a subfolder of your Jupyter directory; to find out where it is -located, run:: - - $ jupyter locate - -To create a new set of default configuration files, with lots of information -on available options, use:: - - $ jupyter profile create - -.. seealso:: - - :ref:`public_server` - - -.. _options: - -Options -------- - -This list of options can be generated by running the following and hitting -enter:: - - $ jupyter notebook --help - - -NotebookApp.allow_credentials : Bool - Default: ``False`` - - Set the Access-Control-Allow-Credentials: true header - -NotebookApp.allow_origin : Unicode - Default: ``''`` - - Set the Access-Control-Allow-Origin header - - Use '*' to allow any origin to access your server. - - Takes precedence over allow_origin_pat. - - -NotebookApp.allow_origin_pat : Unicode - Default: ``''`` - - Use a regular expression for the Access-Control-Allow-Origin header - - Requests from an origin matching the expression will get replies with: - - Access-Control-Allow-Origin: origin - - where `origin` is the origin of the request. - - Ignored if allow_origin is set. - - -NotebookApp.base_project_url : Unicode - Default: ``'/'`` - - DEPRECATED use base_url - -NotebookApp.base_url : Unicode - Default: ``'/'`` - - The base URL for the notebook server. - - Leading and trailing slashes can be omitted, - and will automatically be added. - - -NotebookApp.browser : Unicode - Default: ``''`` - - Specify what command to use to invoke a web - browser when opening the notebook. If not specified, the - default browser will be determined by the `webbrowser` - standard library module, which allows setting of the - BROWSER environment variable to override it. - - -NotebookApp.certfile : Unicode - Default: ``''`` - - The full path to an SSL/TLS certificate file. - -NotebookApp.cluster_manager_class : Type - Default: ```` - - The config manager class to use - -NotebookApp.contents_manager_class : Type - Default: ```` - - - The kernel spec manager class to use. Should be a subclass - of `jupyter_client.kernelspec.KernelSpecManager`. - - The Api of KernelSpecManager is provisional and might change - without warning between this version of IPython and the next stable one. - - -NotebookApp.keyfile : Unicode - Default: ``''`` - - The full path to a private key file for usage with SSL/TLS. - -NotebookApp.login_handler_class : Type - Default: ```` - - The login handler class to use. - -NotebookApp.logout_handler_class : Type - Default: ```` - - The logout handler class to use. - -NotebookApp.mathjax_url : Unicode - Default: ``''`` - - The url for MathJax.js. - -NotebookApp.notebook_dir : Unicode - Default: ``''`` - - The directory to use for notebooks and kernels. - -NotebookApp.open_browser : Bool - Default: ``True`` - - Whether to open in a browser after starting. - The specific browser used is platform dependent and - determined by the python standard library `webbrowser` - module, unless it is overridden using the --browser - (NotebookApp.browser) configuration option. - - -NotebookApp.password : Unicode - Default: ``''`` - - Hashed password to use for web authentication. - - To generate, type in a python/IPython shell: - - from notebook.auth import passwd; passwd() - - The string should be of the form type:salt:hashed-password. - - -NotebookApp.port : Int - Default: ``8888`` - - The port the notebook server will listen on. - -NotebookApp.port_retries : Int - Default: ``50`` - - The number of additional ports to try if the specified port is not available. - -NotebookApp.pylab : Unicode - Default: ``'disabled'`` - - - DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib. - - -NotebookApp.reraise_server_extension_failures : Bool - Default: ``False`` - - Reraise exceptions encountered loading server extensions? - -NotebookApp.server_extensions : List - Default: ``[]`` - - Python modules to load as notebook server extensions. This is an experimental API, and may change in future releases. - -NotebookApp.session_manager_class : Type - Default: ``