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

Get rid of requests as core dependency #15781

Merged
merged 1 commit into from
May 17, 2021

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented May 11, 2021

Get rid of requests as core dependency

This change gets rid of requests as core dependency. We have to
change requests to become an optional dependency because it
(so far) pulls in chardet as dependency and chardet is
LGPL, which is not allowed to be mandatory dependency by
ASF policies.

More info here:

https://issues.apache.org/jira/browse/LEGAL-572

The changes:

  • connexion is vendored-in (and requests usage is replaced with httpx)
  • Http Provider is turned into optional provider (not preinstalled)
  • Few places where requests were used in core and in cloud_sql provider
    which did not cause compatibility problem, it was replaced by httpx.
  • new extra added for deprecated experimental API (which is disabled
    by default and optional)
  • tests are fixed (using pytest-httpx fixture package)
  • The providers: http, airbyte, apache.livy, opsgenie, slack (all depend
    on http) now explicitely depend on requirements.

^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@potiuk
Copy link
Member Author

potiuk commented May 11, 2021

A little context here.

  1. I used pytest-httpx fixture here which is very convenient way of mocking httpx, however it is pytest-fixture only - which means that we have to mix pytest and unittest type of tests. Howver I think this is justified (and I believe we've already agreed that it might make sense to have both kind of tests at least for a transition period. So this might be a good start.

  2. I also might still take a look at slighly less-backwards-compatible change in HttpHook, however I think we will not avoid to also having to upgrade Airbyte, Livy and OpsgenieAlert providers - they all depend on HttpHook and I think we cannot make them backwrds-compatible.

  3. If anyone thinks that makes sense I can split the PR, however getting rid of the requests as core dependency is common among all the changes.

  4. I will have to add another change - add capability to add version dependencies between providers when they are generated. I planned to do it anyway and it was inevitable, but I want to do it as a separate PR.

@potiuk
Copy link
Member Author

potiuk commented May 11, 2021

Also. What I tested:

  • system test for http works (the example_http DAG succeeds communicates with real world)
  • http provider tests (including the system test) work fine with uninstalled requests library
  • airflow starts and processes example DAGS with uninstalled requests library. UI works.
  • the API works with uninstalled requests library

@github-actions
Copy link

The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.

@potiuk potiuk requested a review from vikramkoka as a code owner May 12, 2021 10:44
@potiuk potiuk closed this May 12, 2021
@potiuk potiuk reopened this May 12, 2021
@github-actions
Copy link

The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.

@turbaszek
Copy link
Member

turbaszek commented May 13, 2021

Hey @potiuk would you mind splitting this change into two commits (code vendor + changes)? It would improve reviewing the required changes 🙏

Plus it may be useful to add note about this in our code style guide - requests are popular library, WDYT?

@potiuk
Copy link
Member Author

potiuk commented May 13, 2021

Yeah. I am happy to do it.... But there is still a chance we will not have to do it psf/requests#5797 - working on it, so maybe we will be able to simply delete that PR :)

@ad-m
Copy link
Contributor

ad-m commented May 13, 2021

we will be able to simply delete that PR

I have the impression that httpx is a better library in the long term as it is under active development. If the change is accepted, maybe we want to merge at least some of the changes and set a new long-term goal for the transition to httpx?

@potiuk
Copy link
Member Author

potiuk commented May 13, 2021

we will be able to simply delete that PR

I have the impression that httpx is a better library in the long term as it is under active development. If the change is accepted, maybe we want to merge at least some of the changes and set a new long-term goal for the transition to httpx?

That might be an option as well. I think a lot depends on requests maintainer's responses now. I think it will be extremely difficult to get rid of requests. This is the 3rd most popular library in PIP and there are 100s if not thousands of packages using it. So we will have it anyway at least due to transitive dependencies.

I think once we start moving more torwards asyncio, httpx will definitely be the way to go.

@potiuk potiuk force-pushed the vendor-in-connexion branch 2 times, most recently from 64c081d to a12f8a9 Compare May 14, 2021 09:31
@potiuk
Copy link
Member Author

potiuk commented May 14, 2021

@turbaszek @kaxil @ashb - as discussed, I separated out connexion vendor-in + core requests replacement with httpx and made http provider optional.

I will add http change to httpx as separate - draft PR in case it turns out requests will not merge our PR shortly.

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

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

Please add a note in updating about the new deprecated_api extra.

UPDATING.md Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
This change gets rid of requests as core dependency. We have to
change requests to become an optional dependency because it
(so far) pulls in chardet as dependency and chardet is
LGPL, which is not allowed to be mandatory dependency by
ASF policies.

More info here:

https://issues.apache.org/jira/browse/LEGAL-572

The changes:

* connexion is vendored-in (and requests usage is replaced with httpx)
* Http Provider is turned into optional provider (not preinstalled)
* Few places where requests were used in core and in cloud_sql provider
  which did not cause compatibility problem, it was replaced by httpx.
* new extra added for deprecated experimental API (which is disabled
  by default and optional)
* tests are fixed (using pytest-httpx fixture package)
* The providers: http, airbyte, apache.livy, opsgenie, slack (all depend
  on http) now explicitely depend on `requirements`.
@github-actions
Copy link

The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.

@github-actions
Copy link

The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.

@potiuk potiuk merged commit bb115da into apache:master May 17, 2021
@potiuk potiuk deleted the vendor-in-connexion branch May 17, 2021 10:10
potiuk added a commit to potiuk/airflow that referenced this pull request May 17, 2021
This change replaces `requests` with httpx in the providers
that are derived from http provider. This change is related
to apache#15781 and was introduced initially to handle problem
described in:

https://issues.apache.org/jira/browse/LEGAL-572

However since we have a PR in progress to make chardet
an optional dependency in `requests` library

psf/requests#5797

and changing `requests` to `http` introduced backwards-incompatibility,
we might decide not to merge this PR - depending on how
quickly (if) `requests` library adopts the change.

Providers affected:

* http
* airbyte
* apache.livy
* opsgenie
* slack

Depends on apache#15781
kaxil added a commit to astronomer/airflow that referenced this pull request May 18, 2021
This was missed in apache#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.
potiuk pushed a commit that referenced this pull request May 18, 2021
This was missed in #15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.
ashb pushed a commit that referenced this pull request May 18, 2021
This was missed in #15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

(cherry picked from commit 180df03)
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 17, 2021
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

(cherry picked from commit 180df03482b07c18a57d20235ccdd1c3a12d9173)

GitOrigin-RevId: 5b28c451c9d9a80b7ec43cb0cdbb56e4b49962d3
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 23, 2021
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

(cherry picked from commit 180df03482b07c18a57d20235ccdd1c3a12d9173)

GitOrigin-RevId: 5b28c451c9d9a80b7ec43cb0cdbb56e4b49962d3
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Nov 27, 2021
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

(cherry picked from commit 180df03482b07c18a57d20235ccdd1c3a12d9173)

GitOrigin-RevId: 5b28c451c9d9a80b7ec43cb0cdbb56e4b49962d3
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Mar 10, 2022
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
@potiuk potiuk restored the vendor-in-connexion branch April 26, 2022 20:50
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Jun 4, 2022
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Jul 10, 2022
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
@potiuk potiuk deleted the vendor-in-connexion branch July 29, 2022 19:58
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Aug 27, 2022
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Oct 4, 2022
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
aglipska pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Oct 7, 2022
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Dec 7, 2022
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Jan 27, 2023
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
kosteev pushed a commit to kosteev/composer-airflow-test-copybara that referenced this pull request Sep 12, 2024
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
kosteev pushed a commit to kosteev/composer-airflow-test-copybara that referenced this pull request Sep 13, 2024
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 17, 2024
This was missed in apache/airflow#15781

Since "connexion" is Apache licensed, this is "not a blocker" for 2.1.0 as mentioned in https://www.apache.org/legal/release-policy.html#license-file

>When a package bundles code under several licenses, the LICENSE file MUST contain details of all these licenses. For each component which is not Apache licensed, details of the component MUST be appended to the LICENSE file. The component license itself MUST either be appended or else stored elsewhere in the package with a pointer to it from the LICENSE file, e.g. if the license is long.

As "connextion" is Apache 2 Licensed, this _might_ be OK.

GitOrigin-RevId: 180df03482b07c18a57d20235ccdd1c3a12d9173
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-tools full tests needed We need to run full set of tests for this PR to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants