Skip to content

Fix for #7135 (error with named argument "width")#7136

Merged
ssheorey merged 2 commits intoisl-org:mainfrom
joseph-sch:joseph/fix_create_box
Mar 8, 2025
Merged

Fix for #7135 (error with named argument "width")#7136
ssheorey merged 2 commits intoisl-org:mainfrom
joseph-sch:joseph/fix_create_box

Conversation

@joseph-sch
Copy link
Contributor

Type

Motivation and Context

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

  • Add the missing comma before the first argument's name
  • Add the missing spaces in the function description

 * Add the missing comma before the first argument's name
 * Add the missing spaces in the function description
@update-docs
Copy link

update-docs bot commented Jan 13, 2025

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@joseph-sch
Copy link
Contributor Author

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

I'd happily update the CHANGELOG.md file, but I don't think it's being maintained... so I wouldn't know where to add the change description, nor what good it would do...

@timohl
Copy link
Contributor

timohl commented Jan 14, 2025

Good catch and fix. :)

The last three lines in the docs are also corrupted:

(open3d.core.Device (device) – 0): Device of the create mesh.
optional – 0): Device of the create mesh.
default=CPU – 0): Device of the create mesh.

https://www.open3d.org/docs/latest/python_api/open3d.t.geometry.TriangleMesh.html#open3d.t.geometry.TriangleMesh.create_box

If it is no problem, can you check if your fix also resolves this?
Just a quick docs build and compare if it looks fine or not.
Otherwise, I can help looking into why it gets corrupted and we can fix that as well.

Copy link
Member

@ssheorey ssheorey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @joseph-sch ! Looks good.

@joseph-sch
Copy link
Contributor Author

Good catch and fix. :)

The last three lines in the docs are also corrupted:

(open3d.core.Device (device) – 0): Device of the create mesh.
optional – 0): Device of the create mesh.
default=CPU – 0): Device of the create mesh.

https://www.open3d.org/docs/latest/python_api/open3d.t.geometry.TriangleMesh.html#open3d.t.geometry.TriangleMesh.create_box

If it is no problem, can you check if your fix also resolves this? Just a quick docs build and compare if it looks fine or not. Otherwise, I can help looking into why it gets corrupted and we can fix that as well.

Regarding the mangled documentation, apparently it's a sphinx parsing issue caused by the string in the default argument (i.e. by encountering quotes in the default argument expression core::Device("CPU:0")).

The issue does not appear when a custom docstring is specified, so that could be a workaround.

Indeed, compare the following two (create_sphere and create_text, the latter having a custom docstring):

image

image

In the second case, the word "Optional" and the default value are not present alongside each argument, but the device argument is correctly displayed without mangling.

According to ChatGPT, another solution would be to "Create a static default Device instance outside the binding to prevent inline string construction" with

static const core::Device default_device("CPU:0");

and use that instead of the expression core::Device("CPU:0").

There could also be a configuration of sphinx that avoids the issue, and that would be ideal.

I'm afraid I didn't manage to build the C++ code yet (I tried only on WSL so far) and I don't manage to rebuild the sphinx documentation after modifying the sources, so I can't check by myself yet. I suggest opening a separate issue and a separate PR.

@joseph-sch
Copy link
Contributor Author

Thanks @joseph-sch ! Looks good.

Thank you! I've now applied the style check and pushed the change. Do I need to do anything else?

@timohl
Copy link
Contributor

timohl commented Jan 23, 2025

Interesting.
I can look into it on the weekend in a separate issue/PR.

@joseph-sch
Copy link
Contributor Author

Interesting. I can look into it on the weekend in a separate issue/PR.

OK, I've opened #7147 for the separate issue of the corrupted documentation.

@joseph-sch
Copy link
Contributor Author

I managed to build the package and documentation to check the success of the patch:

image

@ssheorey ssheorey merged commit b21f249 into isl-org:main Mar 8, 2025
1 check passed
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 this pull request may close these issues.

Named argument "width" not accepted by create_box in tensor API

3 participants