Skip to content

feat: forward stat function docstrings to stat objects#708

Merged
leotrs merged 1 commit into
mainfrom
stats-docstring-forwarding
Apr 27, 2026
Merged

feat: forward stat function docstrings to stat objects#708
leotrs merged 1 commit into
mainfrom
stats-docstring-forwarding

Conversation

@leotrs

@leotrs leotrs commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • H.nodes.degree? now shows the actual degree docstring (parameters, description) instead of the generic NodeStat class docstring
  • One-line change: self.__doc__ = func.__doc__ in IDStat.__init__
  • Works for all stat types: node, edge, directed, custom, and with args

Closes #357 (the last remaining point — discoverability was addressed by #699)

Test plan

  • New test test_stat_docstring_forwarding covers node stats, edge stats, args preservation, custom stats, and directed hypergraph stats
  • Full test suite passes (396 passed)
  • Manually verified in IPython

H.nodes.degree? now shows the actual degree docstring instead of
the generic NodeStat class docstring.

Closes #357

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leotrs

leotrs commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator Author

As requested by @maximelucas recently

@codecov

codecov Bot commented Apr 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.62%. Comparing base (50db714) to head (a6c8df3).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #708   +/-   ##
=======================================
  Coverage   93.62%   93.62%           
=======================================
  Files          66       66           
  Lines        5161     5162    +1     
=======================================
+ Hits         4832     4833    +1     
  Misses        329      329           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nwlandry nwlandry left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is awesome, @leotrs! Good to merge, but this makes me wonder if we should remind users somewhere in the docs (maybe quickstart.ipynb or something?) that using the ? is helpful? But this is a separate issue that we could talk about tomorrow in the team meeting.

@leotrs leotrs merged commit fa7de97 into main Apr 27, 2026
17 checks passed
@maximelucas maximelucas deleted the stats-docstring-forwarding branch June 1, 2026 06:30
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.

stats features are hard to find and understand from docs

3 participants