File: setup.py

#!/usr/bin/env python
# coding: utf-8

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from __future__ import print_function

import os
from setuptools import setup

pjoin = os.path.join
here = os.path.abspath(os.path.dirname(__file__))

with open(pjoin(here, "long_description.md")) as f:
    long_description = f.read()

setup_args = dict(
    name                = 'jupyter',
    version             = '1.2.0.dev0',
    description         = "Jupyter metapackage. Install all the Jupyter components in one go.",
    long_description    = long_description,
    long_description_content_type = "text/markdown",
    author              = "Jupyter Development Team",
    author_email        = "jupyter@googlegroups.org",
    py_modules          = [],
    install_requires    = [
        'notebook',
        'jupyter-console',
        'nbconvert',
        'ipykernel',
        'ipywidgets',
        'jupyterlab',
    ],
    url                 = "https://jupyter.org",
    license             = "BSD",
    classifiers         = [
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: BSD License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
        'Programming Language :: Python :: 3.8',
        'Programming Language :: Python :: 3.9',
    ],
)

setup(**setup_args)



File: noxfile.py

import nox

nox.options.reuse_existing_virtualenvs = True

build_command = ["-b", "html", "docs/source", "docs/build/html"]

@nox.session(python="3.9")
def docs(session):
    session.install("-r", "docs/doc-requirements.txt")
    session.run("sphinx-build", *build_command)

@nox.session(name="docs-live", python="3.9")
def docs_live(session):
    session.install("-r", "docs/doc-requirements.txt")
    session.install("sphinx-autobuild")

    AUTOBUILD_IGNORE = [
        "docs/build",
    ]
    cmd = ["sphinx-autobuild"]
    for folder in AUTOBUILD_IGNORE:
        cmd.extend(["--ignore", f"*/{folder}/*"])
    cmd.extend(build_command)
    session.run(*cmd)



File: docs/source/conf.py

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Jupyter documentation build configuration file.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
import sys
import os
import shlex

# 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
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))

# -- General configuration ------------------------------------------------

html_theme = 'pydata_sphinx_theme'
html_logo = '_static/_images/jupyter.svg'
html_favicon = '_static/_images/favicon.png'

# 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.graphviz', # Add the graphviz extension
    'sphinxext.rediraffe',
    'myst_parser',
    'sphinx_panels'
]

panels_add_bootstrap_css = False

# Add any paths that contain templates here, relative to this directory.
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'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'Jupyter Documentation'
copyright = '2015, Jupyter Team, https://jupyter.org'
author = 'The Jupyter Team'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '4.1'
# The full version, including alpha/beta/rc tags.
release = '4.1.1 alpha'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

# -- Options for HTML output ----------------------------------------------

# 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,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

html_context = {
    # "github_url": "https://github.com", # or your GitHub Enterprise interprise
    "github_user": "jupyter",
    "github_repo": "jupyter",
    "github_version": "master",
    "doc_path": "docs/source",
}

html_theme_options = {
    "icon_links": [
        {
            "name": "GitHub",
            "url": "https://github.com/jupyter/jupyter",
            "icon": "fab fa-github-square",
        },
        {
            "name": "Discourse",
            "url": "https://discourse.jupyter.org",
            "icon": "fab fa-discourse",
        },
        {
            "name": "Twitter",
            "url": "https://twitter.com/projectjupyter",
            "icon": "fab fa-twitter-square",
        },
    ],
  "external_links": [
      {"name": "jupyter.org", "url": "https://jupyter.org"},
  ],
  "use_edit_page_button": True,
}

# Re-directs for pages that were moved
rediraffe_redirects = {
    "content-quickstart.rst": "start/index.md",
    "tryjupyter.rst": "start/index.md",
}

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%Y-%m-%d'

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
html_additional_pages = {}

# Output file base name for HTML help builder.
htmlhelp_basename = 'Jupyter'

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {

}

# 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, 'Jupyter.tex', 'Jupyter Documentation',
     'https://jupyter.org', 'manual'),
]

# -- 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, 'jupyter', 'Jupyter Documentation',
     [author], 1)
]

# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
    (master_doc, 'Jupyter', 'Jupyter Documentation',
     author, 'Jupyter', 'One line description of project.',
     'Miscellaneous'),
]


# -- Options for intersphinx -----------------------------------------------

intersphinx_mapping = {
    'ipython': ('https://ipython.readthedocs.io/en/latest/', None),
    'nbconvert': ('https://nbconvert.readthedocs.io/en/latest/', None),
    'nbformat': ('https://nbformat.readthedocs.io/en/latest/', None),
    'ipywidgets': ('https://ipywidgets.readthedocs.io/en/latest/', None),
    'traitlets': ('https://traitlets.readthedocs.io/en/latest/', None),
    'ipyparallel': ('https://ipyparallel.readthedocs.io/en/latest/', None),
    'notebook': ('https://jupyter-notebook.readthedocs.io/en/latest/', None),
    'jupyterclient': ('https://jupyter-client.readthedocs.io/en/latest/', None),
    'qtconsole': ('https://jupyter.org/qtconsole/dev/', None),
    'jupytercore': ('https://jupyter-core.readthedocs.io/en/latest/', None),
    'hub': ('https://jupyterhub.readthedocs.io/en/latest/', None),
    'z2jh': ('https://zero-to-jupyterhub.readthedocs.io/en/latest/', None),
    'tljh': ('https://tljh.jupyter.org/en/latest/', None),
    'bhub': ('https://binderhub.readthedocs.io/en/latest/', None),
    'lab': ('https://jupyterlab.readthedocs.io/en/latest/', None),
}

intersphinx_cache_limit = 5

# -- Options for graphviz ----------------------------------------------------
# The following section is needed to enable links within graphviz generated diagrams
# note that these will only work if, in addition to specifying href= they also give
# target="_top" or target="_blank" for open in the same window/tab or in a new one.
graphviz_output_format = 'svg'
# Note for Windows users:
# If you receive a warning about dot not found you may need make sure Graphviz is
# installed and to specify its location with:
# -D graphviz_dot="C:\Program Files (x86)\Graphviz2.38\bin\dot.exe"
# if calling sphinx-build directly - if using the make.bat file first do:
# set SPHINXOPTS=-D graphviz_dot="C:\Program Files (x86)\Graphviz2.38\bin\dot.exe"
# or similar, if all else fails, something like:
# graphviz_dot=r'c:\Program Files (x86)\Graphviz2.38\bin\dot.exe'
# with your path to graphviz in should work if added to this file.
# BUT Please do not commit with the path on your computer in place.

# -- Translation ----------------------------------------------------------

gettext_uuid = True
locale_dirs = ['locale/']


def setup(app):
    app.add_css_file("custom.css")



File: docs/source/contributing/ipython-dev-guide/template.py

"""A one-line description.

A longer description that spans multiple lines.  Explain the purpose of the
file and provide a short list of the key classes/functions it contains.  This
is the docstring shown when some does 'import foo;foo?' in IPython, so it
should be reasonably useful and informative.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function

# [remove this comment in production]
#
# List all imports, sorted within each section (stdlib/third-party/ipython).
# For 'import foo', use one import per line.  For 'from foo.bar import a, b, c'
# it's OK to import multiple items, use the parenthesized syntax 'from foo
# import (a, b, ...)' if the list needs multiple lines.
# Separate stdlib, third-party, and IPython imports by a blank line.


# [remove this comment in production]
#
# If a file is large and has many sections, you may want to use broad section
# headers like this one that make it easier to navigate the file,
# with descriptive titles.  For complex classes, similar (but indented)
# headers are useful to organize the internal class structure.

#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Local utilities
#-----------------------------------------------------------------------------



# Jupyter

*Read this in other languages: [English](README.md), [Español](README.es-ES.md), [Português](README.pt-BR.md), [Français](README.fr-FR.md)*

Jupyter metapackage for installation and documents

## Documentation structure

This documentation uses the [Sphinx](https://sphinx-doc.org) documentation engine.

The documentation is located in the `docs/source` folder. When you build the documentation, it will be placed in the `docs/build` folder.
It is written in a combination of [reStructuredText](https://docutils.sourceforge.io/rst.html) and [MyST Markdown](https://myst-parser.readthedocs.io/).

## Build the documentation locally

There are a few ways to build the documentation; see below for instructions:

### Build the documentation automatically with `nox`

The easiest way to build the documentation locally is by using the [`nox` command line tool](https://nox.thea.codes/). This tool makes it easy to automate commands in a repository, and we have included a `docs` command to quickly install the dependencies and build the documentation.

To build and preview the site locally, follow these steps:

1. **Clone this repository**.

   ```console
   $ git clone https://github.com/jupyter/jupyter
   $ cd jupyter
   ```
2. **Install `nox`**

   ```console
   $ pip install nox
   ```
3. **Run the `docs` command**

   ```console
   $ nox -s docs
   ```

This will install the needed dependencies in a virtual environment using `pip`.
It will then place the documentation in the `docs/build/html` folder.
You may explore these HTML files in order to preview the site.

#### Create a live server to automatically preview changes

There is another `nox` command that will do the above, and also create a live server that watches your source files for changes, and auto-builds the website any time a change is made.

To start this live server, use the following `nox` command:

```console
$ nox -s docs-live
```

When the build is finished, go to the URL that is displayed. It should show a live preview of your documentation.

To stop serving the website, press **`Ctrl`**-`C` in your terminal

### Build the documentation manually

To build the documentation manually, follow these steps:

First, install [the `miniconda` Python distribution](https://conda.io/miniconda.html).

Next, navigate to the `/docs` directory and create a `conda` environment:

```bash
conda env create -f environment.yml
```

Activate the environment:

```bash
source activate jupyter_docs
```

**Build the docs** using Sphinx with the following commands:

```bash
make clean
make html
```

The docs will be built in `build/html`. They can be viewed by opening `build/html/index.html` or starting an HTTP server and navigating to `0.0.0.0:8000` in your web browser.

```bash
python3 -m http.server
```

## Releasing the jupyter metapackage

Anyone with push access to this repo can make a release
of the Jupyter metapackage (this happens very rarely).
We use [tbump][] to publish releases.

tbump updates version numbers and publishes the `git tag` of the version.
[Our GitHub Actions](https://github.com/jupyter/jupyter/actions)
then build the releases and publish them to PyPI.

The steps involved:

1. Install tbump: `pip install tbump`
2. Tag and publish the release `tbump $NEW_VERSION`.

That's it!

[tbump]: https://github.com/your-tools/tbump
