Skip to content

Turn Pydantic into an optional dependency - #37320

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:make-pydantic-optional-dependency
Feb 12, 2024
Merged

Turn Pydantic into an optional dependency#37320
potiuk merged 1 commit into
apache:mainfrom
potiuk:make-pydantic-optional-dependency

Conversation

@potiuk

Copy link
Copy Markdown
Member

We've been internally using pydantic for internal API and it caused some compatibility issues, because Pydantic is so popular and currently still users of Pydantic are somewhat split between Pydantic 1 and Pydantic 2. The popularity of Pydantic works against us, and since we are not yet using it in "production" (and in the future we will only actually use it for Internal API), it seems that turning Pydantic into an optional dependency is the best way we can proceed.

It's as simple as converting all the direct imports into a common util imports that have a fallback mechanism when import is not found.

This should enable less conflicts when installing 3rd-party libraries with Airflow.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@potiukpotiuk added this to the Airflow 2.8.2 milestone Feb 10, 2024
@potiuk
potiukforce-pushed the make-pydantic-optional-dependency branch 4 times, most recently from 312f55d to ac41af9CompareFebruary 11, 2024 01:09
@potiukpotiuk changed the title Turn Pydantic into an optional depenedencyTurn Pydantic into an optional dependencyFeb 11, 2024
@potiuk
potiukforce-pushed the make-pydantic-optional-dependency branch from ac41af9 to 676a4ecCompareFebruary 11, 2024 01:54
Comment thread.github/workflows/ci.yml Outdated
@potiuk
potiukforce-pushed the make-pydantic-optional-dependency branch from 676a4ec to 88c435aCompareFebruary 11, 2024 01:57
Comment thread.github/workflows/ci.yml Outdated
@potiukpotiuk mentioned this pull request Feb 11, 2024
@potiuk
potiukforce-pushed the make-pydantic-optional-dependency branch 3 times, most recently from 0f41e34 to b9b06a1CompareFebruary 11, 2024 21:10
Comment threadtests/core/test_settings.py Outdated
Comment threadtests/providers/openai/hooks/test_openai.py Outdated
Comment threadairflow/utils/pydantic.py Outdated
We've been internally using pydantic for internal API and it caused
some compatibility issues, because Pydantic is so popular and currently
still users of Pydantic are somewhat split between Pydantic 1 and
Pydantic 2. The popularity of Pydantic works against us, and since we
are not yet using it in "production" (and in the future we will only
actually use it for Internal API), it seems that turning Pydantic into
an optional dependency is the best way we can proceed.
It's as simple as converting all the direct imports into a common util
imports that have a fallback mechanism when import is not found.
This should enable less conflicts when installing 3rd-party libraries
with Airflow.
Added test where pydantic is removed. Also made sure that the special
cases we have tests for run full suite of tests - non-db and db.
@potiuk
potiukforce-pushed the make-pydantic-optional-dependency branch from 3d6128a to 16aeb19CompareFebruary 12, 2024 20:42
@potiuk
potiuk merged commit c3f48ee into apache:mainFeb 12, 2024
@potiuk
potiuk deleted the make-pydantic-optional-dependency branch February 12, 2024 23:08
potiuk added a commit that referenced this pull request Feb 13, 2024
We've been internally using pydantic for internal API and it caused
some compatibility issues, because Pydantic is so popular and currently
still users of Pydantic are somewhat split between Pydantic 1 and
Pydantic 2. The popularity of Pydantic works against us, and since we
are not yet using it in "production" (and in the future we will only
actually use it for Internal API), it seems that turning Pydantic into
an optional dependency is the best way we can proceed.
It's as simple as converting all the direct imports into a common util
imports that have a fallback mechanism when import is not found.
This should enable less conflicts when installing 3rd-party libraries
with Airflow.
Added test where pydantic is removed. Also made sure that the special
cases we have tests for run full suite of tests - non-db and db.
(cherry picked from commit c3f48ee)
potiuk added a commit to potiuk/airflow that referenced this pull request Feb 13, 2024
The changes in apache#37320 introduced flakiness while removing side-effect
of configuration test. Cleanup of ProvidersManager might
interfere with other tests using it at the same time. This caused
some Non-DB test failures with missing keys in ProvidersManager.
The fix is to mark the configuration test as DB-test - then it
will never be run by NonDB xdist and it will always run
sequentially to other tests (and still it will not
introduce side-effect as cleanup will always be done between tests.
potiuk added a commit that referenced this pull request Feb 13, 2024
The changes in #37320 introduced flakiness while removing side-effect
of configuration test. Cleanup of ProvidersManager might
interfere with other tests using it at the same time. This caused
some Non-DB test failures with missing keys in ProvidersManager.
The fix is to mark the configuration test as DB-test - then it
will never be run by NonDB xdist and it will always run
sequentially to other tests (and still it will not
introduce side-effect as cleanup will always be done between tests.
@ephraimbuddyephraimbuddy added the type:misc/internal Changelog: Misc changes that should appear in change log label Feb 19, 2024
ephraimbuddy pushed a commit that referenced this pull request Feb 20, 2024
The changes in #37320 introduced flakiness while removing side-effect
of configuration test. Cleanup of ProvidersManager might
interfere with other tests using it at the same time. This caused
some Non-DB test failures with missing keys in ProvidersManager.
The fix is to mark the configuration test as DB-test - then it
will never be run by NonDB xdist and it will always run
sequentially to other tests (and still it will not
introduce side-effect as cleanup will always be done between tests.
(cherry picked from commit cbc9af0)
ephraimbuddy pushed a commit that referenced this pull request Feb 22, 2024
We've been internally using pydantic for internal API and it caused
some compatibility issues, because Pydantic is so popular and currently
still users of Pydantic are somewhat split between Pydantic 1 and
Pydantic 2. The popularity of Pydantic works against us, and since we
are not yet using it in "production" (and in the future we will only
actually use it for Internal API), it seems that turning Pydantic into
an optional dependency is the best way we can proceed.
It's as simple as converting all the direct imports into a common util
imports that have a fallback mechanism when import is not found.
This should enable less conflicts when installing 3rd-party libraries
with Airflow.
Added test where pydantic is removed. Also made sure that the special
cases we have tests for run full suite of tests - non-db and db.
(cherry picked from commit c3f48ee)
ephraimbuddy pushed a commit that referenced this pull request Feb 22, 2024
The changes in #37320 introduced flakiness while removing side-effect
of configuration test. Cleanup of ProvidersManager might
interfere with other tests using it at the same time. This caused
some Non-DB test failures with missing keys in ProvidersManager.
The fix is to mark the configuration test as DB-test - then it
will never be run by NonDB xdist and it will always run
sequentially to other tests (and still it will not
introduce side-effect as cleanup will always be done between tests.
(cherry picked from commit cbc9af0)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providersarea:serializationarea:system-testskind:documentationprovider:googleGoogle (including GCP) related issuesprovider:papermilltype:misc/internalChangelog: Misc changes that should appear in change log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@potiuk@Taragolis@vincbeck@ephraimbuddy