Skip to content

🎨 Rename Python classes to not violate N801#523

Merged
denialhaag merged 2 commits into
mainfrom
fix-class-names
Jan 30, 2026
Merged

🎨 Rename Python classes to not violate N801#523
denialhaag merged 2 commits into
mainfrom
fix-class-names

Conversation

@denialhaag
Copy link
Copy Markdown
Member

Description

This PR renames all Python classes to not violate N801.

Checklist:

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

@denialhaag denialhaag requested a review from burgholzer January 29, 2026 20:52
@denialhaag denialhaag self-assigned this Jan 29, 2026
@denialhaag denialhaag added python Anything related to Python code minor Changes that imply a new minor release refactor Refactoring of the code base labels Jan 29, 2026
@denialhaag denialhaag changed the title 🎨 Rename Python classes to not violate established conventions 🎨 Rename Python classes to not violate N801 Jan 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 29, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Refactor

    • Updated public API naming convention: class and enum names in the module now use PascalCase (e.g., Program, AnnotatableQuantumComputation) instead of snake_case equivalents.
    • Aligned type hints and method signatures across all public interfaces with the new naming convention.
    • Note: Existing code importing these classes will require updates to use the new names.
  • Chores

    • Pinned nanobind dependency to an exact version.
    • Updated linting configuration.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Renamed the public Python API from snake_case to PascalCase across bindings, stubs, Python package exports, editor code, tests, and build config. Functional behavior and binding implementations are unchanged; only exported symbol names and their usages/types were updated.

Changes

Cohort / File(s) Summary
C++ Binding Definitions
bindings/bindings.cpp
Renamed exported Python types/enums from snake_case → PascalCase (e.g., qubit_inlining_stack_entryQubitInliningStackEntry, programProgram). Bindings' constructors, properties, and methods unchanged.
Type Stubs & Package Exports
python/mqt/syrec/pysyrec.pyi, python/mqt/syrec/__init__.py
Updated stub class/enum names, signatures, and public exports to PascalCase; adjusted parameter/return annotations to use new types.
Editor Implementation
python/mqt/syrec/syrec_editor.py
Replaced module‑qualified snake_case usages with direct PascalCase imports (e.g., AnnotatableQuantumComputation, Program, NBitValuesContainer, ConfigurableOptions); updated type hints and signatures across UI/editor classes.
Tests
test/python/test_syrec.py
Updated imports, type hints, and calls to use PascalCase API (e.g., Program(), AnnotatableQuantumComputation(), NBitValuesContainer) and direct function names (cost_aware_synthesis, simple_simulation).
Build / Lint Config
pyproject.toml
Pinned nanobind to an exact version in build-system and build deps; removed N801 from per-file Ruff/pylint ignores for *.pyi files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • burgholzer

Poem

🐰 With twitching whiskers I hopped through the trees,

I turned snake_case to Pascal with elegant ease.
QubitInliningStack, Program, and more —
Now imports are tidy, and bindings do soar! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: renaming Python classes to comply with N801 style rule.
Description check ✅ Passed The description is mostly complete with a clear explanation of the change (N801 compliance) and a filled checklist. However, some template sections (dependencies, issue reference) are missing, though they appear non-critical given the nature of this refactoring PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@python/mqt/syrec/syrec_editor.py`:
- Around line 931-932: The parameter only_print_signature should be made
keyword-only to avoid boolean-trap (FBT001); update the function/method
signature that currently reads "(inline_stack_entry: QubitInliningStackEntry,
only_print_signature: bool) -> QtGui.QStandardItem" to insert a lone asterisk
before only_print_signature—i.e. "(inline_stack_entry: QubitInliningStackEntry,
*, only_print_signature: bool) -> QtGui.QStandardItem"—so callers must pass
only_print_signature by keyword.

Comment thread python/mqt/syrec/syrec_editor.py Outdated
Copy link
Copy Markdown
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

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

LGTM. Just one clarification.

Comment thread pyproject.toml
@denialhaag denialhaag merged commit c3272a0 into main Jan 30, 2026
20 checks passed
@denialhaag denialhaag deleted the fix-class-names branch January 30, 2026 10:07
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Changes that imply a new minor release python Anything related to Python code refactor Refactoring of the code base

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants