Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the Cosmos application code structure #303

Closed
tatiana opened this issue Jun 1, 2023 · 0 comments · Fixed by #339
Closed

Refactor the Cosmos application code structure #303

tatiana opened this issue Jun 1, 2023 · 0 comments · Fixed by #339
Assignees
Milestone

Comments

@tatiana
Copy link
Collaborator

tatiana commented Jun 1, 2023

Cosmos was originally implemented thinking about surfacing many different tools, not only DBT. Since then, the scope of the project changed.

Given this, we're looking into refactoring the directory structure to make it easier to maintain. This proposal assumes the tests were already moved to their own directory (#302 ).

Current directory structure:

cosmos
├── __init__.py
├── conftest.py
├── core
│   ├── __init__.py
│   ├── airflow.py
│   ├── graph
│   │   ├── __init__.py
│   │   └── entities.py
│   └── tests
│       └── test_airflow.py
├── providers
│   ├── __init__.py
│   └── dbt
│       ├── __init__.py
│       ├── community
│       │   ├── __init__.py
│       │   └── profiles
│       │       ├── __init__.py
│       │       ├── exasol.py
│       │       ├── spark.py
│       │       └── trino.py
│       ├── constants.py
│       ├── core
│       │   ├── __init__.py
│       │   ├── operators
│       │   │   ├── __init__.py
│       │   │   ├── base.py
│       │   │   ├── docker.py
│       │   │   ├── kubernetes.py
│       │   │   ├── lazy_load.py
│       │   │   ├── local.py
│       │   │   └── tests
│       │   │       ├── test_docker.py
│       │   │       ├── test_kubernetes.py
│       │   │       └── test_local.py
│       │   ├── profiles
│       │   │   ├── __init__.py
│       │   │   ├── bigquery.py
│       │   │   ├── databricks.py
│       │   │   ├── postgres.py
│       │   │   ├── redshift.py
│       │   │   ├── snowflake.py
│       │   │   └── tests
│       │   │       └── test_profiles.py
│       │   └── utils
│       │       ├── __init__.py
│       │       ├── adapted_subprocesshook.py
│       │       ├── data_aware_scheduling.py
│       │       ├── profiles_generator.py
│       │       ├── tests
│       │       │   ├── test_data_aware_scheduling.py
│       │       │   └── test_warn_parsing.py
│       │       └── warn_parsing.py
│       ├── dag.py
│       ├── dataset.py
│       ├── parser
│       │   ├── __init__.py
│       │   ├── project.py
│       │   └── tests
│       │       └── test_project.py
│       ├── render.py
│       ├── task_group.py
│       └── tests
│           ├── test_dataset.py
│           ├── test_export.py
│           └── test_render.py
└── tests
    ├── __init__.py
    ├── test-connections.yaml
    ├── test_example_dags.py
    ├── test_version.py
    └── utils.py
19 directories, 54 files

Proposed directory structure:

cosmos
├── __init__.py
├── dag.py
├── taskgroup.py
├── models.py
├── render.py
├── hooks
│   ├── __init__.py
│   └── subprocesshook.py
├── operators
│   ├── __init__.py
│   ├── base.py
│   ├── docker.py
│   ├── kubernetes.py
│   └── local.py
└── dbt
    ├── __init__.py
    ├── parser.py
    └── databases/
        ├── __init__.py
        ├── base
        │   ├── profile.py
        │   └── metadata.py
        ├── bigquery
        │   ├── profile.py
        │   └── metadata.py
        ├── databricks
        │   ├── profile.py
        │   └── metadata.py
        ├── postgres
        │   ├── profile.py
        │   └── metadata.py
        ├── redshift
        │   ├── profile.py
        │   └── metadata.py
        ├── snowflake
        │   ├── profile.py
        │   └── metadata.py
        ├── exasol
        │   ├── profile.py
        │   └── metadata.py
        ├── spark
        │   ├── profile.py
        │   └── metadata.py
        └── trino
            ├── profile.py
            └── metadata.py
@tatiana tatiana added this to the 1.0.0 milestone Jun 1, 2023
@tatiana tatiana self-assigned this Jun 1, 2023
tatiana added a commit that referenced this issue Jun 23, 2023
* Reduce the level of nested directories
* Remove utils directory
* No changes to the code application logic were made, which could make the code review very hard

Disclaimer: this is an intentional breaking change before the 1.0 release.
Closes: #303
tatiana added a commit that referenced this issue Jun 23, 2023
- Reduce the level of nested directories (remove `core` and
`.providers.dbt`)
- Remove the `utils` directory
- No changes to the code application logic were made, which could make
the code review very hard

Disclaimer: This is an intentional breaking change before the 1.0
release. Closes: #303.

Example of breaking changes:

Before:
```
from cosmos.providers.dbt.dag import DbtDag
from cosmos.providers.dbt.task_group import DbtTaskGroup
from cosmos.providers.dbt.core.operators.kubernetes import DbtRunKubernetesOperator
from cosmos.core.profiles.redshift import RedshiftUserPasswordProfileMapping
```

Now: 
```
from cosmos.dag import DbtDag
from cosmos.task_group import DbtTaskGroup
from cosmos.operators.kubernetes import DbtRunKubernetesOperator
from cosmos.profiles.redshift import RedshiftUserPasswordProfileMapping
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants