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

feat (python handler): Root children full path #136

Merged
merged 4 commits into from
Jul 29, 2020

Conversation

adunmore
Copy link
Contributor

Implements the Python handler option show_root_members_full_path:
Shows the full Python path of the direct children of the object at the
root of the documentation tree. Defaults to false.

References #134

Implements the Python handler option show_root_members_full_path:
Shows the full Python path of the direct children of the object at the
root of the documentation tree. Defaults to false.

References mkdocstrings#134
@pawamoy
Copy link
Member

pawamoy commented Jul 20, 2020

Alright, that's what I was expecting 🙂

{% if not root or config.show_root_heading %}
{% if not root or config.show_root_heading%}
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: please re-add the space to reduce diff and stay consistent 😛

Same remark in every other file!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, good catch! I'll fix this.

@pawamoy
Copy link
Member

pawamoy commented Jul 20, 2020

Actually this would be a "breaking" change for users using show_object_full_path: yes, as they would now need to also add show_root_members_full_path: yes, otherwise the first level of objects would not show full paths. This is not a serious breaking change, so I wonder if defaulting show_root_members_full_path to None would be worth instead.

@adunmore adunmore requested a review from pawamoy July 21, 2020 19:14
@@ -55,6 +56,7 @@ class PythonRenderer(BaseRenderer):
**`show_root_toc_entry`** | `bool` | If the root heading is not shown, at least add a ToC entry for it. | `True`
**`show_root_full_path`** | `bool` | Show the full Python path for the root object heading. | `True`
**`show_object_full_path`** | `bool` | Show the full Python path of every object. | `False`
**`show_root_members_full_path`** | `bool` | Show the full Python path of objects that are children of the root object (for example, classes in a module). | `False`
Copy link
Contributor

Choose a reason for hiding this comment

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

No longer False by default.

@adunmore
Copy link
Contributor Author

Hmm, something weird I've noticed - now show_root_members_full_path argument has three valid states:

  • None: Root member full path behavior determined entirely by show_object_full_path
  • True: Root member full path always shown, regardless of show_object_full_path
  • False: Root member full path never shown, regardless of show_object_full_path

Is this desirable?

Another approach would be for show_object_full_path: True to override show_root_members_full_path: False. Something like

{% elif root_members %}
        {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
        {% set root_members = False %}
  • Non-breaking change
  • No need for a None default & a third state for the argument
  • Seems intuitive for show_object_full_path to have the final say

@pawamoy
Copy link
Member

pawamoy commented Jul 23, 2020

Yes, it sounds good. You convinced me 🙂 You can commit and push the snippet you mentioned. Thanks!

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @adunmore!

@pawamoy
Copy link
Member

pawamoy commented Jul 29, 2020

Not sure what happened in CI for Windows. Let's ignore it for now.

@pawamoy pawamoy merged commit d1b9401 into mkdocstrings:master Jul 29, 2020
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.

3 participants