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

Specify maximum typeguard version in pyproject.toml #125

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

waleedmebane
Copy link
Contributor

deal test doesn't work when typeguard>2.13.3 is installed. It gives an error like the following:

$ python3 -m deal test deal_test.py 
running deal_test.py
test
2
  running count
    count(item='', items=[])
    Traceback (most recent call last):
      File "/home/user/.local/lib/python3.9/site-packages/deal/_cli/_test.py", line 111, in run_cases
        case()
      File "/home/user/.local/lib/python3.9/site-packages/deal/_testing.py", line 55, in __call__
        self._check_result(result)
      File "/home/user/.local/lib/python3.9/site-packages/deal/_testing.py", line 65, in _check_result
        memo = typeguard._CallMemo(
      File "/home/user/.local/lib/python3.9/site-packages/typeguard/__init__.py", line 42, in __getattr__
        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
    AttributeError: module 'typeguard' has no attribute '_CallMemo'

"_CallMemo" seems to have been removed from typeguard.

deal test doesn't work when typeguard>2.13.3 is installed.
It gives an error like the following:
```
$ python3 -m deal test deal_test.py 
running deal_test.py
test
2
  running count
    count(item='', items=[])
    Traceback (most recent call last):
      File "/home/user/.local/lib/python3.9/site-packages/deal/_cli/_test.py", line 111, in run_cases
        case()
      File "/home/user/.local/lib/python3.9/site-packages/deal/_testing.py", line 55, in __call__
        self._check_result(result)
      File "/home/user/.local/lib/python3.9/site-packages/deal/_testing.py", line 65, in _check_result
        memo = typeguard._CallMemo(
      File "/home/user/.local/lib/python3.9/site-packages/typeguard/__init__.py", line 42, in __getattr__
        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
    AttributeError: module 'typeguard' has no attribute '_CallMemo'
```

"_CallMemo" seems to have been removed from typeguard.
@waleedmebane
Copy link
Contributor Author

The contents of deal_test.py were:

import deal
from typing import List

@deal.post(lambda result: result >= 0)
@deal.pure
def count(items: List[str], item: str) -> int:
    return items.count(item)

test_count = deal.cases(count)

listcount = count(items=["apple", "banana", "banana"], item="banana")
print("test")
print(listcount)

@orsinium
Copy link
Member

Thank you :) Can you make deal compatible with the new release instead?

@orsinium
Copy link
Member

orsinium commented Mar 23, 2023

CallMemo now lives in typeguard._memo and check_return_type lives in typeguard._functions

@waleedmebane
Copy link
Contributor Author

I did notice that there was a CallMemo with a different interface in the latest version of typeguard, as I tried to see if deal could be trivially updated. Unfortunately, I don't have the time to code much right now. I was just taking a break from writing and decided to see if I could learn some of what deal could do. Thanks.

@orsinium
Copy link
Member

That's alright, I can take care of it. Have fun exploring deal. If you're looking for more mind-bending Python stuff, dry-python team has some fun functional libraries.

@orsinium orsinium merged commit 8dc7e93 into life4:master Mar 24, 2023
@orsinium orsinium mentioned this pull request Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants