potiuk commented on PR #34018:
URL: https://github.com/apache/airflow/pull/34018#issuecomment-1715797349

   You have three options:
   
   1) You can also specify minimum version as requirement in provider.yaml. 
This is already done in a number of providers  - see here:
   
https://github.com/apache/airflow/blob/main/airflow/providers/apache/hive/provider.yaml#L62
   
   This is when the dependency is "crucial" for the package to work.
   
   2) The cross-provider deps are added automatically (we see which packages 
are imported from each provider).  You don't have to do anything., but then the 
extra will be added without min version
   
   3) For providers where the depdendcy is really "optional" (i.e. most 
functionality works but only some is needed) but you would like to specify min 
versio we have always the option to specify the addional-extras:
   
   
https://github.com/apache/airflow/blob/main/airflow/providers/amazon/provider.yaml#L702
   
   In this case amazon providers has 
`apache-airflow-providers-amazon[cncf.kubernetes]` extra and when you install 
the provider will that extra it will install 
`apache-airflow-providers-cncf-kubernetes>=7.2.0` 
   
   The last one is pretty "soft" - i.e. it only works when you use the extra 
directly - but it is a way to store and present the dependency on min-version 
and even automate it when you use extra. And this is the `best` we can do. 
`pip` does not have a way to specify the condition `if you install this 
package, the minimum required verson is this` . There is simply no such 
feature. You can either have a strict requirement that both installs and forces 
the min version or the extra when - if used, applies the soft limit during 
installation only. 
   
   Maybe some day it will be added, but currently there is no way to force min 
version for optional dependency.
   
   
   
   
   


-- 
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