VishakBaddur opened a new pull request, #77567:
URL: https://github.com/apache/airflow/pull/77567

   pathspec 1.0 deprecates `GitWildMatchPattern`. `_GlobIgnoreRule` used it for 
every glob `.airflowignore` pattern (the default `ignore_file_syntax`), so each 
pattern emitted two warnings on every Dag folder scan:
   
   ```
   DeprecationWarning: GitWildMatchPattern ('gitwildmatch') is deprecated. Use 
'gitignore' for GitIgnoreBasicPattern or GitIgnoreSpecPattern instead.
   ```
   
   In pathspec 1.x, `GitWildMatchPattern` is a subclass of 
`GitIgnoreSpecPattern` that only overrides `__init__` and `pattern_to_regex` to 
warn and call `super()`. This uses `GitIgnoreSpecPattern` directly, which 
pathspec's upgrade guide describes as the unchanged implementation, so matching 
behavior is identical. `GitIgnoreBasicPattern` was not used because it changes 
matching semantics.
   
   On pathspec < 1.0, where `GitIgnoreSpecPattern` doesn't exist, it falls back 
to `GitWildMatchPattern`. The `pathspec` lower bound is unchanged (it was 
deliberately loosened in #33349).
   
   **Before**: with `-W error::DeprecationWarning`, 6 of the 9 tests in 
`shared/module_loading/tests/module_loading/test_file_discovery.py` fail (all 
glob-syntax cases, including the negation tests).
   
   **After**: all 10 pass (9 existing + 1 new). The new test fails without the 
fix.
   
   Also verified:
   - `find_path_from_directory` returns the same files before and after, with 
no warnings.
   - `airflow-core/tests/unit/utils/test_file.py` and 
`airflow-core/tests/unit/plugins/test_plugin_ignore.py` unchanged (20 and 2 
passed).
   - Same results with pathspec 0.10.1, 0.10.3, 0.11.0, 0.12.1 (fallback path) 
and 1.1.1.
   
   Note: while testing the fallback I found that pathspec 0.9.x, although 
allowed by `pathspec>=0.9.0`, already fails on `main` with `AttributeError: 
'GitWildMatchPattern' object has no attribute 'match_file'` for any glob 
`.airflowignore`. That's a separate lower-bound issue, so I'll raise it in its 
own PR.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude (Opus 5.5) 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]

Reply via email to