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

   
   ---
   
   When working on #51756 , we initially planned to exclude the Tableau 
provider for Python 3.9. After quite a bit of trial and error, we eventually 
got it working. While this is admittedly a niche case, it quickly became clear 
that adding some automation and documentation around version exclusions would 
be helpful.
   
   The first step to exclude a specific Python version for a provider, is to 
update **three locations**:
   
   - `provider/pyproject.toml` (in two different places)  
   - `provider/provider.yaml`  
   - `dev/breeze/global_constants.py`
   
   *Note*: There also is a [fourth 
place](https://github.com/apache/airflow/blob/main/dev/breeze/tests/test_selective_checks.py#L1240)
 in which the provider needs to be added, but this case is already covered by 
current tests. 
   
   In `pyproject.toml`, two notations are used for excluding versions:
   
   - `>=3.10`  
   - `~=3.9, !=3.9` ([example from Cloudant 
provider](https://github.com/apache/airflow/blob/a4a51a02db2994e4ea94b83887739dc79a4d11d9/providers/cloudant/pyproject.toml#L52))
   
   I have assumed the chance for `<=` exclusions is rather low and thus not 
considered it. 
   
   In `global_constants.py`, the matrix logic derives the provider name as 
follows:
   
   - For providers in a nested folder structure (e.g., `common/sql`), the name 
becomes `common.sql`.  
   - Otherwise, the name is taken directly from the folder (e.g., `amazon`).
   
    `>=3.10` or `~=3.9, !=3.9` are treated as *non*-exclusions, as 3.10 is the 
lowest supported version. To handle this distinction, a constant called 
`MIN_SUPPORTED_VERSION` is used. This also ensures that when adding a new 
provider and having set `requires-python = ">=3.10"` in the pyproject.toml the 
hook does not fail.
   
   Checks performed include:
   
   - Ensuring that the `classifiers` section in `pyproject.toml` does not list 
any excluded version from `requires-python`.  
   - Verifying that the excluded versions across all three files match, if any 
exclusion is declared.
   
   Example output from the validation:
   
   <img width="714" height="124" alt="Bildschirmfoto 2025-07-14 um 00 21 48" 
src="https://github.com/user-attachments/assets/37d4c674-6a4e-47cd-ad35-f418b52a60ed";
 />
   <img width="711" height="107" alt="Bildschirmfoto 2025-07-14 um 00 22 02" 
src="https://github.com/user-attachments/assets/5276c531-10d5-4c79-8a4c-6405fa9f9532";
 />
   
   I've tested the logic with various test cases, but I'm happy to hear any 
feedback or corrections.
   
   If this approach is deemed useful, I’d be keen to expand it further with 
additional guardrails (I have some ideas in mind) and documentation that 
clearly outlines the steps followed in the PR above. 


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