Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cosmos/operators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@

import yaml
from airflow.utils.context import Context, context_merge
from airflow.utils.operator_helpers import context_to_airflow_vars

try:
from airflow.utils.operator_helpers import context_to_airflow_vars
except ImportError: # pragma: no cover
from airflow.sdk.execution_time.context import context_to_airflow_vars # type: ignore

from airflow.utils.strings import to_boolean

from cosmos.dbt.executable import get_system_dbt
Expand Down
4 changes: 2 additions & 2 deletions scripts/airflow3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sh scripts/airflow3/setup.sh
Activate the virtual env created in previous step and run airflow

```commandline
source "$(pwd)/scripts/airflow3/venv/bin/activate"
source "$(pwd)/scripts/airflow3/venv-af3/bin/activate"

airflow standalone
```
Expand All @@ -67,7 +67,7 @@ Once Airflow is running, you can also run tests.
```commandline
source scripts/airflow3/env.sh

source "$(pwd)/scripts/airflow3/venv/bin/activate"
source "$(pwd)/scripts/airflow3/venv-af3/bin/activate"

sh scripts/airflow3/tests.sh
```
Expand Down
3 changes: 2 additions & 1 deletion scripts/airflow3/env.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

set -e
set -x

PYTHONPATH="$PWD"
export PYTHONPATH
AIRFLOW_HOME="$PWD/scripts/airflow3"
export AIRFLOW_HOME
export AIRFLOW__LOGGING__BASE_LOG_FOLDER="$AIRFLOW_HOME/logs"
Expand Down
12 changes: 5 additions & 7 deletions scripts/airflow3/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
--find-links https://dist.apache.org/repos/dist/dev/airflow/3.0.0b2/
apache-airflow==3.0.0b2
apache-airflow-task-sdk==1.0.0b2
apache-airflow-providers-standard==1.0.0b2
apache-airflow-providers-fab==2.0.0b2
apache-airflow-providers-celery==3.11.0b2
Comment thread
pankajastro marked this conversation as resolved.
apache-airflow-providers-cncf-kubernetes==10.4.0b2
apache-airflow
apache-airflow-task-sdk
apache-airflow-providers-standard
apache-airflow-providers-fab
Comment thread
pankajastro marked this conversation as resolved.
psycopg2
asyncpg
dbt-postgres
19 changes: 5 additions & 14 deletions scripts/airflow3/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,17 @@
set -e

# Create a UV virtual environment named 'env' (you can change this as needed)
echo "Creating UV virtual environment at $(pwd)/tools"
uv venv venv --directory "$(pwd)/scripts/airflow3"
echo "Creating virtual environment at $(pwd)/tools"
python3 -m venv "$(pwd)/scripts/airflow3/venv-af3"

# Activate the virtual environment
echo "Activating virtual environment..."
source "$(pwd)/scripts/airflow3/venv/bin/activate"
source "$(pwd)/scripts/airflow3/venv-af3/bin/activate"

# Install dependencies in the virtual environment
echo "Installing dependencies..."
uv pip install -r "$(pwd)/scripts/airflow3/requirements.txt"
pip3 install --pre -r "$(pwd)/scripts/airflow3/requirements.txt"
Comment thread
pankajastro marked this conversation as resolved.

# Install Cosmos
uv pip install build
rm -rf "$(pwd)/dist/"
python3 -m build
for wheel in "$(pwd)"/dist/*.whl; do
uv pip install "$wheel"
done

uv pip install dbt-core
uv pip install dbt-postgres
pip3 install ".[test]"

echo "UV virtual environment setup and dependencies installed successfully!"