GitHub user potiuk edited a comment on the discussion: How should we import 
Task SDK items in core?

More info: Generally speaking - the whole refactoring of packages we do is to 
follow the same structure:

```
<DISTRIBUTION>
              | pyproject.toml
              | src
                   \ airflow
                            \ <AIRFLOW_SUB_PACKAGE>
              | tests
                     \ <TEST_NAMESPACE>
                       ....
 ```

And we want "src" and "tests" to be the PYTHONPATH roots.

For example for task sdk:

* DISTRIBUTION = task-sdk
* AIRFLOW_SUB_PACKAGE = sdk
* TEST_NAMESPACE = task_sdk

For providers (say google)

* DISTRIBUTIONR = providers/google
* AIRFLOW_SUB_PACKAGE = providers.google
* TEST_NAMESPACE: 
      * unit.google
      * system.google
      * integration.google


And the way how we should refer to it:
```python
from airflow.<AIRFLOW_SUB_PACKAGE> <- imports the "production code"
```

```python
from TEST_NAMESPACE <- imports tests code
```

Examples:

"production" code:

```python
from airflow.sdk import BaseOperatorLink
from airlfow.providers.google.hooks import BaseHook
```

"test code"

```python
from task_sdk import make_client, make_client_w_dry_run, make_client_w_responses
```

```python
from unit.google.cloud.utils.gcp_authenticator import (
    GCP_GCS_KEY,
    GCP_SECRET_MANAGER_KEY,
)
```

We might want to turn that into part of our contributing guide.


GitHub link: 
https://github.com/apache/airflow/discussions/47486#discussioncomment-12424508

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to