Repository: alteryx/woodwork (python)

Issue:
[SPIKE] - Add a new from_disk convenience method, corresponding to existing to_disk method
We currently have a `to_disk` method for serializing a Woodwork table, but the function for deserializing the data is called `read_woodwork_table`. It might make more sense for the deserialization function to be `from_disk` instead. This could either replace the existing method (breaking change) or be a convenience function that just calls the existing `read_woodwork_table` function.

Pull request:
Adding from_disk convenience function
Closes #1308 

Patch:
diff --git a/docs/source/api_reference.rst b/docs/source/api_reference.rst
index c701b92..20edeed 100644
--- a/docs/source/api_reference.rst
+++ b/docs/source/api_reference.rst
@@ -129,6 +129,7 @@ Deserialization
 .. autosummary::
     :toctree: generated/
 
+    from_disk
     read_woodwork_table
 
 Logical Types
diff --git a/docs/source/guides/saving_and_loading_dataframes.ipynb b/docs/source/guides/saving_and_loading_dataframes.ipynb
index 88d6c80..0d568ff 100644
--- a/docs/source/guides/saving_and_loading_dataframes.ipynb
+++ b/docs/source/guides/saving_and_loading_dataframes.ipynb
@@ -119,9 +119,9 @@
     "\n",
     "## Loading a Woodwork DataFrame\n",
     "\n",
-    "After saving a Woodwork DataFrame, you can load the DataFrame and typing information by using `woodwork.deserialize.read_woodwork_table`. This function will use the stored typing information in the specified directory to recreate the Woodwork DataFrame. \n",
+    "After saving a Woodwork DataFrame, you can load the DataFrame and typing information by using `woodwork.deserialize.from_disk`. This function will use the stored typing information in the specified directory to recreate the Woodwork DataFrame. \n",
     "\n",
-    "If you have modified any of the default values for the filename, data subdirectory or typing information file, you will need to specify those when calling `read_woodwork_table`. Since we did not change any of the defaults for this example, we do not need to specify them here."
+    "If you have modified any of the default values for the filename, data subdirectory or typing information file, you will need to specify those when calling `from_disk`. Since we did not change any of the defaults for this example, we do not need to specify them here."
    ]
   },
   {
@@ -131,8 +131,8 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "from woodwork.deserialize import read_woodwork_table\n",
-    "df = read_woodwork_table('retail')\n",
+    "from woodwork.deserialize import from_disk\n",
+    "df = from_disk('retail')\n",
     "df.ww.schema"
    ]
   },
diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst
index 480b1d3..083090c 100644
--- a/docs/source/release_notes.rst
+++ b/docs/source/release_notes.rst
@@ -9,6 +9,7 @@ Future Release
         * Added type inference for phone numbers (:pr:`1357`)
     * Fixes
     * Changes
+        * Added ``from_disk`` as a convenience function to deserialize a WW table (:pr:`1363`)
         * Allow attr version in setup.cfg (:pr:`1361`)
     * Documentation Changes
         * Upgrade nbconvert and remove jinja2 dependency (:pr:`1362`)
diff --git a/setup.cfg b/setup.cfg
index f12b176..fe37805 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -62,7 +62,7 @@ dev =
     jupyter == 1.0.0
     pandoc == 1.1.0
     ipykernel == 6.4.2
-    click >= 7.1.2
+    click >= 7.1.2, <8.1.0
     %(dask)s
     %(spark)s
 
diff --git a/woodwork/deserialize.py b/woodwork/deserialize.py
index de2d494..ad0af7c 100644
--- a/woodwork/deserialize.py
+++ b/woodwork/deserialize.py
@@ -1,6 +1,29 @@
 from woodwork.deserializers.utils import get_deserializer
 
 
+def from_disk(
+    path,
+    filename=None,
+    data_subdirectory="data",
+    typing_info_filename="woodwork_typing_info.json",
+    profile_name=None,
+    validate=False,
+    **kwargs,
+):
+    """Convenience function to call `read_woodwork_table`."""
+    deserialized_df = read_woodwork_table(
+        path,
+        filename=filename,
+        data_subdirectory=data_subdirectory,
+        typing_info_filename=typing_info_filename,
+        profile_name=profile_name,
+        validate=validate,
+        **kwargs,
+    )
+
+    return deserialized_df
+
+
 def read_woodwork_table(
     path,
     filename=None,
diff --git a/woodwork/logical_types.py b/woodwork/logical_types.py
index a0af571..de8e92b 100644
--- a/woodwork/logical_types.py
+++ b/woodwork/logical_types.py
@@ -2,7 +2,7 @@ import re
 import warnings
 
 import pandas as pd
-import pandas.api.types as pdtypes
+from pandas.api import types as pdtypes
 
 from woodwork.accessor_utils import _is_dask_series, _is_spark_series
 from woodwork.config import config
diff --git a/woodwork/type_sys/inference_functions.py b/woodwork/type_sys/inference_functions.py
index e39228d..a7274fb 100644
--- a/woodwork/type_sys/inference_functions.py
+++ b/woodwork/type_sys/inference_functions.py
@@ -1,9 +1,9 @@
-import importlib.resources as pkg_resources
+from importlib import resources as pkg_resources
 from typing import Any, Callable, Iterable, Union
 
 import numpy as np
 import pandas as pd
-import pandas.api.types as pdtypes
+from pandas.api import types as pdtypes
 
 import woodwork as ww
 from woodwork import data


Test patch:
diff --git a/woodwork/tests/accessor/test_serialization.py b/woodwork/tests/accessor/test_serialization.py
index 50fb057..4adaaf0 100644
--- a/woodwork/tests/accessor/test_serialization.py
+++ b/woodwork/tests/accessor/test_serialization.py
@@ -7,7 +7,7 @@ import pandas as pd
 import pytest
 
 from woodwork.accessor_utils import _is_dask_dataframe, _is_spark_dataframe
-from woodwork.deserialize import read_woodwork_table
+from woodwork.deserialize import from_disk, read_woodwork_table
 from woodwork.deserializers.deserializer_base import _check_schema_version
 from woodwork.exceptions import (
     OutdatedSchemaWarning,
@@ -868,3 +868,24 @@ def test_earlier_schema_version():
     test_version(major - 1, minor, patch)
     test_version(major, minor - 1, patch, raises=False)
     test_version(major, minor, patch - 1, raises=False)
+
+
+@patch("woodwork.deserialize.read_woodwork_table")
+def test_from_disk(mock_read_woodwork_table, tmpdir, sample_df):
+    sample_df.ww.init(
+        name="test_data",
+        index="id",
+        time_index="signup_date",
+    )
+    sample_df.ww.to_disk(str(tmpdir), format="csv")
+
+    expected_params = {
+        "filename": "some_name",
+        "data_subdirectory": "data",
+        "typing_info_filename": "woodwork_typing_info_random.json",
+        "profile_name": None,
+        "validate": True,
+    }
+
+    _ = from_disk(str(tmpdir), **expected_params)
+    mock_read_woodwork_table.assert_called_once_with(str(tmpdir), **expected_params)
diff --git a/woodwork/tests/type_system/test_custom_types.py b/woodwork/tests/type_system/test_custom_types.py
index 43529a7..902a1bb 100644
--- a/woodwork/tests/type_system/test_custom_types.py
+++ b/woodwork/tests/type_system/test_custom_types.py
@@ -1,5 +1,5 @@
 import pandas as pd
-import pandas.api.types as pdtypes
+from pandas.api import types as pdtypes
 
 import woodwork as ww
 from woodwork.logical_types import Categorical, Double, LogicalType