shahar1 opened a new pull request, #65659: URL: https://github.com/apache/airflow/pull/65659
`DataflowHook` imported `BeamHook`, `BeamRunnerType`, and `beam_options_to_args` at module level from `airflow.providers.apache.beam`. Since `apache-airflow-providers-apache-beam` is not a declared dependency of the google provider, this hard import causes a `ModuleNotFoundError` whenever the google provider is imported in an environment where beam is not installed. The issue was discovered during the provider release process (#65614), where the `check-provider-yaml-valid` pre-commit hook imports all modules registered in `provider.yaml` to verify class registrations. When beam was absent from the environment, the hook aborted with: ``` ModuleNotFoundError: No module named 'airflow.providers.apache.beam' ``` The fix moves the two beam imports to lazy form inside the methods that actually require them (`DataflowHook.__init__` and `DataflowHook._build_gcloud_command`), so importing the module has no dependency on beam being installed. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — GitHub Copilot (Claude Sonnet 4.6) Generated-by: GitHub Copilot (Claude Sonnet 4.6) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
