mockafka-py icon indicating copy to clipboard operation
mockafka-py copied to clipboard

Type hints cause TypeError under Python 3.8

Open MrkGrgsn opened this issue 1 year ago • 3 comments

Describe the bug Type hinting in Mockafka uses standard collection types as generics, eg, list[str], rather than the capitalised type alias from the typing module List[str]. This ability is only available in Python 3.8 when using the annotations future statement: from __future__ import annotations. Without the future statement, the code results in a type error.

See PEP 585.

To Reproduce Run the tests under Python 3.8. Running mypy under Python 3.8 will also identify the problem.

Expected behavior There are two options:

  1. Revert to the types from the typing module, eg, Dict instead of dict
  2. Add the future statement to affected files.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Fedora 38
  • Python 3.8.18

Additional context Add any other context about the problem here.

MrkGrgsn avatar May 08 '24 05:05 MrkGrgsn

Hi @MrkGrgsn ,

Thanks for bringing this up,

But in this version we just support python +3.9

But i will work on this issue later , if you have time it's great to help us in this issue 😄

alm0ra avatar May 08 '24 17:05 alm0ra

In the CI

We just added python +3.9 for running tests

https://github.com/alm0ra/mockafka-py/blob/main/.github/workflows/python-app.yml

alm0ra avatar May 08 '24 17:05 alm0ra

in this version we just support python +3.9

Ah, okay. I checked pyproject.toml before I submitted this report and I saw python = ">=3.8,<4.0" so I went ahead.

I'm happy to look at adding the future statement, it seems the forward-looking fix of the two options, but if you haven't been targeting 3.8 there may be other issues. I'll let you know what happens.

MrkGrgsn avatar May 08 '24 23:05 MrkGrgsn

fixed inv0.1.56

alm0ra avatar May 19 '24 09:05 alm0ra