Skip to content

python: add type annotations to PMDA API#2622

Open
natoscott wants to merge 1 commit into
performancecopilot:mainfrom
natoscott:pmda-python-typing
Open

python: add type annotations to PMDA API#2622
natoscott wants to merge 1 commit into
performancecopilot:mainfrom
natoscott:pmda-python-typing

Conversation

@natoscott

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: ef927f5d-ec2f-49cd-9cdf-6c6eb1cafc56

📥 Commits

Reviewing files that changed from the base of the PR and between 77ffc7f and b54fff2.

📒 Files selected for processing (1)
  • src/python/pcp/pmda.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/python/pcp/pmda.py

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Added comprehensive Python type annotations across the PMDA helper module, covering public APIs, wrapper classes, and callback registration helpers.
    • Updated wrapper class constructors and method signatures for metrics, instance domains, units, dispatch, and PMDA lifecycle methods to improve clarity and IDE/autocomplete support.
    • Added explicit return types to key helper functions (including logging/error helpers) for more predictable integrations.

Walkthrough

Type annotations were added throughout src/python/pcp/pmda.py. The module now imports typing aliases, and public helpers, ctypes wrapper classes, MetricDispatch, and PMDA all use explicit parameter and return types. Runtime behavior is unchanged.

Changes

Type annotation additions across pmda.py

Layer / File(s) Summary
Typing imports and module-level helper annotations
src/python/pcp/pmda.py
Adds Any, Callable, Optional, and Union imports, updates the copyright year, and annotates the module-level PMDA helper functions.
Typed constructors and methods on ctypes wrapper structs
src/python/pcp/pmda.py
Adds typed constructors and method signatures to pmdaMetric, pmdaInstid, pmdaIndom, and pmdaUnits, including instance-loading and cache-management methods.
Typed MetricDispatch public API
src/python/pcp/pmda.py
Adds type annotations to MetricDispatch initialization, metric/indom management, and lookup methods.
Typed PMDA class methods and static helpers
src/python/pcp/pmda.py
Adds type annotations to PMDA initialization, lifecycle methods, callback registration helpers, and identity/mapping helpers.

Poem

🐇 I hopped through pmda.py with care,
And found type hints blooming everywhere.
Optional, Union, all in a row,
Making the signatures neat as they go.
A rabbit approves with a tiny drumroll—
Typed code now sparkles from top to scroll.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided, so relevance cannot be assessed from the description. Add a brief description of the PMDA typing changes or their intent so the check can verify relevance.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the change: adding type annotations to the Python PMDA API.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@natoscott natoscott force-pushed the pmda-python-typing branch from 8321483 to 3f69b5b Compare June 16, 2026 03:07
@natoscott natoscott force-pushed the pmda-python-typing branch from 3f69b5b to 77ffc7f Compare June 26, 2026 05:29
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@natoscott natoscott force-pushed the pmda-python-typing branch from 77ffc7f to b54fff2 Compare June 29, 2026 01: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.

1 participant