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-2973] Add Python 3.6 to Supported Prog Langs #3815

Closed
wants to merge 1 commit into from

Conversation

kaxil
Copy link
Member

@kaxil kaxil commented Aug 28, 2018

Make sure you have checked all steps below.

Jira

  • My PR addresses the following Airflow Jira issues and references them in the PR title. For example, "[AIRFLOW-XXX] My Airflow PR"

Description

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.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.

Code Quality

  • Passes git diff upstream/master -u -- "*.py" | flake8 --diff

@kaxil
Copy link
Member Author

kaxil commented Aug 28, 2018

cc @bolkedebruin @Fokko

@ashb
Copy link
Member

ashb commented Aug 28, 2018

Is it worth adding/changing Py 3.5 to Py 3.6 in Travis? (I don't think we want to have both py 3.5 and py 3.6 tests as not that much has changed and we don't want more runtime) but...?

@kaxil kaxil changed the title Add Python 3.6 to Supported Prog Langs [AIRFLOW-XXX] Add Python 3.6 to Supported Prog Langs Aug 28, 2018
@bolkedebruin
Copy link
Contributor

Agree with @ashb

@codecov-io
Copy link

codecov-io commented Aug 28, 2018

Codecov Report

Merging #3815 into master will increase coverage by 0.66%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3815      +/-   ##
==========================================
+ Coverage   76.67%   77.34%   +0.66%     
==========================================
  Files         199      203       +4     
  Lines       16186    15817     -369     
==========================================
- Hits        12410    12233     -177     
+ Misses       3776     3584     -192
Impacted Files Coverage Δ
airflow/sensors/s3_prefix_sensor.py 0% <0%> (-100%) ⬇️
airflow/operators/slack_operator.py 0% <0%> (-97.37%) ⬇️
airflow/sensors/s3_key_sensor.py 30.3% <0%> (-69.7%) ⬇️
airflow/example_dags/example_python_operator.py 78.94% <0%> (-15.79%) ⬇️
airflow/utils/helpers.py 71.16% <0%> (-13.21%) ⬇️
airflow/hooks/mysql_hook.py 78% <0%> (-12%) ⬇️
airflow/sensors/sql_sensor.py 90.47% <0%> (-9.53%) ⬇️
airflow/configuration.py 83.33% <0%> (-6.09%) ⬇️
airflow/models.py 88.74% <0%> (-3.31%) ⬇️
airflow/utils/state.py 93.33% <0%> (-3.1%) ⬇️
... and 73 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e703d6b...a20a648. Read the comment docs.

@kaxil
Copy link
Member Author

kaxil commented Aug 28, 2018

@bolkedebruin @ashb Do you guys suggest to add Python 3.4 and Python 3.6 both to Travis? As currently just have py27 and py35 on Travis.

@Fokko
Copy link
Contributor

Fokko commented Aug 28, 2018

This would give too much load on Travis. Apache infra paying for cpu hours.

@kaxil
Copy link
Member Author

kaxil commented Aug 28, 2018

@Fokko Agree with that, so do you like to keep it as it is or changing py3.5 to py3.6 and keep py2.7 and py3.6 ?

@bolkedebruin
Copy link
Contributor

2.7 and 3.6 (and maybe 3.7 instead)

@tedmiston
Copy link
Contributor

@kaxil @Fokko I also put together a quick complementary PR #3816 adding / upgrading to 3.6 in all of the places. CI is still running so I may expect some test failures but hopefully nothing major. I would be happy to merge this into Kaxil's current PR or as a follow-on PR.

Personally I would prefer Travis to run against 3.6 over 3.5. It's been out for a while now, and AFAIK we don't have a compelling reason to prefer 3.5 today.

That said it would be nice if we could have some sort of nightly-ish build to run on all supported subversions for a very thorough test.

@kaxil kaxil changed the title [AIRFLOW-XXX] Add Python 3.6 to Supported Prog Langs [AIRFLOW-2973] Add Python 3.6 to Supported Prog Langs Aug 28, 2018
@kaxil
Copy link
Member Author

kaxil commented Aug 28, 2018

@tedmiston I have merged the changes to this PR but as a follow-up to this PR, I suppose it would be great if you can test Python 3.7 and as Bolke mentioned, we can then replace 3.6 with 3.7 :)

@kaxil kaxil force-pushed the py3-6-support branch 4 times, most recently from d80dd4c to 959557d Compare August 28, 2018 19:03
@kaxil kaxil mentioned this pull request Aug 28, 2018
12 tasks
@kaxil
Copy link
Member Author

kaxil commented Aug 28, 2018

The way CI works now with Docker, we will have to change bits on our Docker CI Image as well. I have pinged @gerardo on the Dockerised PR to help the case where we would have to run tests for multiple python versions. I am hence just keeping the scope of this PR to add 3.6 to setup.py, or we can close this PR entirely and have first sort out our CI pipeline and can add these changes over there?

cc @ashb @Fokko

@gerardo
Copy link
Contributor

gerardo commented Aug 29, 2018

(posting again in here)

@kaxil give we're using tox for this, it should be a matter of just adding/updating the runtimes inside the tox file here and here and then pass the desired python version through the Travis script as we do now.

@Fokko
Copy link
Contributor

Fokko commented Aug 29, 2018

@gerardo This does not make sense to me. Why are we installing both 2 and 3 in the ci image? https://github.com/apache/incubator-airflow-ci/blob/master/Dockerfile

Ideally we would have a Python 2 and Python 3 image, but this can become complicated quickly.

@gerardo
Copy link
Contributor

gerardo commented Aug 29, 2018

