Lee-W opened a new pull request, #72762:
URL: https://github.com/apache/airflow/pull/72762

   The Pagefind search index builder 
(`devel-common/src/sphinx_exts/pagefind_search/builder.py`) only does `import 
anyio` and then calls `anyio.to_thread.run_sync(...)`. `anyio.to_thread` is a 
submodule, and `import anyio` alone does not guarantee it's attached to the 
`anyio` package namespace — whether it works has always depended on some other 
dependency importing `anyio.to_thread` first as a side effect.
   
   A dependency bump anywhere in the workspace that changes what gets imported 
alongside anyio (observed going from anyio 4.14.2 -> 4.15.0, pulled in 
transitively by an unrelated `pydantic-ai-slim` version bump) removes that 
incidental side effect and breaks the docs build with:
   
   ```
   AttributeError: module 'anyio' has no attribute 'to_thread'
   sphinx.errors.ExtensionError: Handler <function build_index_finished ...> 
for event 'build-finished' threw an exception
   ```
   
   Reproduced and confirmed the fix in isolation:
   
   ```
   $ uv run --with anyio==4.15.0 --no-project --isolated python -c "import 
anyio; anyio.to_thread"
   AttributeError: module 'anyio' has no attribute 'to_thread'
   
   $ uv run --with anyio==4.15.0 --no-project --isolated python -c "import 
anyio; import anyio.to_thread; anyio.to_thread.run_sync"
   <function run_sync at ...>
   ```
   
   Importing the submodule explicitly makes the docs build resilient to 
import-order changes elsewhere in the dependency graph.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Sonnet 5)
   
   Generated-by: Claude Code (Sonnet 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