Run Autoformatters (#6335)

Steven Silvester 4 years ago committed by GitHub
parent 7dcd3e7719
commit a7717d90f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,10 +1,10 @@
[bumpversion]
current_version = 7, 0, 0, 'alpha', 2
current_version = 7, 0, 0, "alpha", 2
commit = False
tag = False
parse = (?P<major>\d+)\,\ (?P<minor>\d+)\,\ (?P<patch>\d+)\,\ \'(?P<release>\S+)\'\,\ (?P<build>\d+)
parse = (?P<major>\d+)\,\ (?P<minor>\d+)\,\ (?P<patch>\d+)\,\ \"(?P<release>\S+)\"\,\ (?P<build>\d+)
serialize =
{major}, {minor}, {patch}, '{release}', {build}
{major}, {minor}, {patch}, "{release}", {build}
[bumpversion:part:release]
optional_value = final

@ -1,6 +1,3 @@
lint-staged.config.js
.eslintrc.js
node_modules
**/build
**/lib

@ -38,8 +38,10 @@ jobs:
run: |
# TODO: improve this with a mock package?
# This step is to ensure the workflow always starts with a final version
sed -i -E "s/VersionInfo\(.*\)/VersionInfo\(9, 8, 7, 'final', 0\)/" notebook/_version.py
sed -i -E "s/current_version = .*/current_version = 9, 8, 7, 'final', 0/" .bumpversion.cfg
sed -i -E 's/= VersionInfo\(.*\)/= VersionInfo\(9, 8, 7, "final", 0\)/' notebook/_version.py
cat notebook/_version.py
sed -i -E 's/current_version = .*/current_version = 9, 8, 7, "final", 0/' .bumpversion.cfg
cat .bumpversion.cfg
jlpm run lerna version 9.8.7 --no-push --force-publish --no-git-tag-version --yes
git commit -am "Release 9.8.7"

@ -7,31 +7,31 @@ repos:
rev: v4.1.0
hooks:
- id: forbid-new-submodules
# - id: end-of-file-fixer
# - id: check-case-conflict
# - id: check-executables-have-shebangs
# - id: requirements-txt-fixer
# - id: check-added-large-files
# - id: check-case-conflict
# - id: check-toml
# - id: check-yaml
# - id: debug-statements
# - id: check-builtin-literals
# - id: trailing-whitespace
# exclude: .bumpversion.cfg
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
- id: check-added-large-files
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: check-builtin-literals
- id: trailing-whitespace
exclude: .bumpversion.cfg
# - repo: https://github.com/psf/black
# rev: 22.3.0
# hooks:
# - id: black
# args: ["--line-length", "100"]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ["--line-length", "100"]
# - repo: https://github.com/PyCQA/isort
# rev: 5.10.1
# hooks:
# - id: isort
# files: \.py$
# args: [--profile=black]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
files: \.py$
args: [--profile=black]
# - repo: https://github.com/pycqa/flake8
# rev: 4.0.1

@ -1,5 +1,5 @@
sphinx>=1.3.6
pydata-sphinx-theme
myst_parser
nbsphinx
pydata-sphinx-theme
sphinx>=1.3.6
sphinxcontrib_github_alt
myst_parser

@ -12,9 +12,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
import shutil
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@ -51,43 +51,43 @@ for item in sys.path:
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.autosummary',
'sphinx.ext.mathjax',
'IPython.sphinxext.ipython_console_highlighting',
'nbsphinx',
'sphinxcontrib_github_alt',
'myst_parser'
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.autosummary",
"sphinx.ext.mathjax",
"IPython.sphinxext.ipython_console_highlighting",
"nbsphinx",
"sphinxcontrib_github_alt",
"myst_parser",
]
myst_enable_extensions = ["html_image"]
myst_update_mathjax = False
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
master_doc = "index"
# General information about the project.
project = 'Jupyter Notebook'
copyright = '2015, Jupyter Team, https://jupyter.org'
author = 'The Jupyter Team'
project = "Jupyter Notebook"
copyright = "2015, Jupyter Team, https://jupyter.org"
author = "The Jupyter Team"
# ghissue config
github_project_url = "https://github.com/jupyter/notebook"
@ -96,13 +96,13 @@ github_project_url = "https://github.com/jupyter/notebook"
# |version| and |release|, also used in various other places throughout the
# built documents.
#
_version_py = '../../notebook/_version.py'
_version_py = "../../notebook/_version.py"
version_ns = {}
exec(compile(open(_version_py).read(), _version_py, 'exec'), version_ns)
exec(compile(open(_version_py).read(), _version_py, "exec"), version_ns)
# The short X.Y version.
version = '%i.%i' % version_ns['version_info'][:2]
version = "%i.%i" % version_ns["version_info"][:2]
# The full version, including alpha/beta/rc tags.
release = version_ns['__version__']
release = version_ns["__version__"]
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -113,37 +113,41 @@ language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['examples/Notebook/.ipynb_checkpoints', 'examples/Notebook/nbpackage/*.ipynb', 'examples/Notebook/nbpackage/nbs/*.ipynb']
exclude_patterns = [
"examples/Notebook/.ipynb_checkpoints",
"examples/Notebook/nbpackage/*.ipynb",
"examples/Notebook/nbpackage/nbs/*.ipynb",
]
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
@ -158,17 +162,17 @@ html_theme = "pydata_sphinx_theme"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
@ -177,7 +181,7 @@ html_logo = "examples/images/jupyter_logo.png"
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@ -185,134 +189,131 @@ html_logo = "examples/images/jupyter_logo.png"
# NOTE: Sphinx's 'make html' builder will throw a warning about an unfound
# _static directory. Do not remove or comment out html_static_path
# since it is needed to properly generate _static in the build directory
html_static_path = ['_static']
html_static_path = ["_static"]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'JupyterNotebookdoc'
htmlhelp_basename = "JupyterNotebookdoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'JupyterNotebook.tex', 'Jupyter Notebook Documentation',
'https://jupyter.org', 'manual'),
(
master_doc,
"JupyterNotebook.tex",
"Jupyter Notebook Documentation",
"https://jupyter.org",
"manual",
),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'jupyternotebook', 'Jupyter Notebook Documentation',
[author], 1)
]
man_pages = [(master_doc, "jupyternotebook", "Jupyter Notebook Documentation", [author], 1)]
# If true, show URL addresses after external links.
#man_show_urls = False
# man_show_urls = False
# -- Options for link checks ----------------------------------------------
linkcheck_ignore = [
'http://127\.0\.0\.1/*'
]
linkcheck_ignore = ["http://127\.0\.0\.1/*"]
# -- Options for Texinfo output -------------------------------------------
@ -321,29 +322,35 @@ linkcheck_ignore = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'JupyterNotebook', 'Jupyter Notebook Documentation',
author, 'JupyterNotebook', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"JupyterNotebook",
"Jupyter Notebook Documentation",
author,
"JupyterNotebook",
"One line description of project.",
"Miscellaneous",
),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# texinfo_no_detailmenu = False
intersphinx_mapping = {
'ipython': ('https://ipython.readthedocs.io/en/stable/', None),
'nbconvert': ('https://nbconvert.readthedocs.io/en/latest/', None),
'nbformat': ('https://nbformat.readthedocs.io/en/latest/', None),
'jupyter': ('https://jupyter.readthedocs.io/en/latest/', None),
"ipython": ("https://ipython.readthedocs.io/en/stable/", None),
"nbconvert": ("https://nbconvert.readthedocs.io/en/latest/", None),
"nbformat": ("https://nbformat.readthedocs.io/en/latest/", None),
"jupyter": ("https://jupyter.readthedocs.io/en/latest/", None),
}
spelling_lang='en_US'
spelling_word_list_filename='spelling_wordlist.txt'
spelling_lang = "en_US"
spelling_word_list_filename = "spelling_wordlist.txt"

