Remove mp.solutions from doc generation.

These need to be excluded from the current package, so do it automatically.

PiperOrigin-RevId: 490146934
This commit is contained in:
Mark McDonald 2022-11-21 21:45:58 -08:00 committed by Copybara-Service
parent d43d0ff615
commit 7c9fc9a642

View File

@ -30,7 +30,7 @@ from tensorflow_docs.api_generator import public_api
try: try:
# mediapipe has not been set up to work with bazel yet, so catch & report. # mediapipe has not been set up to work with bazel yet, so catch & report.
import mediapipe # pytype: disable=import-error import mediapipe as mp # pytype: disable=import-error
except ImportError as e: except ImportError as e:
raise ImportError('Please `pip install mediapipe`.') from e raise ImportError('Please `pip install mediapipe`.') from e
@ -58,11 +58,13 @@ _SITE_PATH = flags.DEFINE_string('site_path', '/mediapipe/api_docs/python',
def gen_api_docs(): def gen_api_docs():
"""Generates API docs for the mediapipe package.""" """Generates API docs for the mediapipe package."""
if hasattr(mp, 'solutions'):
del mp.solutions
doc_generator = generate_lib.DocGenerator( doc_generator = generate_lib.DocGenerator(
root_title=PROJECT_FULL_NAME, root_title=PROJECT_FULL_NAME,
py_modules=[(PROJECT_SHORT_NAME, mediapipe)], py_modules=[(PROJECT_SHORT_NAME, mp)],
base_dir=os.path.dirname(mediapipe.__file__), base_dir=os.path.dirname(mp.__file__),
code_url_prefix=_URL_PREFIX.value, code_url_prefix=_URL_PREFIX.value,
search_hints=_SEARCH_HINTS.value, search_hints=_SEARCH_HINTS.value,
site_path=_SITE_PATH.value, site_path=_SITE_PATH.value,