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

Introduce @public marker to explicitly mark members as public #655

Merged
merged 32 commits into from
Jan 17, 2024

Conversation

tmeyier
Copy link
Contributor

@tmeyier tmeyier commented Dec 23, 2023

Here is an implementation of the @public marker, as proposed in #646.

  • members with "@public" in the docstring will be considered public by the default jinja2 template and shown in the generated API documentation - even if the member name starts with _.
  • the definition in __doc__ has higher precedence than @public
  • the "@public" marker is removed from the docstring in the rendered docs. This is done with a simple replace filter. So the @public marker should be added directly before the closing """ of the docstring to avoid additional whitespace in the rendered docs.

closes #645

Copy link
Member

@mhils mhils left a comment

Choose a reason for hiding this comment

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

This looks great, thank you so much for tackling this! 🍰

test/testdata/visibility.py Outdated Show resolved Hide resolved

def yet_another_func():
"""
This is yet another public method to give a gauge for the expected amount of
Copy link
Member

Choose a reason for hiding this comment

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

I think I don't fully understand why there is a second public method here. What are we verifying with that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to see if there is any unwanted whitespace after the docstring in the generated html. The second method is there only to see how much spacing between methods you get regularly. For the automated test suite it's probably not really useful.

test/testdata/visibility.py Outdated Show resolved Hide resolved
test/testdata/visibility.py Show resolved Hide resolved
test/testdata/visibility.py Outdated Show resolved Hide resolved
pdoc/__init__.py Outdated Show resolved Hide resolved
@mhils
Copy link
Member

mhils commented Jan 17, 2024

Also sorry @public for the notifications! ❤️ Looks like you're taking this with a bit of humor, which is great. Thank you for your understanding, I'll try to go with @public going forward! 😅 🍰

@public
Copy link

public commented Jan 17, 2024

I'm used to it :)

test/testdata/visibility.py Outdated Show resolved Hide resolved
test/testdata/visibility.py Outdated Show resolved Hide resolved
@tmeyier
Copy link
Contributor Author

tmeyier commented Jan 17, 2024

The code review functionality in github still is a bit confusing for me. Sorry for the git mess.

@mhils
Copy link
Member

mhils commented Jan 17, 2024

No worries at all, we'll squash anyways. Thanks again for contributing this, this is really cool! 😃 🍰

@mhils mhils enabled auto-merge (squash) January 17, 2024 23:31
@mhils mhils merged commit 3b30281 into mitmproxy:main Jan 17, 2024
12 checks 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.

add --dunder flag to include documentation for double-underscore methods
3 participants