@Fokko The only reason 2 versions are being installed is that I wanted to follow the CI process as close as it was before merging the docker-ci changes. At the time, the tox target and the python version to be used were being matched (run a python3 tox target and run tox under python3), although I never understood the reason. We only use the system python to install tox.

I only remember coming across a single issue with a PythonVirtualOperator test failing because of a version mismatch (tox running python3 and PythonVirtualOperator trying to use the system python, which could be python2), but if that happens, it should be simple to fix.

@kaxil
Copy link
Member Author

kaxil commented Aug 29, 2018

@gerado I already tried changing that, it says python3.6 interpreter not found.

Here is the link to the Travis job:

https://travis-ci.org/apache/incubator-airflow/builds/421714589

@gerardo
Copy link
Contributor

gerardo commented Aug 29, 2018

@kaxil mmm, it seems it needs to be installed in the system to be used: https://tox.readthedocs.io/en/latest/example/general.html#basepython-defaults-overriding

And it seems the only python3 version available in Ubuntu Xenial is 3.5.1: https://packages.ubuntu.com/search?keywords=python3-dev&searchon=names&suite=xenial&section=all

It might be a matter of having a separate image (like @Fokko suggested) using a more recent Ubuntu (Artful or Bionic). The official python docker images are also based in Debian, that's another option.

@kaxil
Copy link
Member Author

kaxil commented Aug 29, 2018

Would you be able to do that if you have got time?

@gerardo
Copy link
Contributor

gerardo commented Aug 29, 2018

@kaxil sure! I have time this week to work on this.

@Fokko
Copy link
Contributor

Fokko commented Aug 29, 2018

@gerardo On the incubator-airflow-ci we can create two branches, one for Python 2 and one for Python 3. I can configure the docker-hub to publish two images incubator-airflow-ci:2 and incubator-airflow-ci:3 for example

@tedmiston
Copy link
Contributor

@kaxil Sure. Btw, I've started a 3.7 test branch currently living here - https://github.com/astronomerio/incubator-airflow/tree/python-3.7-experimental.

It looks like the merge of #3816 into here yesterday was reverted. It sounds like this PR may be on hold until the Docker image is reworked to support multiple subversions of Python 3. Is that correct?

@gerardo Can you tag me in that PR ^ when you're done? I'd like to make a similar change in my follow up PR to support Python 3.7 (perhaps with an optional flag for now so we don't burn Apache Infra CI time).

@kaxil
Copy link
Member Author

kaxil commented Aug 29, 2018

That's awesome @gerardo . Looking forward for it.

@tedmiston Great. Would love to see Py3.7 PR, I think #3816 can be converted to be a 3.7 Upgrade PR. So once 3.6 is fixed, you can probably overwrite it with 3.7.

@gerardo
Copy link
Contributor

gerardo commented Oct 8, 2018

@kaxil sure! I have time this week to work on this.

BTW, I hugely underestimated the amount of free time I had available 😂

Here's the PR that creates separate images for python2 and python3: apache/airflow-ci#4

@tedmiston Regarding python3.7, it's still not available to any Ubuntu version, not even through a PPA. Even cosmic cuttlefish, which hasn't been released yet, supports only 3.6.

@Fokko
Copy link
Contributor

Fokko commented Oct 12, 2018

@gerardo When updating the CI, we run into problems since we need a to point the Python3 tests to the Python 3 image: https://travis-ci.org/Fokko/incubator-airflow

I think we need to get rid of the python3 and python3.6 command and generalize everything to just python, and pick the correct base images if we run on either python2 or python3.

I think updating to Python 3.7 doesn't make sense since a lot of companies are still on 3.6 (or even lower :-)

@gerardo
Copy link
Contributor

gerardo commented Nov 14, 2018

@Fokko @kaxil @tedmiston
I've done some more work on apache/airflow-ci#4, but I've found a few issues with the Python3.6 upgrade, plus other issues with some assumptions that the test suite makes:

  • tests.operators.test_virtualenv_operator.test_python_3 fails when run with the python2 image (logs). Using skipIf to check what python version is present should be enough. And maybe we should do the same with test_python_2 and test_python_2.7
  • tests.operators.test_virtualenv_operator.test_string_args is a weird test. It uses a method called _invert_python_major_version() to use the opposite version to the one available, which is causing problems with python2 tests. Do you guys understand this test?
  • There was a change between python3.5 and python3.6 in the error message emitted when an object is not serializable (logs). It's just a matter of changing the test to check for the new message format.
  • One of the tz tests is failing as well, more specifically, test_following_previous_schedule_daily_dag_CEST_to_CET (logs). I'm not sure where to start. It seems to happen only with python3.6.

@Fokko
Copy link
Contributor

Fokko commented Nov 18, 2018

Give me some time to look into this.

@@ -398,6 +398,7 @@ def do_setup():
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this line should be dropped since 3.4 is not tested in the CI process

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disregard - this has been fixed in #4259

@holdenk
Copy link
Contributor

holdenk commented Jan 3, 2019

Hi @gerardo I did some looking into tests.operators.test_virtualenv_operator.test_string_args as well. Looking at the Python operator description string args is the only supported method of allowing configuration when the Python versions don't match between airflow and operator -- which would be why it does the test through these string arguments.

It looks like if we want to make that test workable in CI then the Python 2 image needs Python 3 installed as well and vice versa just different default Pythons configured.

@Fokko
Copy link
Contributor

Fokko commented Jul 26, 2019

@Fokko Fokko closed this Jul 26, 2019
@kaxil kaxil deleted the py3-6-support branch August 30, 2019 20:39
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.

9 participants