diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 920529d777b34..a8b5a265f3afa 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -6964,8 +6964,8 @@ The change is backwards compatible, setting ``provide_context`` will add the ``p PR: `#5990 `_ -``airflow.sensors.filesystem.FileSensor`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``airflow.providers.standard.sensors.filesystem.FileSensor`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ FileSensor is now takes a glob pattern, not just a filename. If the filename you are looking for has ``*``\ , ``?``\ , or ``[`` in it then you should replace these with ``[*]``\ , ``[?]``\ , and ``[[]``. diff --git a/airflow/example_dags/example_sensors.py b/airflow/example_dags/example_sensors.py index 52b1b84e223e8..39d7b8d29635f 100644 --- a/airflow/example_dags/example_sensors.py +++ b/airflow/example_dags/example_sensors.py @@ -24,11 +24,11 @@ from airflow.models.dag import DAG from airflow.providers.standard.operators.bash import BashOperator from airflow.providers.standard.sensors.bash import BashSensor +from airflow.providers.standard.sensors.filesystem import FileSensor from airflow.providers.standard.sensors.python import PythonSensor from airflow.providers.standard.sensors.time import TimeSensor, TimeSensorAsync from airflow.providers.standard.sensors.time_delta import TimeDeltaSensor, TimeDeltaSensorAsync from airflow.providers.standard.sensors.weekday import DayOfWeekSensor -from airflow.sensors.filesystem import FileSensor from airflow.utils.trigger_rule import TriggerRule from airflow.utils.weekday import WeekDay diff --git a/airflow/reproducible_build.yaml b/airflow/reproducible_build.yaml index 79316e3ecdd6f..1c13b028bb4f0 100644 --- a/airflow/reproducible_build.yaml +++ b/airflow/reproducible_build.yaml @@ -1,2 +1,2 @@ -release-notes-hash: 4893030c9c8a4d22d13291823b88ad4d -source-date-epoch: 1730818031 +release-notes-hash: c68f3fa23f84c7fc270d73baaa2cc18d +source-date-epoch: 1731415143 diff --git a/contributing-docs/03_contributors_quick_start.rst b/contributing-docs/03_contributors_quick_start.rst index e6279936e6854..121323c5c9bdb 100644 --- a/contributing-docs/03_contributors_quick_start.rst +++ b/contributing-docs/03_contributors_quick_start.rst @@ -478,7 +478,7 @@ or pipx install pre-commit -You can add ````uv`` support for ``pre-commit`` even you install it with ``pipx`` using the commands +You can add ``uv`` support for ``pre-commit`` even you install it with ``pipx`` using the commands (then pre-commit will use ``uv`` to create virtualenvs for the hooks): .. code-block:: bash diff --git a/docs/apache-airflow/howto/operator/file.rst b/docs/apache-airflow-providers-standard/sensors/file.rst similarity index 92% rename from docs/apache-airflow/howto/operator/file.rst rename to docs/apache-airflow-providers-standard/sensors/file.rst index 49ca1c75f6042..6241cc2e50533 100644 --- a/docs/apache-airflow/howto/operator/file.rst +++ b/docs/apache-airflow-providers-standard/sensors/file.rst @@ -22,7 +22,7 @@ FileSensor ========== -Use the :class:`~airflow.sensors.filesystem.FileSensor` to detect files appearing in your local +Use the :class:`~airflow.providers.standard.sensors.filesystem.FileSensor` to detect files appearing in your local filesystem. You need to have connection defined to use it (pass connection id via ``fs_conn_id``). Default connection is ``fs_default``. diff --git a/docs/apache-airflow/howto/operator/index.rst b/docs/apache-airflow/howto/operator/index.rst index c16ec419c14f2..5dcda247522ca 100644 --- a/docs/apache-airflow/howto/operator/index.rst +++ b/docs/apache-airflow/howto/operator/index.rst @@ -29,5 +29,4 @@ determine what actually executes when your DAG runs. .. toctree:: :maxdepth: 2 - file external_task_sensor diff --git a/docs/apache-airflow/operators-and-hooks-ref.rst b/docs/apache-airflow/operators-and-hooks-ref.rst index ae131fb8d268f..f9efbfd2b52f6 100644 --- a/docs/apache-airflow/operators-and-hooks-ref.rst +++ b/docs/apache-airflow/operators-and-hooks-ref.rst @@ -79,9 +79,6 @@ For details see: :doc:`apache-airflow-providers:operators-and-hooks-ref/index`. * - :mod:`airflow.sensors.external_task` - :doc:`How to use ` - * - :mod:`airflow.sensors.filesystem` - - :ref:`How to use ` - **Hooks:** diff --git a/docs/apache-airflow/tutorial/taskflow.rst b/docs/apache-airflow/tutorial/taskflow.rst index 72b5ac82dd049..0b6bf77316fb2 100644 --- a/docs/apache-airflow/tutorial/taskflow.rst +++ b/docs/apache-airflow/tutorial/taskflow.rst @@ -438,7 +438,7 @@ Adding dependencies between decorated and traditional tasks ----------------------------------------------------------- The above tutorial shows how to create dependencies between TaskFlow functions. However, dependencies can also be set between traditional tasks (such as :class:`~airflow.providers.standard.operators.bash.BashOperator` -or :class:`~airflow.sensors.filesystem.FileSensor`) and TaskFlow functions. +or :class:`~airflow.providers.standard.sensors.filesystem.FileSensor`) and TaskFlow functions. Building this dependency is shown in the code below: diff --git a/providers/src/airflow/providers/standard/provider.yaml b/providers/src/airflow/providers/standard/provider.yaml index ba1a53e44bf8e..b7adb34455c22 100644 --- a/providers/src/airflow/providers/standard/provider.yaml +++ b/providers/src/airflow/providers/standard/provider.yaml @@ -58,6 +58,7 @@ sensors: - airflow.providers.standard.sensors.weekday - airflow.providers.standard.sensors.bash - airflow.providers.standard.sensors.python + - airflow.providers.standard.sensors.filesystem hooks: - integration-name: Standard python-modules: diff --git a/airflow/sensors/filesystem.py b/providers/src/airflow/providers/standard/sensors/filesystem.py similarity index 100% rename from airflow/sensors/filesystem.py rename to providers/src/airflow/providers/standard/sensors/filesystem.py diff --git a/tests/cli/commands/test_task_command.py b/tests/cli/commands/test_task_command.py index 1ba711ca4b22d..ca8cadd9368bf 100644 --- a/tests/cli/commands/test_task_command.py +++ b/tests/cli/commands/test_task_command.py @@ -411,7 +411,7 @@ def test_cli_test_with_env_vars(self): @mock.patch("airflow.triggers.file.os.path.getmtime", return_value=0) @mock.patch("airflow.triggers.file.glob", return_value=["/tmp/test"]) @mock.patch("airflow.triggers.file.os.path.isfile", return_value=True) - @mock.patch("airflow.sensors.filesystem.FileSensor.poke", return_value=False) + @mock.patch("airflow.providers.standard.sensors.filesystem.FileSensor.poke", return_value=False) def test_cli_test_with_deferrable_operator( self, mock_pock, mock_is_file, mock_glob, mock_getmtime, caplog ): diff --git a/tests/sensors/test_filesystem.py b/tests/sensors/test_filesystem.py index 641f2f218f2db..0774b56c31cd8 100644 --- a/tests/sensors/test_filesystem.py +++ b/tests/sensors/test_filesystem.py @@ -26,7 +26,7 @@ from airflow.exceptions import AirflowSensorTimeout, TaskDeferred from airflow.models.dag import DAG -from airflow.sensors.filesystem import FileSensor +from airflow.providers.standard.sensors.filesystem import FileSensor from airflow.triggers.file import FileTrigger from airflow.utils.timezone import datetime