Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python API docs corrupted where last argument is device=core::Device("CPU:0") #7147

Open
joseph-sch opened this issue Jan 23, 2025 · 2 comments · May be fixed by #7148
Open

Python API docs corrupted where last argument is device=core::Device("CPU:0") #7147

joseph-sch opened this issue Jan 23, 2025 · 2 comments · May be fixed by #7148

Comments

@joseph-sch
Copy link

joseph-sch commented Jan 23, 2025

Originally posted by @timohl in #7136 (comment)

The last three lines in the Python API docs are corrupted in several functions e.g. for open3d.t.geometry.TriangleMesh.create_sphere:

Image

This can be traced to cases where the last argument of the function has a default value which contains a string, and there is no explicit docstring, e.g.:

            .def_static("create_sphere", &TriangleMesh::CreateSphere,
                        "Create a sphere mesh centered at (0, 0, 0).",
                        "radius"_a = 1.0, "resolution"_a = 20,
                        "float_dtype"_a = core::Float32,
                        "int_dtype"_a = core::Int64,
                        "device"_a = core::Device("CPU:0"))

See analysis at #7136 (comment)

@timohl
Copy link
Contributor

timohl commented Jan 24, 2025

Thanks for opening this issue.

It might also get messed up by the parsing in docstring::ClassMethodDocInject().
This has been the source of previous bugs.
I will check it this weekend.

Another (not directly related) thought of mine would be to change the __repr__ method of Device to output open3d.core.Device("CPU:0") instead of CPU:0 directly.
Currently, vscode displays the default value with stubs from pybind-stubgen as ..., since CPU:0 is not valid in Python.
The same goes for open3d.core.Dtype.

@timohl timohl linked a pull request Jan 26, 2025 that will close this issue
9 tasks
@timohl
Copy link
Contributor

timohl commented Jan 26, 2025

I could not really find a fix on the Sphinx side, but I opened #7148 changing CPU:0 to Device("CPU", 0) in order to avoid the : character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants