Repository: kedro-org/kedro
Pull request: Reduce Kedro package size by removing docs from it
Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>

## Description
<!-- Why was this PR created? -->
Kedro 0.18.0 is 112MB unpackaged, and 111MB of that is just from docs. For faster installations and reducing disk usage, this PR will remove docs from kedro package and alias `kedro docs` cli to point to the corresponding online version.

Related issue: https://github.com/kedro-org/kedro/issues/1410

Kedro package size difference:

![kedro package 2](https://user-images.githubusercontent.com/90610031/166912971-c3c352ca-b073-4500-8673-c33eab9abb91.png)

## Development notes
<!-- What have you changed, and how has this been tested? -->

## Checklist

- [x] Read the [contributing](https://github.com/kedro-org/kedro/blob/main/CONTRIBUTING.md) guidelines
- [ ] Opened this PR as a 'Draft Pull Request' if it is work-in-progress
- [ ] Updated the documentation to reflect the code changes
- [x] Added a description of this change in the [`RELEASE.md`](https://github.com/kedro-org/kedro/blob/main/RELEASE.md) file
- [ ] Added tests to cover my changes

<a href="https://gitpod.io/#https://github.com/kedro-org/kedro/pull/1500"><img src="https://gitpod.io/button/open-in-gitpod.svg"/></a>



Problem statement:
Reduce Kedro package size by removing the docs from kedro
## Description

The kedro wheel is 87MB big. Kedro is 114MB big on disk. Most of that (112MB) is assets used for the website framework, like for example 70MB of images. 

## Context
Fast installation means shorter cicd loops. Small disk usage means easier for edge devices.

## Possible Implementation
Do you think it might be worth splitting the site away from the core library, so that installation and disk space get reduced drastically?

Hints from issue discussion:
+💯  for this. Kedro 0.18 is now 112MB unpackaged, and 111MB of that is just docs.

Just to give some context: the reason that the docs are part of the package is because historically there were instances where people were using locked down environments in which they could `pip install kedro` but didn't have access to kedro documentation online. Hence shipping the docs with kedro and using the `kedro docs` command to display them.

However, I strongly suspect that very few people are in this situation. Unfortunately it's difficult to prove this through telemetry data, since those who can't access kedro docs online and are therefore using `kedro docs` are also unlikely to be able to send us telemetry data...  Maybe in the past when the docs were smaller it was ok to include them but as you say it now _massively_ bloats the package size. When I `pip install kedro` and/or project requirements, it is now quite striking just how long it takes to download kedro compared to other packages. kedro should absolutely not be comparable to tensorflow in package size, and packaging documentation in this way does not seem to be normal for other Python packages.

So yeah, even if `kedro docs` is still useful for a few users I would definitely favour removing it since the vast majority of users would benefit from this.
I would also say the `kedro docs` command had a lot more value when it was closed source. Maybe we should just alias the command to open the browser and point to http://kedro.readthedocs.io/?
I like this idea a lot! 
Create a `kedro-docs` package and make it an extra installable as `kedro[docs]`, for people who really need the `kedro docs` functionality? I, for one, didn't realize it existed. 😅 
After a discussion within the team we decided that we'll remove the docs from the package and repurpose the command `kedro docs` to redirect you to ReadTheDocs with a message explaining that from 0.18.1 `kedro docs` is deprecated and will not be available from 0.19.0.

Commit message: Update Makefile

Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>

Patch to review:
diff --git a/Makefile b/Makefile
index 9d6e2550be..ac7d2449c1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,4 @@
 install: build-docs
-	rm -rf kedro/framework/html
-	cp -r docs/build/html kedro/framework
 	pip install .
 
 clean:
diff --git a/RELEASE.md b/RELEASE.md
index 3cd2a2712e..d9faf111f1 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -24,7 +24,7 @@
 * Fixed `Jinja2` syntax loading with `TemplatedConfigLoader` using `globals.yml`.
 
 ## Upcoming deprecations for Kedro 0.19.0
-
+* `kedro docs` will be removed in 0.19.0.
 
 # Release 0.18.0
 
diff --git a/kedro/framework/cli/cli.py b/kedro/framework/cli/cli.py
index 1f85d7aa7e..97f434387a 100644
--- a/kedro/framework/cli/cli.py
+++ b/kedro/framework/cli/cli.py
@@ -85,10 +85,13 @@ def info():
 
 @cli.command(short_help="See the kedro API docs and introductory tutorial.")
 def docs():
-    """Display the API docs and introductory tutorial in the browser,
-    using the packaged HTML doc files."""
-    html_path = str((Path(__file__).parent.parent / "html" / "index.html").resolve())
-    index_path = f"file://{html_path}"
+    """Display the online API docs and introductory tutorial in the browser. (DEPRECATED)"""
+    deprecation_message = (
+        "DeprecationWarning: Command `kedro docs` is deprecated and "
+        "will not be available from 0.19.0."
+    )
+    click.secho(deprecation_message, fg="red")
+    index_path = f"https://kedro.readthedocs.io/en/{version}"
     click.echo(f"Opening {index_path}")
     webbrowser.open(index_path)
 
diff --git a/setup.py b/setup.py
index 7c214cbb53..aa73a45a06 100644
--- a/setup.py
+++ b/setup.py
@@ -37,11 +37,6 @@
 with open(path.join(here, "README.md"), encoding="utf-8") as f:
     readme = f.read()
 
-doc_html_files = [
-    name.replace("kedro/", "", 1)
-    for name in glob("kedro/framework/html/**/*", recursive=True)
-]
-
 template_files = []
 for pattern in ["**/*", "**/.*", "**/.*/**", "**/.*/.**"]:
     template_files.extend(
@@ -165,7 +160,7 @@ def _collect_requirements(requires):
     author="Kedro",
     entry_points={"console_scripts": ["kedro = kedro.framework.cli:main"]},
     package_data={
-        name: ["py.typed", "test_requirements.txt"] + template_files + doc_html_files
+        name: ["py.typed", "test_requirements.txt"] + template_files
     },
     zip_safe=False,
     keywords="pipelines, machine learning, data pipelines, data science, data engineering",
diff --git a/tests/framework/cli/test_cli.py b/tests/framework/cli/test_cli.py
index 592d7b7d4d..e5b88db8a5 100644
--- a/tests/framework/cli/test_cli.py
+++ b/tests/framework/cli/test_cli.py
@@ -1,8 +1,6 @@
 from collections import namedtuple
 from itertools import cycle
-from os.path import join
 from pathlib import Path
-from unittest.mock import patch
 
 import anyconfig
 import click
@@ -123,19 +121,11 @@ def test_help(self):
         assert result.exit_code == 0
         assert "-h, --help     Show this message and exit." in result.output
 
-    @patch("webbrowser.open")
-    def test_docs(self, patched_browser):
+    def test_docs(self):
         """Check that `kedro docs` opens a correct file in the browser."""
         result = CliRunner().invoke(cli, ["docs"])
 
         assert result.exit_code == 0
-        for each in ("Opening file", join("html", "index.html")):
-            assert each in result.output
-
-        assert patched_browser.call_count == 1
-        args, _ = patched_browser.call_args
-        for each in ("file://", join("kedro", "framework", "html", "index.html")):
-            assert each in args[0]
 
 
 class TestCommandCollection:


Code review comments:
diff_hunk: @@ -1,6 +1,4 @@
 install: build-docs
path: Makefile
text: @user1:
Does this even need to do `build-docs` any more? I don't think so.

@author:
Ah yes we don’t need to do `build-docs` here. Will remove it.