orchest
orchest copied to clipboard
Add types to Python code
Describe the solution you'd like
Add types to Python codebase
What does your solution aim to solve?
Make it more explicit what arguments functions take and therefore make it easier to extend consume or refactor code.
Whilst working on this it is good to keep in mind the changes that are introduced in Python3.9, see Pep 585 (deprecating things like typing.Iterable).
For the time being we will stay on Python3.8 because of the base images we use for the orchest-api, auth-server, orchest-webserver and update-server: tiangolo/meinheld-gunicorn-flask, which does not yet have a Python3.9 version available.
An example module where we already use type hints is analytics.py.
i still don't understand how you want this to be resolved
Hi @balotofi! The idea is to extend gradual typing like this:
https://github.com/orchest/orchest/blob/b39ded5eca8e9ededf5e246de11e0c2581048beb/services/orchest-webserver/app/app/analytics.py#L131-L133
To the rest of the codebase.
One can start module by module, or package by package, rather than spending a lot of time working on a huge pull request.
@astrojuanlu I can help with this. Got a preference which part of the codebase should I focus on first?
Are we still sticking to typing as it was on Python 3.8 or should I use the standards of Python 3.9?
Thanks @sbarrios93! We'll continue the conversation about #1216 on the PR itself.
About the Python version, I opened https://github.com/orchest/orchest/issues/1217.