@ -3,4 +3,4 @@
from IPython.display import FileLink, display
files =!ls *.py
for f in files:
display(FileLink(f))
display(FileLink(f))

@ -4,4 +4,4 @@ from IPython.display import FileLinks, display
dirs =!ls -d */
for d in dirs:
if d != '__pycache__/':
display(FileLinks(d))
display(FileLinks(d))

@ -16,4 +16,4 @@ This means Notebook v7 is able to reuse many of the existing extensions from the
If you would like to develop a prebuilt extension for Notebook v7, check out:
- `JupyterLab Extension Tutorial <https://jupyterlab.readthedocs.io/en/latest/extension/extension_tutorial.html>`_: A tutorial to learn how to make a simple JupyterLab extension.
- The `JupyterLab Extension Examples Repository <https://github.com/jupyterlab/extension-examples>`_: A short tutorial series to learn how to develop extensions for JupyterLab by example.
- The `JupyterLab Extension Examples Repository <https://github.com/jupyterlab/extension-examples>`_: A short tutorial series to learn how to develop extensions for JupyterLab by example.

@ -9,4 +9,4 @@ User Documentation
ui_components
examples/Notebook/examples_index.rst
troubleshooting
changelog
changelog

@ -3,23 +3,20 @@
from collections import namedtuple
VersionInfo = namedtuple('VersionInfo', [
'major',
'minor',
'micro',
'releaselevel',
'serial'
])
VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"])
# DO NOT EDIT THIS DIRECTLY! It is managed by bumpversion
version_info = VersionInfo(7, 0, 0, 'alpha', 2)
version_info = VersionInfo(7, 0, 0, "alpha", 2)
_specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''}
_specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
__version__ = '{}.{}.{}{}'.format(
__version__ = "{}.{}.{}{}".format(
version_info.major,
version_info.minor,
version_info.micro,
(''
if version_info.releaselevel == 'final'
else _specifier_[version_info.releaselevel] + str(version_info.serial)))
(
""
if version_info.releaselevel == "final"
else _specifier_[version_info.releaselevel] + str(version_info.serial)
),
)

