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

[AIRFLOW-5251] add missing typing-extensions dep for py37 #5857

Merged
merged 2 commits into from
Aug 23, 2019

Conversation

houqp
Copy link
Member

@houqp houqp commented Aug 19, 2019

Make sure you have checked all steps below.

Jira

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Turns out Protocol is still experimental and not available in python 3.7's typing module. So typing-extensions is still required for py3.7.

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
    • If you implement backwards incompatible changes, please leave a note in the Updating.md so we can assign it to a appropriate release

Code Quality

  • Passes flake8

@ashb
Copy link
Member

ashb commented Aug 19, 2019

Oh yes, Protocol isn't in core until 3.8, and even then it's under typing, not typing_exetenions :(

Could you update the build matrix so that one of the jobs runs on Python 3.7 please?

And do you think it is worth keeping this to <3.8 and adding an import guard to the few places we use it:

try:
    from typing import Protocol
except ImportError:
    from typing_extensions import Protocol

possibly bundled up into a module somewhere in the airflow tree so that we can, for example, just do from airflow.typing import Protocol whereever we want to use it without worrying about the import guard everywhere.

@houqp
Copy link
Member Author

houqp commented Aug 19, 2019

Sure, I will make that change today :)

@houqp houqp force-pushed the py37 branch 9 times, most recently from 55a7c78 to f9f0302 Compare August 20, 2019 16:45
@houqp
Copy link
Member Author

houqp commented Aug 20, 2019

I have changed the mysql build to use python 3.7. @ashb @potiuk let me know if you prefer to create a new build matrix entry for 3.7 instead.

one surprise is some of the identity comparison behaviors have been changed in 3.7, so I had to put in python version check in unit test to change the assertion statement conditionally.

@houqp houqp force-pushed the py37 branch 6 times, most recently from 8f0fd1b to 493b4ea Compare August 21, 2019 04:33
tests/utils/test_helpers.py Outdated Show resolved Hide resolved
airflow/models/crypto.py Outdated Show resolved Hide resolved
@ashb
Copy link
Member

ashb commented Aug 22, 2019

Thanks @houqp (for this and the related PR). Once this is green I'll merge.

@ashb ashb merged commit 3bb4b34 into apache:master Aug 23, 2019
@houqp houqp deleted the py37 branch August 23, 2019 19:20
Jerryguo pushed a commit to Jerryguo/airflow that referenced this pull request Sep 2, 2019
@dstandish
Copy link
Contributor

It seems this may be causing a problem with alembic. Since you run alembic from <root>/airflow directory, when it tries to import typing_extensions, it then tries to open typing, which resolves to this typing module and not the actual one.

That's probably confusing, but basically if I run alembic revision -m "something" I get import error from tying module.

If I run from repo root (specifying config file and changing script_location I don't get this error. (i get ERROR - Multiple heads are present;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants