-
Notifications
You must be signed in to change notification settings - Fork 49
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
fix: fix compatibility with typing-extensions 0.4.12 #649
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #649 +/- ##
==========================================
- Coverage 89.14% 89.12% -0.03%
==========================================
Files 39 39
Lines 4682 4718 +36
==========================================
+ Hits 4174 4205 +31
- Misses 508 513 +5 ☔ View full report in Codecov by Sentry. |
@hanjinliu just a head up... in attempting to fix stuff broken by typing-extensions 0.4.12, I need to make all of the items inside of
i'll undo that restriction for now, but it would probably be best if you tried not to rely on dicts in Annotations as being mutable objects that you can modify after creation. |
I allowed metadata to be mutable again, but now hit another issue with magicclass. can you check out this branch and see if you can determine what has broken in magic class? tests/test_types.py ....F [ 70%]
tests/test_types.py:71 test_nested_annotated_in_optional - Attribute…
tests/test_types.py ............. [ 75%]
tests/test_undo.py .......... [ 78%]
tests/test_widget_types.py ................ [ 84%]
tests/test_worker.py ............. [ 88%]
tests/test_wrappers.py ......................... [ 97%]
tests/test_wraps.py ........ [100%]
=================================== FAILURES ===================================
______________________ test_nested_annotated_in_optional _______________________
@pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python3.9+")
def test_nested_annotated_in_optional():
@magicclass
class A:
def f(
self,
x: Optional[list[Annotated[int, {"text": "T", "options": {"min": -1}}]]] = None,
):
x.sort()
ui = A()
> ui["f"].changed()
E AttributeError: 'function' object has no attribute 'changed'
tests/test_types.py:83: AttributeError |
Hi @tlambert03 , thank you for notifying me. Regarding to the AttributeError, I found it originated from the error trying to write from magicgui.signature import _make_hashable
_make_hashable(list[int])
This happens when I pass generic classes to the "annotation" GUI option. The example below has redundant "annotation" option but it shows how the AttributeError happens. @magicgui
def f(a: Annotated[list[int], {"annotation": list[int]}]):
pass Is it possible to fix this from the |
… into fix-typing-ext
… into fix-typing-ext
… into fix-typing-ext
python/typing_extensions#392 seems to be resulting in test errors:
this attempts to fix it