swansonk14 / typed-argument-parser

Typed argument parser for Python
MIT License
494 stars 40 forks source link

Clean the code, type annotations and update dependencies #143

Closed arnaud-ma closed 2 months ago

arnaud-ma commented 2 months ago

Some code must have been added before Python 3.8. We can put this version to good use. These fixes do not modify the runtime in any way.

Changes:

I think it is possible to go much further in type annotation (e.g. by annotating some methods with *args and **kwargs). But for this, typing-extensions must be added as a dependency.

I thought for a long time that using from __future__ import annotations to use dict[str | int, int] | List[str |int] instead of Union[Dict[Union[str, int], int], List[Union[str, int]] would be a good idea, but the package itself does not support this syntax so it would only be an additional source of bugs.

martinjm97 commented 2 months ago

What's the story here?

arnaud-ma commented 2 months ago

I apologize for the waste of time. I realized there were too many conflicts with other pull requests. It seems easier to me to make a (much) cleaner one later. The goals remain: update the < 3.8 Python code and add more precise type hints.

martinjm97 commented 2 months ago

I see. Sorry for the conflicts! I think making a few smaller PRs will make it easier to merge! Thanks!