You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "TALBIYA-PARVEEN (via GitHub)" <gi...@apache.org> on 2026/04/01 11:54:35 UTC

[PR] Add environment context detection helper for Breeze AI workflows [airflow]

TALBIYA-PARVEEN opened a new pull request, #64572:
URL: https://github.com/apache/airflow/pull/64572

   Adds a utility helper for Breeze AI workflows to detect whether execution is happening on WSL host, local Linux host, or inside a Docker container.
   
   The helper returns:
   
   * `is_wsl`
   * `inside_container`
   * `docker_available`
   * `recommended_command`
   
   This improves host vs container command recommendations for AI-assisted Breeze workflows and helps novice contributors receive correct execution guidance.
   
   Also adds a unit test verifying host-side detection under WSL/Linux.
    
   <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull request.
   Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
   
   Please make sure that your code changes are covered with tests.
   And in case of new features or big changes remember to adjust the documentation.
   
   Feel free to ping (in general) for the review if you do not see reaction for a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   
   * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add environment context detection helper for Breeze AI workflows [airflow]

Posted by "Subham-KRLX (via GitHub)" <gi...@apache.org>.
Subham-KRLX commented on PR #64572:
URL: https://github.com/apache/airflow/pull/64572#issuecomment-4233498554

   @TALBIYA-PARVEEN This overlaps with breeze_context.py so I would suggest just updating that script and using our existing is_wsl2 helper instead of a new file make sure to move the test to the tests/ folder and run uv lock to fix the static check failure.
   
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add environment context detection helper for Breeze AI workflows [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #64572:
URL: https://github.com/apache/airflow/pull/64572#issuecomment-4383012945

   @TALBIYA-PARVEEN This draft PR has been inactive for 12 days since the last triage comment and no response from the author. Closing to keep the queue clean.
   
   You are welcome to reopen this PR when you resume work, or to open a new one addressing the issues previously raised. There is no rush — take your time.
   
   ---
   
   _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add environment context detection helper for Breeze AI workflows [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #64572:
URL: https://github.com/apache/airflow/pull/64572#issuecomment-4169552924

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (ruff, mypy and type annotations). Our [prek-hooks]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-prek-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/airflow-core/docs/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
   - Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add environment context detection helper for Breeze AI workflows [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #64572:
URL: https://github.com/apache/airflow/pull/64572#issuecomment-4300877622

   @TALBIYA-PARVEEN This draft PR has not had author activity for 19 days. Before anyone can review it, it needs to meet our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria). Here is a summary of what still needs work; once those items are addressed, mark the PR ready for review.
   
   **Issues found:**
   - :x: **Failing CI**: `Additional PROD image tests / Test e2e integration tests with PROD image / Regular e2e test`, `CI image checks / Static checks`. Please investigate and fix.
   - :x: **Unresolved review comments** (6 threads): please walk through each unresolved review thread. **Even if a suggestion looks incorrect or irrelevant** — and some of them will be, especially any comments left by automated reviewers like GitHub Copilot — it is still the author's responsibility to respond: apply the fix, reply in-thread with a brief explanation of why the suggestion does not apply, or resolve the thread if the feedback is no longer relevant. **Once you believe a thread is resolved — whether by pushing a fix or by explaining why the suggestion doesn't apply — please mark it as resolved yourself by clicking the 'Resolve conversation' button at the bottom of each thread.** Reviewers don't auto-close their own threads, so an addressed-but-unresolved thread reads as 'still waiting on the author' and keeps the PR from moving forward.
   
   **What to do next:**
   - Address the items above.
   - Make sure static checks pass locally: `prek run --from-ref main --stage pre-commit`.
   - Mark the PR as "Ready for review" when you are done.
   
   There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the [Airflow Slack](https://s.apache.org/airflow-slack).


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add environment context detection helper for Breeze AI workflows [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #64572:
URL: https://github.com/apache/airflow/pull/64572#issuecomment-4170922951

   @TALBIYA-PARVEEN This PR has a few issues that need to be addressed before it can be reviewed — please see our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria).
   
   **Issues found:**
   - :x: **Pre-commit / static checks**: Failing: CI image checks / Static checks. Run `prek run --from-ref main` locally to find and fix issues. See [Pre-commit / static checks docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst).
   
   **What to do next:**
   - The comment informs you what you need to do.
   - Fix each issue, then mark the PR as "Ready for review" in the GitHub UI - but only after making sure that all the issues are fixed.
   - There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates.
   - Maintainers will then proceed with a normal review.
   
   There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the [Airflow Slack](https://s.apache.org/airflow-slack).


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add environment context detection helper for Breeze AI workflows [airflow]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #64572:
URL: https://github.com/apache/airflow/pull/64572#discussion_r3025327239


##########
dev/breeze/src/airflow_breeze/utils/environment_context.py:
##########
@@ -0,0 +1,29 @@
+from __future__ import annotations
+
+import os
+from dataclasses import dataclass

Review Comment:
   This new module is missing the standard Apache ASF license header present in other Breeze utils (e.g., dev/breeze/src/airflow_breeze/utils/host_info_utils.py). Please add the license header at the top of this file to comply with repository conventions.



##########
dev/breeze/src/airflow_breeze/utils/environment_context.py:
##########
@@ -0,0 +1,29 @@
+from __future__ import annotations
+
+import os
+from dataclasses import dataclass
+
+
+@dataclass
+class EnvironmentContext:
+    is_wsl: bool
+    inside_container: bool
+    docker_available: bool
+    recommended_command: str
+
+
+def detect_environment_context() -> EnvironmentContext:
+    inside_container = os.path.exists("/.dockerenv")
+    is_wsl_env = "WSL_DISTRO_NAME" in os.environ
+
+    if inside_container:
+        recommended = "pytest"
+    else:
+        recommended = "breeze shell"
+
+    return EnvironmentContext(
+        is_wsl=is_wsl_env,
+        inside_container=inside_container,
+        docker_available=True,
+        recommended_command=recommended,

Review Comment:
   `docker_available` is currently hard-coded to `True`, so the helper will report Docker as available even when it is not installed/running (which also makes `recommended_command` unreliable on host). Please implement a real availability check (e.g., run `docker info`/`docker version` with `check=False` and return a boolean) or rename/remove this field if it is intentionally not detected here.



##########
dev/breeze/src/airflow_breeze/utils/test_environment_context.py:
##########
@@ -0,0 +1,6 @@
+from airflow_breeze.utils.environment_context import detect_environment_context
+
+
+def test_detect_host_environment():
+    context = detect_environment_context()
+    assert context.recommended_command in ["breeze shell", "pytest"]

Review Comment:
   This test module is located under `src/airflow_breeze/...`, but Breeze's pytest configuration only collects tests from `dev/breeze/tests` (`dev/breeze/pyproject.toml` sets `testpaths = ["tests"]`). As a result, this test will not run in the normal test suite. Please move it to `dev/breeze/tests/` (and keep `src/` limited to library code).



##########
dev/breeze/src/airflow_breeze/utils/test_environment_context.py:
##########
@@ -0,0 +1,6 @@
+from airflow_breeze.utils.environment_context import detect_environment_context
+

Review Comment:
   This file is missing the standard Apache ASF license header (present in other Breeze source files). Please add the header to comply with repository conventions.



##########
dev/breeze/src/airflow_breeze/utils/environment_context.py:
##########
@@ -0,0 +1,29 @@
+from __future__ import annotations
+
+import os
+from dataclasses import dataclass
+
+
+@dataclass
+class EnvironmentContext:
+    is_wsl: bool
+    inside_container: bool
+    docker_available: bool
+    recommended_command: str
+
+
+def detect_environment_context() -> EnvironmentContext:
+    inside_container = os.path.exists("/.dockerenv")
+    is_wsl_env = "WSL_DISTRO_NAME" in os.environ

Review Comment:
   WSL detection here relies only on the `WSL_DISTRO_NAME` environment variable. Breeze already has WSL detection logic based on `/proc/version` and kernel/release checks (e.g., `airflow_breeze.commands.developer_commands.is_wsl` and `airflow_breeze.utils.platforms.is_wsl2`). Please reuse/centralize that existing detection (or match its approach) so detection works consistently across entry points.
   ```suggestion
   def _detect_wsl() -> bool:
       """
       Detect whether we are running under Windows Subsystem for Linux (WSL).
   
       Prefer feature-based detection (via /proc and kernel release) and only
       use environment variables as an additional hint.
       """
       if "WSL_DISTRO_NAME" in os.environ:
           return True
   
       try:
           with open("/proc/version", encoding="utf-8") as version_file:
               version = version_file.read()
           if "Microsoft" in version or "WSL" in version:
               return True
       except OSError:
           # /proc may not be available or readable; ignore and continue.
           pass
   
       try:
           release = os.uname().release
       except (AttributeError, OSError):
           return False
   
       return "microsoft" in release.lower()
   
   
   def detect_environment_context() -> EnvironmentContext:
       inside_container = os.path.exists("/.dockerenv")
       is_wsl_env = _detect_wsl()
   ```



##########
dev/breeze/src/airflow_breeze/utils/test_environment_context.py:
##########
@@ -0,0 +1,6 @@
+from airflow_breeze.utils.environment_context import detect_environment_context
+
+
+def test_detect_host_environment():
+    context = detect_environment_context()
+    assert context.recommended_command in ["breeze shell", "pytest"]

Review Comment:
   As written, this assertion will always pass because `detect_environment_context()` always returns either "breeze shell" or "pytest" unconditionally. The test doesn't validate the WSL/container branching behavior. Please make the test deterministic by monkeypatching `os.path.exists` and `os.environ` to cover at least the host and container cases, and assert on the expected fields (`inside_container`, `is_wsl`, `recommended_command`, `docker_available`).



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add environment context detection helper for Breeze AI workflows [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed pull request #64572: Add environment context detection helper for Breeze AI workflows
URL: https://github.com/apache/airflow/pull/64572


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org