setting-up-astro-project について
Astro CLI を使った Airflow プロジェクト構築のスキルです。プロジェクトの初期化、依存関係と接続の設定、環境起動前の DAG 解析を扱います。
主な機能
- 01プロジェクト構成の初期化
- 02Python と OS パッケージの設定
- 03接続と変数の設定
- 04接続設定のエクスポートとインポート
- 05起動前の DAG 解析
活用シーン
- 01新しい Astro Airflow プロジェクトの開始
- 02プロジェクト依存関係の追加
- 03ローカル Airflow 接続の設定
- 04起動前の DAG 構文確認
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ necatiarslan/ airflow-vscode-extension --skill setting-up-astro-projectインストール後、Claude Code で/setting-up-astro-projectを入力して読み込まれたか確認します。
詳細
Astro プロジェクトのセットアップ
このスキルでは、Astro CLI を使用して Airflow プロジェクトを初期化および設定できます。
注:これらは外部 CLI の操作です。VS Code 拡張機能内でランタイムを調査するには、拡張機能のツールを使用してください。
新しいプロジェクトの初期化
astro dev init
次の構成が作成されます:
project/
├── dags/ # DAG files
├── include/ # SQL, configs, supporting files
├── plugins/ # Custom Airflow plugins
├── tests/ # Unit tests
├── Dockerfile # Image customization
├── packages.txt # OS-level packages
├── requirements.txt # Python packages
└── airflow_settings.yaml # Connections, variables, pools
依存関係の追加
Python パッケージ(requirements.txt)
apache-airflow-providers-snowflake==5.3.0
pandas==2.1.0
requests>=2.28.0
OS パッケージ(packages.txt)
gcc
libpq-dev
カスタム Dockerfile
FROM quay.io/astronomer/astro-runtime:12.4.0
RUN pip install --extra-index-url https://pypi.example.com/simple my-package
依存関係を変更した後は、astro dev restart を実行してください。
接続と変数の設定
airflow_settings.yaml
環境の起動時に自動的に読み込まれます:
airflow:
connections:
- conn_id: my_postgres
conn_type: postgres
host: host.docker.internal
port: 5432
login: user
password: pass
schema: mydb
variables:
- variable_name: env
variable_value: dev
pools:
- pool_name: limited_pool
pool_slot: 5
エクスポート/インポート
# Export from running environment
astro dev object export --connections --file connections.yaml
# Import to environment
astro dev object import --connections --file connections.yaml
実行前の検証
環境全体を起動せずに DAG を解析して、エラーを検出します:
astro dev parse
関連するスキル
- managing-astro-local-env
- authoring-dags
- testing-dags
コメント
Markdown 対応