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

   ## Why
   
   Airflow finds installed providers and plugins through Python entry points. 
`entry_points_with_dist()` reads the entry points of all installed packages. It 
runs on every `import airflow`, because the Airflow config reads the options 
that each provider adds.
   
   Python finds an installed package once for each `sys.path` entry that holds 
it. On RHEL/Fedora, a venv puts both `lib64/` and `lib/` on `sys.path`, and 
both can hold the same package. Airflow then found the same plugin twice and 
reported it as already registered (#74502).
   
   #74531 fixed this. It keeps only the first package with a given name. To get 
the name, it reads `dist.metadata`. This parses the full `METADATA` file of 
every installed package, including many that are not providers or plugins.
   
   With 824 installed packages, the function took 14.7ms before #74531. On main 
it takes 103.6ms.
   
   ## What
   
   This PR gets the name from `dist._normalized_name`. Python's own 
`importlib.metadata.entry_points()` has the same duplicate problem and uses 
this name to fix it. The name comes from the `.dist-info` directory name, for 
example `apache_airflow_providers_amazon-9.40.0.dist-info`. It does not open 
any file.
   
   With this PR, the function takes 18.7ms with the same 824 distributions. 
`_normalized_name` is private, but Python 3.10 to 3.14 and 
`importlib_metadata>=6.5` all have it.
   
   related: #74531
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (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