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 types to Python code #450

Open
ricklamers opened this issue Aug 30, 2021 · 5 comments
Open

Add types to Python code #450

ricklamers opened this issue Aug 30, 2021 · 5 comments
Labels
good first issue Good for newcomers improvement An improvement or enhancement to an existing feature. internal Something that does not affect users directly, e.g. code quality.

Comments

@ricklamers
Copy link
Member

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.

@ricklamers ricklamers added good first issue Good for newcomers improvement An improvement or enhancement to an existing feature. labels Aug 30, 2021
@ricklamers ricklamers changed the title Add types to Python codebase Add types to Python code Aug 30, 2021
@yannickperrenet
Copy link
Contributor

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.

@yannickperrenet yannickperrenet added the internal Something that does not affect users directly, e.g. code quality. label Aug 31, 2021
@balotofi
Copy link

i still don't understand how you want this to be resolved

@astrojuanlu
Copy link
Contributor

Hi @balotofi! The idea is to extend gradual typing like this:

def send_event(
app: Flask, event: Event, event_properties: Optional[dict] = None
) -> bool:

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.

@sbarrios93
Copy link
Contributor

@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?

@astrojuanlu
Copy link
Contributor

Thanks @sbarrios93! We'll continue the conversation about #1216 on the PR itself.

About the Python version, I opened #1217.

@astrojuanlu astrojuanlu added the hacktoberfest Issues seeking Hacktoberfest contributions label Sep 30, 2022
@ricklamers ricklamers removed the hacktoberfest Issues seeking Hacktoberfest contributions label Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers improvement An improvement or enhancement to an existing feature. internal Something that does not affect users directly, e.g. code quality.
Projects
None yet
Development

No branches or pull requests

5 participants