mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
readthedocs fixes
Summary: Fixes readthedocs. Sphinx build looks good. Reviewed By: bottler Differential Revision: D40893196 fbshipit-source-id: bf00384b921d4ef54e64745ed39172358c2f9bb3
This commit is contained in:
parent
cd113efd98
commit
f7ac7b604a
@ -19,7 +19,11 @@ def paths_to_modules(paths):
|
||||
"""
|
||||
Given an iterable of paths, return equivalent list of modules.
|
||||
"""
|
||||
return [str(i.relative_to(ROOT_DIR))[:-3].replace("/", ".") for i in paths]
|
||||
return [
|
||||
str(i.relative_to(ROOT_DIR))[:-3].replace("/", ".")
|
||||
for i in paths
|
||||
if "__pycache__" not in str(i)
|
||||
]
|
||||
|
||||
|
||||
def create_one_file(title, description, sources, dest_file):
|
||||
@ -57,11 +61,17 @@ def iterate_directory(directory_path, dest):
|
||||
continue
|
||||
if subdir.name == "fb":
|
||||
continue
|
||||
if subdir.name.startswith("_"):
|
||||
continue
|
||||
iterate_directory(subdir, dest / (subdir.name))
|
||||
toc.append(f"{subdir.name}/index")
|
||||
|
||||
paths_to_modules_ = paths_to_modules([directory_path.with_suffix(".XX")])
|
||||
if len(paths_to_modules_) == 0:
|
||||
return
|
||||
title = paths_to_modules_[0]
|
||||
|
||||
with open(dest / "index.rst", "w") as f:
|
||||
title = paths_to_modules([directory_path.with_suffix(".XX")])[0]
|
||||
print(title, file=f)
|
||||
print("=" * len(title), file=f)
|
||||
print("\n.. toctree::\n", file=f)
|
||||
@ -69,6 +79,22 @@ def iterate_directory(directory_path, dest):
|
||||
print(f" {item}", file=f)
|
||||
|
||||
|
||||
def make_directory_index(title: str, directory_path: Path):
|
||||
index_file = directory_path / "index.rst"
|
||||
directory_rsts = sorted(directory_path.glob("*.rst"))
|
||||
subdirs = sorted([f for f in directory_path.iterdir() if f.is_dir()])
|
||||
with open(index_file, "w") as f:
|
||||
print(title, file=f)
|
||||
print("=" * len(title), file=f)
|
||||
print("\n.. toctree::\n", file=f)
|
||||
for subdir in subdirs:
|
||||
print(f" {subdir.stem}/index.rst", file=f)
|
||||
for rst in directory_rsts:
|
||||
if rst.stem == "index":
|
||||
continue
|
||||
print(f" {rst.stem}", file=f)
|
||||
|
||||
|
||||
iterate_directory(ROOT_DIR / "pytorch3d/implicitron/models", DEST_DIR / "models")
|
||||
|
||||
unwanted_tools = ["configurable", "depth_cleanup", "utils"]
|
||||
@ -118,3 +144,5 @@ create_one_file(
|
||||
paths_to_modules(evaluation_files),
|
||||
DEST_DIR / "evaluation.rst",
|
||||
)
|
||||
|
||||
make_directory_index("pytorch3d.implicitron", DEST_DIR)
|
||||
|
10
docs/modules/implicitron/index.rst
Normal file
10
docs/modules/implicitron/index.rst
Normal file
@ -0,0 +1,10 @@
|
||||
pytorch3d.implicitron
|
||||
=====================
|
||||
|
||||
.. toctree::
|
||||
|
||||
models/index.rst
|
||||
data_basics
|
||||
datasets
|
||||
evaluation
|
||||
tools
|
@ -4,10 +4,10 @@ pytorch3d.implicitron.models.implicit_function
|
||||
.. toctree::
|
||||
|
||||
base
|
||||
decoding_functions
|
||||
idr_feature_field
|
||||
neural_radiance_field
|
||||
scene_representation_networks
|
||||
utils
|
||||
decoding_functions
|
||||
voxel_grid
|
||||
voxel_grid_implicit_function
|
||||
|
Loading…
x
Reference in New Issue
Block a user