Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vshampor committed Apr 12, 2023
1 parent 976ce98 commit f7f5a9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
27 changes: 11 additions & 16 deletions docs/api/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import importlib
import inspect
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import os
import pkgutil
import sys
Expand All @@ -22,9 +16,6 @@
author = 'Intel Corporation'
release = 'v2.4.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration


extensions = ['autoapi.extension']

Expand All @@ -44,6 +35,11 @@


def collect_api_entities() -> List[str]:
"""
Collects the fully qualified names of symbols in NNCF package that contain a special attribute (set via
`nncf.common.api_marker.api` decorator) marking them as API entities.
:return: A list of fully qualified names of API symbols.
"""
modules = {}
skipped_modules = []
for importer, modname, ispkg in pkgutil.walk_packages(path=nncf.__path__,
Expand Down Expand Up @@ -75,10 +71,9 @@ def collect_api_entities() -> List[str]:
return api_fqns


with mock(['tensorflow', 'tensorflow_addons']):
with mock(['torch', 'onnx', 'openvino', 'tensorflow', 'tensorflow_addons']):
api_fqns = collect_api_entities()


module_fqns = set()

for fqn in api_fqns:
Expand All @@ -89,8 +84,11 @@ def collect_api_entities() -> List[str]:


def skip_non_api(app, what, name, obj, skip, options):
# AutoAPI-allowed callback to skip certain elements from generated documentation.
# We use it to only allow API entities in the documentation (otherwise AutoAPI would generate docs for every
# non-private symbol available in NNCF)
if what in ["module", "package"] and name in module_fqns:
print(f"VSHAMPOR: keeping module {name}")
print(f"skip_non_api: keeping module {name}")
return skip
if what in ["method", "attribute"]:
class_name = name.rpartition('.')[0]
Expand All @@ -99,16 +97,13 @@ def skip_non_api(app, what, name, obj, skip, options):
if name not in api_fqns:
skip = True
else:
print(f"VSHAMPOR: keeping API entity {name}")
print(f"skip_non_api: keeping API entity {name}")
return skip


def setup(sphinx):
sphinx.connect("autoapi-skip-member", skip_non_api)


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_book_theme'
html_static_path = ['_static']
6 changes: 1 addition & 5 deletions docs/api/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.. nncf documentation master file, created by
sphinx-quickstart on Fri Mar 24 11:30:33 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
NNCF doc testing!
================================

Expand All @@ -11,4 +6,5 @@ NNCF doc testing!
:maxdepth: 3

API Reference<autoapi/nncf/index>
JSON configuration file schema<./schema.html#http://>

0 comments on commit f7f5a9f

Please sign in to comment.