Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

feat: add summary page support for methods and properties#363

Merged
dandhlee merged 2 commits intomainfrom
method_and_properties
Mar 30, 2024
Merged

feat: add summary page support for methods and properties#363
dandhlee merged 2 commits intomainfrom
method_and_properties

Conversation

@dandhlee
Copy link
Copy Markdown
Collaborator

Continuation from #361. Adds support for Methods & Functions, Properties & Attributes.

Verified that the summary_class.yml is unaffected from this PR.

Tested and verified the result looks good, for staging in https://cloud.google.com/python/docs/reference/bigframes/latest/summary_class, https://cloud.google.com/python/docs/reference/bigframes/latest/summary_method and https://cloud.google.com/python/docs/reference/bigframes/latest/summary_properties.

Test cases would be added for goldens, however it is currently disabled.

Towards b/263399076.

  • Tests pass
  • Appropriate changes to README are included in PR

@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Mar 29, 2024
@dandhlee dandhlee requested a review from dansaadati March 29, 2024 23:24
@dandhlee dandhlee marked this pull request as ready for review March 29, 2024 23:28
@dandhlee dandhlee requested review from a team March 29, 2024 23:28
Comment thread docfx_yaml/extension.py
})
return

# if summary_type in [METHOD, PROPERTY]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can make this explicit with an elif statement, also you wouldn't need to return early above.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Chatted offline, keeping as-is.

Comment thread docfx_yaml/extension.py Outdated
name_to_use = uid
if not (class_name := yaml_data.get("class", "")):
class_name = yaml_data.get("module", "")
anchor_name = f"#{'_'.join(class_name.split('.'))}_{short_name}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does class_name.replace('.', '_') work here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤦 yes! Done.

Comment thread docfx_yaml/extension.py
first_summary_line += "."

summary_to_use = (
f"{first_summary_line}\n\n"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For the case where a summary isn't found, would this create extra whitespaces? I think this would become:

\n\n

See more: ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For methods and functions, it definitely helps to have the newlines with or without content after the syntax.
For properties & attributes, without the extra space is slightly more preferred but not a big deal. Also c.g.c will likely strip the newlines if its just blank content, it seems.

Copy link
Copy Markdown
Collaborator Author

@dandhlee dandhlee left a comment

Choose a reason for hiding this comment

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

Thank you!

Comment thread docfx_yaml/extension.py
})
return

# if summary_type in [METHOD, PROPERTY]:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Chatted offline, keeping as-is.

Comment thread docfx_yaml/extension.py
first_summary_line += "."

summary_to_use = (
f"{first_summary_line}\n\n"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For methods and functions, it definitely helps to have the newlines with or without content after the syntax.
For properties & attributes, without the extra space is slightly more preferred but not a big deal. Also c.g.c will likely strip the newlines if its just blank content, it seems.

Comment thread docfx_yaml/extension.py Outdated
name_to_use = uid
if not (class_name := yaml_data.get("class", "")):
class_name = yaml_data.get("module", "")
anchor_name = f"#{'_'.join(class_name.split('.'))}_{short_name}"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤦 yes! Done.

@dandhlee dandhlee merged commit e3ae026 into main Mar 30, 2024
@dandhlee dandhlee deleted the method_and_properties branch March 30, 2024 00:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants