-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconf.py
More file actions
100 lines (79 loc) · 3.23 KB
/
Copy pathconf.py
File metadata and controls
100 lines (79 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
"""Configuration of sphinx."""
import os
import sys
from unittest.mock import MagicMock
class FakeRay:
def remote(self, *args, **kwargs):
def decorator(func):
return func # Simply return the function without modification
return decorator
# Completely replace "ray" with a fake module, since it breaks sphinx
sys.modules["ray"] = MagicMock(remote=FakeRay().remote)
# Add the module path (if needed)
sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'selector'
copyright = '2024, Dimitri Weiss'
author = 'Dimitri Weiss'
release = '0.0.1'
# -- Sphinx Extensions ------------------------------------------------------
extensions = [
'sphinx.ext.autodoc', # Extracts docstrings
'sphinx.ext.autosectionlabel',
'sphinx.ext.napoleon', # Supports Google & NumPy docstrings
'sphinx.ext.autosummary', # Generates summary tables
'sphinx.ext.viewcode', # Adds links to source code
'sphinxcontrib.bibtex', # bibtex
]
bibtex_bibfiles = ["references.bib"]
autosummary_generate = True # Auto-generate `_autosummary` docs
autodoc_default_options = {
'members': True,
'undoc-members': True, # Include members without docstrings
'show-inheritance': True,
# "special-members": "__init__", # Ensure constructors are documented
# "exclude-members": "__weakref__", # Avoid unnecessary members
"inherited-members": False,
# "autodoc_inherit_docstring": False,
"exclude-members": "default",
"special-members": "default",
}
autodoc_class_signature = "explicit"
exclude_patterns = [
'_autosummary/selector.wrapper.rst',
'_autosummary/selector.test_ray.rst',
'_autosummary/selector.main.rst',
'_autosummary/selector.test.rst',
]
autodoc_mock_imports = ["json", "json.JSONEncoder"]
# -- HTML Output ------------------------------------------------------------
html_theme = "sphinx_rtd_theme"
templates_path = ['_templates']
html_static_path = ['_static']
html_build_dir = '$READTHEDOCS_OUTPUT/html/'
def skip_classes(app, what, name, obj, skip, options):
# List of class names to exclude
excluded_classes = ["GGApp",
"GGAppBaggingRegressor",
"GGAppRandomForestRegressor",
"GGAppRegressorMixin",
"BaggingRegressor",
"LocalSearch",
"FlexInstanceSet",
"InstanceSet",
"LoadOptionsFromFile",
"dummy_task",
"tae_from_aclib"]
if what == "class" and name in excluded_classes:
print(f"Skipping class: {name}") # Debugging output
return True # Force exclusion
# Also exclude their methods and attributes
if what in ["method", "attribute"] and hasattr(obj, "__qualname__"):
for cls in excluded_classes:
if obj.__qualname__.startswith(cls):
print(f"Skipping method/attribute: {obj.__qualname__}")
return True
return skip
def setup(app):
# app.connect("autodoc-process-docstring", unwrap_ray_classes)
app.connect("autodoc-skip-member", skip_classes) # Keep your existing function