Skip to content

feat: add type stubs for stats on view classes#700

Merged
leotrs merged 1 commit into
mainfrom
stats-type-stubs
Apr 27, 2026
Merged

feat: add type stubs for stats on view classes#700
leotrs merged 1 commit into
mainfrom
stats-type-stubs

Conversation

@leotrs

@leotrs leotrs commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds .pyi type stub for xgi.core.views, declaring built-in stats as typed attributes on NodeView, EdgeView, DiNodeView, and DiEdgeView.
  • Adds py.typed marker (PEP 561) so type checkers recognize XGI as a typed package.
  • Configures pyproject.toml to include py.typed and *.pyi files in distributions.

Motivation

Companion to #699. That PR makes stats discoverable at runtime (dir(), Jupyter tab completion). This PR makes them discoverable to static analysis tools (Pylance/VS Code, PyCharm, mypy) which don't execute code.

Test plan

  • Full test suite passes (392 passed, 6 skipped)
  • py.typed marker is correctly placed and detectable
  • Verify Pylance autocomplete shows stats on H.nodes. and H.edges. in VS Code

🤖 Generated with Claude Code

Add .pyi stub file declaring built-in stats as typed attributes on
NodeView, EdgeView, DiNodeView, and DiEdgeView. This enables static
analysis tools (Pylance, PyCharm, mypy) to provide autocomplete and
type checking for the stats interface.

Also adds py.typed marker and configures pyproject.toml to include
stub files in package distributions.

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

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.59%. Comparing base (ab72705) to head (954a366).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #700   +/-   ##
=======================================
  Coverage   93.59%   93.59%           
=======================================
  Files          66       66           
  Lines        5123     5123           
=======================================
  Hits         4795     4795           
  Misses        328      328           

☔ 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.

@leotrs leotrs merged commit fbcda0c into main Apr 27, 2026
17 checks passed
@maximelucas maximelucas deleted the stats-type-stubs branch June 1, 2026 06:31
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.

2 participants