-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Install typing package only for Python < 3.5 #10821
Conversation
Seems reasonable to me. |
Just for completeness, here's an example where the current setup was causing a problem: https://travis-ci.org/tensorflow/magenta/builds/647132754 |
Has the builtin typing package evolved since 3.5 in ways that the external library has backported (and that we use)? |
My understanding from the bug linked above is that the typing external library is intended only to be used with versions of python (<3.5) that don't already have it built in and that it causes problems when it overrides built-in versions (python >3.5). |
I had a chance to look at the linked issues a bit more, and I take back my original assessment for the moment.
It has changed a lot, and I'd say it's highly likely that we're relying on features from newer typing libraries. And if we were to change to using the stdlib for typing it would be incredibly easy for a developer to use a feature in a later version of typing without knowing it (which may or may not be caught by tests). You would basically have to keep a copy of the 3.5 version of typing around and constantly refer back to it. Here's a diff (search for src/typing.py): python/typing@3.5.3.0...3.7.4.1
What I'm confused about is that you're testing in python 3.7.1, and beam's minimum version of typing is 3.7.0 and the max version on pypi is 3.7.4.1. So in the range |
The Travis log includes the full installation history, so I'm pretty sure we're picking up The thing that triggered the problem for us was the beam |
Do you have a log indicating which version of typing gets picked up with 2.18.0? I assume it's the same version. I think you're right that
The exception is not coming from Beam, so it's unclear how using a feature of the typing module in Beam could be causing this issue, especially considering the typing module doesn't do much. I'm not saying the problem isn't caused by Beam, but the evidence has left me pretty perplexed. |
drive by comment, this also seems related to the issue in (conda-forge/apache-beam-feedstock#21). Do we know, if we are actually depending on the newer features from the typing libraries? |
The typing features added since 3.5.3 are:
I'm pretty sure I did not use any of these. There were significant runtime changes to the typing module, but the impact of these is impossible to predict from looking at the diff, and some of them may be beneficial while others are detrimental (hence this PR). @cghawthorne can you remove the change to |
Back with some more info. I'm increasingly of the opinion that this PR is the right way to go, but merging it should be contingent upon dropping support for python versions less than 3.5.3. Here's why
Therefore, I think we'll be in pretty good shape if we update our test runners to use python 3.5.3 and then merge this PR. |
Thank you @chadrik. This is great information. I agree with your conclusion. /cc @tvalentyn |
Thanks. The main problem with setting 3.5.3 as minimal required version is that Beam Jenkins workers are stuck with 3.5.2 right now, but we have an AI to address that: https://issues.apache.org/jira/browse/BEAM-8152. cc: @mwalenia @kamilwu @yifanzou . We can skip tests failing on 3.5.2 if Python 3.5 version is less than 3.5.3 in the meantime. Do we have a lot of tests that are affected? |
Not yet. I was about to introduce one on another PR, but if the switch to 3.5.3 is going to be awhile I can work around it. Is there Jira issue that I can reference in the code? |
@chadrik you can reference https://issues.apache.org/jira/browse/BEAM-9372. |
Anything I can help with here? I'm not completely following what all the blocking items are at this point. |
retest this please |
Rerunning the tests to see which tests failed on this PR. Requiring 3.5.3 is blocked on BEAM-8152. Would
be a possible workaround? |
So the tests fail because |
typing_extensions is always required. I think the requirements should look like this:
|
I guess I should say, it's always required until such a time as |
SGTM; @cghawthorne - could you please give it a try? Let's see if tests are passing. |
Prevents conflicts with built-in typing library. Follows advice in python/typing#573
Updated! |
retest this please |
Sigh, Jenkins is not paying heed again. |
retest this please |
@cghawthorne Thanks for the changes, we can merge once we have a green test signal. |
Pinged https://issues.apache.org/jira/browse/INFRA-19836 and reached out to asfinfra via Slack regarding next steps there. |
Run Python PreCommit |
1 similar comment
Run Python PreCommit |
ok, triggered now.. |
Run Python 3.6 PostCommit |
Run Python 3.7 PostCommit |
Run Python 3.5 PostCommit |
Run Python PreCommit |
Run Python 3.7 PostCommit |
I checked that my commands actually triggered postcommits and they passed:
The most recent failure on the PR is a flake: https://issues.apache.org/jira/browse/BEAM-9484 |
PiperOrigin-RevId: 307461594 Change-Id: Icf93fbb0279cb2dc2933fde7800cc4c82a2a5233
PiperOrigin-RevId: 307461594 Change-Id: Icf93fbb0279cb2dc2933fde7800cc4c82a2a5233
Prevents conflicts with built-in typing library. Follows advice in python/typing#573
Modifies change introduced in #9915. @chadrik @robertwb
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.