Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better repr for WeakCallback objects #236

Merged
merged 4 commits into from
Sep 22, 2023

Conversation

tlambert03
Copy link
Member

@tlambert03 tlambert03 commented Sep 21, 2023

for easier debugging

Summary by CodeRabbit

  • Refactor: Updated import statements and class names in src/psygnal/_signal.py and src/psygnal/_weak_callback.py for improved consistency and clarity.
  • New Feature: Added object_repr() method to the WeakCallback class in src/psygnal/_weak_callback.py to provide a human-readable representation of an object.
  • Test: Introduced a new print statement in tests/test_weak_callable.py for better debugging during testing.
  • Chore: Added a conditional step in the CI/CD pipeline .github/workflows/test.yml to run tests using a headless GUI, improving test coverage.

@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Patch coverage: 97.50% and project coverage change: -0.06% ⚠️

Comparison is base (2161320) 100.00% compared to head (5c4505f) 99.94%.

Additional details and impacted files
@@             Coverage Diff             @@
##              main     #236      +/-   ##
===========================================
- Coverage   100.00%   99.94%   -0.06%     
===========================================
  Files           22       22              
  Lines         1849     1872      +23     
===========================================
+ Hits          1849     1871      +22     
- Misses           0        1       +1     
Files Changed Coverage Δ
src/psygnal/_weak_callback.py 99.45% <97.14%> (-0.55%) ⬇️
src/psygnal/_signal.py 100.00% <100.00%> (ø)

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

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 21, 2023

CodSpeed Performance Report

Merging #236 will degrade performances by 22.57%

Comparing tlambert03:weak-repr (5c4505f) with main (2161320)

Summary

❌ 4 (👁 4) regressions
✅ 62 untouched benchmarks

Benchmarks breakdown

Benchmark main tlambert03:weak-repr Change
👁 test_connect_time[setattr-check_types] 103.7 µs 129.8 µs -20.1%
👁 test_connect_time[setattr-] 87.6 µs 113.2 µs -22.57%
👁 test_connect_time[setitem-] 89.1 µs 112.2 µs -20.63%
👁 test_connect_time[setitem-check_types] 100.8 µs 126.5 µs -20.32%

@coderabbitai
Copy link

coderabbitai bot commented Sep 21, 2023

Walkthrough

This pull request introduces changes to improve code clarity and consistency across several Python files. It includes renaming classes and functions, adding new methods for object representation, updating import statements, and modifying CI/CD pipeline steps. The changes are primarily focused on enhancing readability and maintainability.

Changes

File Summary
benchmarks/_evented.py Minor update in variable assignment and type hint comment.
src/psygnal/... Import updates, class name replacements, and attribute filtering.
src/psygnal/_weak_callback.py Class and function renaming, addition of object_repr() method, and updates to __init__() and __repr__() methods.
tests/test_weak_callable.py Addition of a print statement.
.github/workflows/test.yml Addition of a conditional step in the CI/CD pipeline.

🐇💻

Code refined, clarity defined,

In the realm of logic, we're no longer confined.

With each pull request, we strive,

To make our codebase come alive.

So here's to changes, big and small,

May they make a difference, after all! 🎉


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.

Copy link

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between 2161320 and 90d4394.
Files selected for processing (4)
  • benchmarks/_evented.py (1 hunks)
  • src/psygnal/_signal.py (6 hunks)
  • src/psygnal/_weak_callback.py (18 hunks)
  • tests/test_weak_callable.py (1 hunks)
Files skipped from review due to trivial changes (3)
  • benchmarks/_evented.py
  • src/psygnal/_weak_callback.py
  • tests/test_weak_callable.py
Additional comments (Suppressed): 6
src/psygnal/_signal.py (6)
  • 30-38: The import statements have been updated to reflect the new names of classes and functions in _weak_callback.py. Ensure that these changes are consistent throughout the codebase.

  • 597-603: The _WeakSetattr class has been renamed to WeakSetattr. This change is reflected in the instantiation of a WeakSetattr object. Make sure all references to this class have been updated accordingly.

  • 630-635: The _WeakSetattr class has been renamed to WeakSetattr. This change is reflected in the instantiation of a WeakSetattr object. Make sure all references to this class have been updated accordingly.

  • 701-707: The _WeakSetitem class has been renamed to WeakSetitem. This change is reflected in the instantiation of a WeakSetitem object. Make sure all references to this class have been updated accordingly.

  • 738-742: The _WeakSetitem class has been renamed to WeakSetitem. This change is reflected in the instantiation of a WeakSetitem object. Make sure all references to this class have been updated accordingly.

  • 1124-1130: The _StrongFunction class has been renamed to StrongFunction. This change is reflected in the filtering of the _slots attribute. Make sure all references to this class have been updated accordingly.

Copy link

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between 90d4394 and 5c4505f.
Files selected for processing (1)
  • .github/workflows/test.yml (1 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/test.yml

@tlambert03 tlambert03 merged commit 5aa8791 into pyapp-kit:main Sep 22, 2023
26 of 28 checks passed
@tlambert03 tlambert03 deleted the weak-repr branch September 22, 2023 17:47
@tlambert03 tlambert03 added the enhancement New feature or request label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

1 participant