prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Support formatting Jupyter Notebooks in GitHub Actions
  **Is your feature request related to a problem? Please describe.**
  
  I'm trying to setup a GitHub Action that runs Black on a project that includes *.py and *.ipynb files, but the default action does not include the Jupyter extra. I followed the integration described in [this piece of documentation](https://black.readthedocs.io/en/stable/integrations/github_actions.html) but the option to include the Jupyter extra (`black[jupyter]`) is not available.
  
  **Describe the solution you'd like**
  
  If the action included an argument to include the Jupyter extra, the GitHub Action would work in as expected (when using `pip install black[jupyter]` locally).
  
  **Describe alternatives you've considered**
  
  I considered a custom GitHub Action and installing Black manually, but found out that modifying part of the action available in this repository is cleaner and would bring support to users with a similar need without affecting those that already use the GitHub Action.
  
  **Additional context**
  
  I was trying different things out and arrived to a solution that works as expected and can be included in this project without affecting users that already use the GitHub Action. **Add a new option to the GitHub Action to enable the Jupyter extra dependency**. I think that a boolean value might do the trick and using `false` as default maintains the current behavior.
  
  ``` diff
  diff --git a/action.yml b/action.yml
  index cfa6ef9..ed6c32e 100644
  --- a/action.yml
  +++ b/action.yml
  @@ -8,6 +8,10 @@ inputs:
         '--check --diff'"
       required: false
       default: "--check --diff"
  +  jupyter:
  +    description: "Include the required extra dependencies to format Jupyter Notebooks."
  +    required: false
  +    default: false
     src:
       description: "Source to run Black. Default: '.'"
       required: false
  @@ -38,6 +42,7 @@ runs:
           # TODO: Remove once https://github.com/actions/runner/issues/665 is fixed.
           INPUT_OPTIONS: ${{ inputs.options }}
           INPUT_SRC: ${{ inputs.src }}
  +        INPUT_JUPYTER: ${{ inputs.jupyter }}
           INPUT_BLACK_ARGS: ${{ inputs.black_args }}
           INPUT_VERSION: ${{ inputs.version }}
           pythonioencoding: utf-8
  ```
  
  In this file, if the flag is enabled (if the `INPUT_JUPYTER` envar has a true value) then the `jupyter` extra is included in the installation step. Colorama is already included by default. 
  
  ```diff
  diff --git a/action/main.py b/action/main.py
  index cd920f5..fbf6e73 100644
  --- a/action/main.py
  +++ b/action/main.py
  @@ -10,11 +10,16 @@ ENV_BIN = ENV_PATH / ("Scripts" if sys.platform == "win32" else "bin")
   OPTIONS = os.getenv("INPUT_OPTIONS", default="")
   SRC = os.getenv("INPUT_SRC", default="")
   BLACK_ARGS = os.getenv("INPUT_BLACK_ARGS", default="")
  +JUPYTER = os.getenv("INPUT_JUPYTER")
   VERSION = os.getenv("INPUT_VERSION", default="")
  
   run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True)
  
  -req = "black[colorama]"
  +
  +if JUPYTER:
  +    req = "black[colorama,jupyter]"
  +else:
  +    req = "black[colorama]"
   if VERSION:
       req += f"=={VERSION}"
   pip_proc = run(
  ```
  
  The only difference would be visible in case I want to use the Jupyter extra, which can be enabled by passing the value explicitly:
  
  ```diff
  jobs:
    lint:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - uses: psf/black@stable
  +         jupyter: true
            options: "--check --diff --verbose"
  
  ```
  
  I forked this project to test the GitHub Action and it does work as expected (https://github.com/aaossa/black/commit/7af4287355003cd44e0febd8fe88e92f205db324). If you agree with this feature request, I can submit a PR with these changes and update the relevant documentation 👌 
  
  
  
  </issue>
  <code>
  [start of action/main.py]
  1 import os
  2 import shlex
  3 import sys
  4 from pathlib import Path
  5 from subprocess import PIPE, STDOUT, run
  6 
  7 ACTION_PATH = Path(os.environ["GITHUB_ACTION_PATH"])
  8 ENV_PATH = ACTION_PATH / ".black-env"
  9 ENV_BIN = ENV_PATH / ("Scripts" if sys.platform == "win32" else "bin")
  10 OPTIONS = os.getenv("INPUT_OPTIONS", default="")
  11 SRC = os.getenv("INPUT_SRC", default="")
  12 BLACK_ARGS = os.getenv("INPUT_BLACK_ARGS", default="")
  13 VERSION = os.getenv("INPUT_VERSION", default="")
  14 
  15 run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True)
  16 
  17 version_specifier = VERSION
  18 if VERSION and VERSION[0] in "0123456789":
  19     version_specifier = f"=={VERSION}"
  20 req = f"black[colorama]{version_specifier}"
  21 pip_proc = run(
  22     [str(ENV_BIN / "python"), "-m", "pip", "install", req],
  23     stdout=PIPE,
  24     stderr=STDOUT,
  25     encoding="utf-8",
  26 )
  27 if pip_proc.returncode:
  28     print(pip_proc.stdout)
  29     print("::error::Failed to install Black.", flush=True)
  30     sys.exit(pip_proc.returncode)
  31 
  32 
  33 base_cmd = [str(ENV_BIN / "black")]
  34 if BLACK_ARGS:
  35     # TODO: remove after a while since this is deprecated in favour of SRC + OPTIONS.
  36     proc = run([*base_cmd, *shlex.split(BLACK_ARGS)])
  37 else:
  38     proc = run([*base_cmd, *shlex.split(OPTIONS), *shlex.split(SRC)])
  39 
  40 sys.exit(proc.returncode)
  41
  [end of action/main.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/action/main.py b/action/main.py
  --- a/action/main.py
  +++ b/action/main.py
  @@ -9,6 +9,7 @@
   ENV_BIN = ENV_PATH / ("Scripts" if sys.platform == "win32" else "bin")
   OPTIONS = os.getenv("INPUT_OPTIONS", default="")
   SRC = os.getenv("INPUT_SRC", default="")
  +JUPYTER = os.getenv("INPUT_JUPYTER") == "true"
   BLACK_ARGS = os.getenv("INPUT_BLACK_ARGS", default="")
   VERSION = os.getenv("INPUT_VERSION", default="")
   
  @@ -17,7 +18,11 @@
   version_specifier = VERSION
   if VERSION and VERSION[0] in "0123456789":
       version_specifier = f"=={VERSION}"
  -req = f"black[colorama]{version_specifier}"
  +if JUPYTER:
  +    extra_deps = "[colorama,jupyter]"
  +else:
  +    extra_deps = "[colorama]"
  +req = f"black{extra_deps}{version_specifier}"
   pip_proc = run(
       [str(ENV_BIN / "python"), "-m", "pip", "install", req],
       stdout=PIPE,
  
verification_info: {"golden_diff": "diff --git a/action/main.py b/action/main.py\n--- a/action/main.py\n+++ b/action/main.py\n@@ -9,6 +9,7 @@\n ENV_BIN = ENV_PATH / (\"Scripts\" if sys.platform == \"win32\" else \"bin\")\n OPTIONS = os.getenv(\"INPUT_OPTIONS\", default=\"\")\n SRC = os.getenv(\"INPUT_SRC\", default=\"\")\n+JUPYTER = os.getenv(\"INPUT_JUPYTER\") == \"true\"\n BLACK_ARGS = os.getenv(\"INPUT_BLACK_ARGS\", default=\"\")\n VERSION = os.getenv(\"INPUT_VERSION\", default=\"\")\n \n@@ -17,7 +18,11 @@\n version_specifier = VERSION\n if VERSION and VERSION[0] in \"0123456789\":\n     version_specifier = f\"=={VERSION}\"\n-req = f\"black[colorama]{version_specifier}\"\n+if JUPYTER:\n+    extra_deps = \"[colorama,jupyter]\"\n+else:\n+    extra_deps = \"[colorama]\"\n+req = f\"black{extra_deps}{version_specifier}\"\n pip_proc = run(\n     [str(ENV_BIN / \"python\"), \"-m\", \"pip\", \"install\", req],\n     stdout=PIPE,\n", "issue": "Support formatting Jupyter Notebooks in GitHub Actions\n**Is your feature request related to a problem? Please describe.**\r\n\r\nI'm trying to setup a GitHub Action that runs Black on a project that includes *.py and *.ipynb files, but the default action does not include the Jupyter extra. I followed the integration described in [this piece of documentation](https://black.readthedocs.io/en/stable/integrations/github_actions.html) but the option to include the Jupyter extra (`black[jupyter]`) is not available.\r\n\r\n**Describe the solution you'd like**\r\n\r\nIf the action included an argument to include the Jupyter extra, the GitHub Action would work in as expected (when using `pip install black[jupyter]` locally).\r\n\r\n**Describe alternatives you've considered**\r\n\r\nI considered a custom GitHub Action and installing Black manually, but found out that modifying part of the action available in this repository is cleaner and would bring support to users with a similar need without affecting those that already use the GitHub Action.\r\n\r\n**Additional context**\r\n\r\nI was trying different things out and arrived to a solution that works as expected and can be included in this project without affecting users that already use the GitHub Action. **Add a new option to the GitHub Action to enable the Jupyter extra dependency**. I think that a boolean value might do the trick and using `false` as default maintains the current behavior.\r\n\r\n``` diff\r\ndiff --git a/action.yml b/action.yml\r\nindex cfa6ef9..ed6c32e 100644\r\n--- a/action.yml\r\n+++ b/action.yml\r\n@@ -8,6 +8,10 @@ inputs:\r\n       '--check --diff'\"\r\n     required: false\r\n     default: \"--check --diff\"\r\n+  jupyter:\r\n+    description: \"Include the required extra dependencies to format Jupyter Notebooks.\"\r\n+    required: false\r\n+    default: false\r\n   src:\r\n     description: \"Source to run Black. Default: '.'\"\r\n     required: false\r\n@@ -38,6 +42,7 @@ runs:\r\n         # TODO: Remove once https://github.com/actions/runner/issues/665 is fixed.\r\n         INPUT_OPTIONS: ${{ inputs.options }}\r\n         INPUT_SRC: ${{ inputs.src }}\r\n+        INPUT_JUPYTER: ${{ inputs.jupyter }}\r\n         INPUT_BLACK_ARGS: ${{ inputs.black_args }}\r\n         INPUT_VERSION: ${{ inputs.version }}\r\n         pythonioencoding: utf-8\r\n```\r\n\r\nIn this file, if the flag is enabled (if the `INPUT_JUPYTER` envar has a true value) then the `jupyter` extra is included in the installation step. Colorama is already included by default. \r\n\r\n```diff\r\ndiff --git a/action/main.py b/action/main.py\r\nindex cd920f5..fbf6e73 100644\r\n--- a/action/main.py\r\n+++ b/action/main.py\r\n@@ -10,11 +10,16 @@ ENV_BIN = ENV_PATH / (\"Scripts\" if sys.platform == \"win32\" else \"bin\")\r\n OPTIONS = os.getenv(\"INPUT_OPTIONS\", default=\"\")\r\n SRC = os.getenv(\"INPUT_SRC\", default=\"\")\r\n BLACK_ARGS = os.getenv(\"INPUT_BLACK_ARGS\", default=\"\")\r\n+JUPYTER = os.getenv(\"INPUT_JUPYTER\")\r\n VERSION = os.getenv(\"INPUT_VERSION\", default=\"\")\r\n\r\n run([sys.executable, \"-m\", \"venv\", str(ENV_PATH)], check=True)\r\n\r\n-req = \"black[colorama]\"\r\n+\r\n+if JUPYTER:\r\n+    req = \"black[colorama,jupyter]\"\r\n+else:\r\n+    req = \"black[colorama]\"\r\n if VERSION:\r\n     req += f\"=={VERSION}\"\r\n pip_proc = run(\r\n```\r\n\r\nThe only difference would be visible in case I want to use the Jupyter extra, which can be enabled by passing the value explicitly:\r\n\r\n```diff\r\njobs:\r\n  lint:\r\n    runs-on: ubuntu-latest\r\n    steps:\r\n      - uses: actions/checkout@v2\r\n      - uses: psf/black@stable\r\n+         jupyter: true\r\n          options: \"--check --diff --verbose\"\r\n\r\n```\r\n\r\nI forked this project to test the GitHub Action and it does work as expected (https://github.com/aaossa/black/commit/7af4287355003cd44e0febd8fe88e92f205db324). If you agree with this feature request, I can submit a PR with these changes and update the relevant documentation \ud83d\udc4c \r\n\r\n\n", "before_files": [{"content": "import os\nimport shlex\nimport sys\nfrom pathlib import Path\nfrom subprocess import PIPE, STDOUT, run\n\nACTION_PATH = Path(os.environ[\"GITHUB_ACTION_PATH\"])\nENV_PATH = ACTION_PATH / \".black-env\"\nENV_BIN = ENV_PATH / (\"Scripts\" if sys.platform == \"win32\" else \"bin\")\nOPTIONS = os.getenv(\"INPUT_OPTIONS\", default=\"\")\nSRC = os.getenv(\"INPUT_SRC\", default=\"\")\nBLACK_ARGS = os.getenv(\"INPUT_BLACK_ARGS\", default=\"\")\nVERSION = os.getenv(\"INPUT_VERSION\", default=\"\")\n\nrun([sys.executable, \"-m\", \"venv\", str(ENV_PATH)], check=True)\n\nversion_specifier = VERSION\nif VERSION and VERSION[0] in \"0123456789\":\n    version_specifier = f\"=={VERSION}\"\nreq = f\"black[colorama]{version_specifier}\"\npip_proc = run(\n    [str(ENV_BIN / \"python\"), \"-m\", \"pip\", \"install\", req],\n    stdout=PIPE,\n    stderr=STDOUT,\n    encoding=\"utf-8\",\n)\nif pip_proc.returncode:\n    print(pip_proc.stdout)\n    print(\"::error::Failed to install Black.\", flush=True)\n    sys.exit(pip_proc.returncode)\n\n\nbase_cmd = [str(ENV_BIN / \"black\")]\nif BLACK_ARGS:\n    # TODO: remove after a while since this is deprecated in favour of SRC + OPTIONS.\n    proc = run([*base_cmd, *shlex.split(BLACK_ARGS)])\nelse:\n    proc = run([*base_cmd, *shlex.split(OPTIONS), *shlex.split(SRC)])\n\nsys.exit(proc.returncode)\n", "path": "action/main.py"}]}