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

Add type hinting to Python API #465

Open
mgovers opened this issue Jan 11, 2024 · 6 comments
Open

Add type hinting to Python API #465

mgovers opened this issue Jan 11, 2024 · 6 comments
Assignees
Labels
feature New feature or request good first issue Indicates a good issue for first-time contributors

Comments

@mgovers
Copy link
Member

mgovers commented Jan 11, 2024

See the TODO in

# When we're dropping python 3.8, we should introduce proper NumPy type hinting

Support for Python 3.8 was dropped in #464

@mgovers mgovers added feature New feature or request good first issue Indicates a good issue for first-time contributors labels Jan 11, 2024
@Cbit11
Copy link

Cbit11 commented Jan 11, 2024

I'll do it

@mgovers
Copy link
Member Author

mgovers commented Jan 11, 2024

Awesome! LMK if you need any help

@mgovers
Copy link
Member Author

mgovers commented Jan 30, 2024

@Cbit11 how is it going with the development?

@Jerry-Jinfeng-Guo
Copy link
Contributor

I don't understand this issue yet, what's wrong with this data_types.py document?

@mgovers
Copy link
Member Author

mgovers commented Jul 3, 2024

this may already be done in #613 and #648

@mgovers
Copy link
Member Author

mgovers commented Jul 4, 2024

this may already be done in #613 and #648

this is actually not entirely true.

  • Starting python3.9, we have list[Foo] and set[Foo] instead of List[Foo] and Set[foo], as well as collections.abc.Iterable and collections.abc.Mapping as opposed to typing.Iterable and typing.Mapping.

  • Starting python3.10 ( Drop python 3.9 #638 ) , we will have support for TypeVar including bounds https://docs.python.org/3.10/library/typing.html#typing.TypeVar . This will enable us to remove syntax like Union[SingleDataset, Dict[str, SingleComponentData]] and replace it with SingleDataset, where SingleDataset = Dict[ComponentTypeVar, SingleComponentData] and ComponentTypeVar = TypeVar['ComponentTypeVar', bounds=[ComponentType, str]]

  • Starting python3.10, Union is deprecated and replaced with the much simpler syntax |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Indicates a good issue for first-time contributors
Projects
Status: No status
Development

No branches or pull requests

3 participants