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

Help strings incorrectly considered missing for some but not all trait types #55

Closed
consideRatio opened this issue Sep 26, 2023 · 2 comments · Fixed by #64
Closed

Help strings incorrectly considered missing for some but not all trait types #55

consideRatio opened this issue Sep 26, 2023 · 2 comments · Fixed by #64

Comments

@consideRatio
Copy link
Member

It seems that the help strings for traits of type Dict, List, Instance are missing since ipython/traitlets#818 released with traitlets 5.10.0 in september, but they aren't missing for Bool, Integer, Unicode.

I've added a test to capture this in #54, but I don't have an understanding on what happened in ipython/traitlets#818 that caused this.

Related code

config_trait_members = self.object.class_traits(config=True).items()
for trait_tuple in config_trait_members:
name, trait = trait_tuple
if not trait.__doc__:
warnings.warn(
f"""
Documenting {self.object.__name__}.{trait.name} without a help string because it has config=True.
Including undocumented config=True traits is deprecated in autodoc-traits 1.1.
Add a help string:
{trait.name} = {trait.__class__.__name__}(
help="...",
)
to keep this trait in your docs,
or include it explicitly via :members:
""",
FutureWarning,
)
# FIXME: in the unlikely event that the patched trait
# is documented multiple times in the same build,
# this patch will cause it to have a truthy help string
# elsewhere, not just in this autoconfigurable instance.
trait.__doc__ = trait.help = "No help string is provided."
if name not in existing_member_names:
existing_member_names.add(name)
members.append(ObjectMember(name, trait))
return check, members

@consideRatio
Copy link
Member Author

I've tested to conlclude that we run into this issue not only with the main branch of autodoc_traits, but with version 1.1.0, as long as traitlets with ipython/traitlets#818 is used.

@consideRatio consideRatio changed the title help strings incorrectly considered missing for some but not all trait types Help strings incorrectly considered missing for some but not all trait types Sep 26, 2023
@consideRatio
Copy link
Member Author

Fixed in traitlets 5.10.1

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.

1 participant