mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
post nanobind docs fixes and some updates (#889)
* post nanobind docs fixes and some updates * one more doc nit * fix for stubs and latex
This commit is contained in:
@@ -36,9 +36,10 @@ intersphinx_mapping = {
|
||||
templates_path = ["_templates"]
|
||||
html_static_path = ["_static"]
|
||||
source_suffix = ".rst"
|
||||
master_doc = "index"
|
||||
main_doc = "index"
|
||||
highlight_language = "python"
|
||||
pygments_style = "sphinx"
|
||||
add_module_names = False
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
||||
@@ -62,11 +63,19 @@ htmlhelp_basename = "mlx_doc"
|
||||
|
||||
|
||||
def setup(app):
|
||||
wrapped = app.registry.documenters["function"].can_document_member
|
||||
from sphinx.util import inspect
|
||||
|
||||
def nanobind_function_patch(member: Any, *args, **kwargs) -> bool:
|
||||
return "nanobind.nb_func" in str(type(member)) or wrapped(
|
||||
member, *args, **kwargs
|
||||
)
|
||||
wrapped_isfunc = inspect.isfunction
|
||||
|
||||
app.registry.documenters["function"].can_document_member = nanobind_function_patch
|
||||
def isfunc(obj):
|
||||
type_name = str(type(obj))
|
||||
if "nanobind.nb_method" in type_name or "nanobind.nb_func" in type_name:
|
||||
return True
|
||||
return wrapped_isfunc(obj)
|
||||
|
||||
inspect.isfunction = isfunc
|
||||
|
||||
|
||||
# -- Options for LaTeX output ------------------------------------------------
|
||||
|
||||
latex_documents = [(main_doc, "MLX.tex", "MLX Documentation", author, "manual")]
|
||||
|
||||
Reference in New Issue
Block a user