@ -2,17 +2,18 @@ import os
from os.path import join as pjoin
from jupyter_core.application import base_aliases
from jupyter_server.serverapp import flags
from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.extension.handler import (
ExtensionHandlerMixin,
ExtensionHandlerJinjaMixin,
ExtensionHandlerMixin,
)
from jupyter_server.utils import url_path_join as ujoin, url_escape, url_is_absolute
from jupyter_server.serverapp import flags
from jupyter_server.utils import url_escape, url_is_absolute
from jupyter_server.utils import url_path_join as ujoin
from jupyterlab.commands import get_app_dir, get_user_settings_dir, get_workspaces_dir
from jupyterlab_server import LabServerApp
from jupyterlab_server.config import get_page_config, recursive_update, LabConfig
from jupyterlab_server.handlers import is_url, _camelCase
from jupyterlab_server.config import LabConfig, get_page_config, recursive_update
from jupyterlab_server.handlers import _camelCase, is_url
from notebook_shim.shim import NotebookConfigShimMixin
from tornado import web
from tornado.gen import maybe_future
@ -43,18 +44,18 @@ class NotebookBaseHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, Jup
"collaborative": app.collaborative,
}
if 'hub_prefix' in app.serverapp.tornado_settings:
if "hub_prefix" in app.serverapp.tornado_settings:
tornado_settings = app.serverapp.tornado_settings
hub_prefix = tornado_settings['hub_prefix']
page_config['hubPrefix'] = hub_prefix
page_config['hubHost'] = tornado_settings['hub_host']
page_config['hubUser'] = tornado_settings['user']
page_config['shareUrl'] = ujoin(hub_prefix, 'user-redirect')
hub_prefix = tornado_settings["hub_prefix"]
page_config["hubPrefix"] = hub_prefix
page_config["hubHost"] = tornado_settings["hub_host"]
page_config["hubUser"] = tornado_settings["user"]
page_config["shareUrl"] = ujoin(hub_prefix, "user-redirect")
# Assume the server_name property indicates running JupyterHub 1.0.
if hasattr(app.serverapp, 'server_name'):
page_config['hubServerName'] = app.serverapp.server_name
api_token = os.getenv('JUPYTERHUB_API_TOKEN', '')
page_config['token'] = api_token
if hasattr(app.serverapp, "server_name"):
page_config["hubServerName"] = app.serverapp.server_name
api_token = os.getenv("JUPYTERHUB_API_TOKEN", "")
page_config["token"] = api_token
mathjax_config = self.settings.get("mathjax_config", "TeX-AMS_HTML-full,Safe")
# TODO Remove CDN usage.
@ -97,7 +98,7 @@ class NotebookBaseHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, Jup
class RedirectHandler(NotebookBaseHandler):
@web.authenticated
def get(self):
return self.redirect(self.base_url+'tree')
return self.redirect(self.base_url + "tree")
class TreeHandler(NotebookBaseHandler):
@ -110,7 +111,7 @@ class TreeHandler(NotebookBaseHandler):
- Redirected to notebook page if path is a notebook
- Render the raw file if path is any other file
"""
path = path.strip('/')
path = path.strip("/")
cm = self.contents_manager
if await maybe_future(cm.dir_exists(path=path)):
@ -120,18 +121,18 @@ class TreeHandler(NotebookBaseHandler):
# Set treePath for routing to the directory
page_config = self.get_page_config()
page_config['treePath'] = path
page_config["treePath"] = path
tpl = self.render_template("tree.html", page_config=page_config)
return self.write(tpl)
elif await maybe_future(cm.file_exists(path)):
# it's not a directory, we have redirecting to do
model = await maybe_future(cm.get(path, content=False))
if model['type'] == 'notebook':
url = ujoin(self.base_url, 'notebooks', url_escape(path))
if model["type"] == "notebook":
url = ujoin(self.base_url, "notebooks", url_escape(path))
else:
# Return raw content if file is not a notebook
url = ujoin(self.base_url, 'files', url_escape(path))
url = ujoin(self.base_url, "files", url_escape(path))
self.log.debug("Redirecting %s to %s", self.request.path, url)
self.redirect(url)
else:
@ -190,17 +191,15 @@ class JupyterNotebookApp(NotebookConfigShimMixin, LabServerApp):
expose_app_in_browser = Bool(
False,
config=True,
help="Whether to expose the global app instance to browser via window.jupyterapp"
help="Whether to expose the global app instance to browser via window.jupyterapp",
)
collaborative = Bool(
False, config=True, help="Whether to enable collaborative mode."
)
collaborative = Bool(False, config=True, help="Whether to enable collaborative mode.")
flags = flags
flags['expose-app-in-browser'] = (
{'JupyterNotebookApp': {'expose_app_in_browser': True}},
"Expose the global app instance to browser via window.jupyterlab."
flags["expose-app-in-browser"] = (
{"JupyterNotebookApp": {"expose_app_in_browser": True}},
"Expose the global app instance to browser via window.jupyterlab.",
)
flags["collaborative"] = (
{"JupyterNotebookApp": {"collaborative": True}},

@ -1,9 +1,9 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from pathlib import Path
import subprocess
import sys
from pathlib import Path
import setuptools
@ -40,7 +40,7 @@ data_files_spec = [
]
try:
from jupyter_packaging import wrap_installers, npm_builder, get_data_files
from jupyter_packaging import get_data_files, npm_builder, wrap_installers
# In develop mode, just run yarn
builder = npm_builder(build_cmd="build", npm="jlpm", force=True)
@ -59,7 +59,7 @@ try:
setup_args = dict(cmdclass=cmdclass, data_files=get_data_files(data_files_spec))
except ImportError:
setup_args = dict()
setup_args = {}
if __name__ == "__main__":

@ -5,7 +5,8 @@
"app/**/*",
"buildutils/**/*",
"ui-tests/**/*",
"docs/**/*"
"docs/**/*",
".eslintrc.js"
],
"types": ["jest"]
}

Loading…
Cancel
Save