Implementation:Astronomer Astronomer cosmos Pyproject Configuration
| Knowledge Sources | |
|---|---|
| Domains | Build, Configuration |
| Last Updated | 2026-02-07 17:00 GMT |
Overview
Defines the build configuration, package metadata, dependency specifications, and Airflow provider entry points for the astronomer-cosmos Python package.
Description
The Pyproject_Configuration file (pyproject.toml) serves as the single source of truth for the astronomer-cosmos package's build system and distribution metadata. It uses the modern PEP 621 project metadata standard and configures the build backend (typically hatchling or setuptools) to produce distributable wheels and source archives.
The configuration declares the package's core dependencies, which include apache-airflow>=2.9.0, Jinja2>=3.0.0, pydantic>=1.10.0, and virtualenv. These represent the minimum requirements for running Cosmos in any execution mode. Beyond the core, the file defines multiple optional dependency groups that enable support for specific cloud providers (AWS, Azure, GCP), container runtimes (Docker, Kubernetes), and dbt database adapters (BigQuery, Snowflake, Postgres, Redshift, Databricks, and others).
A critical aspect of the configuration is the entry point declarations. Cosmos registers itself as an Apache Airflow provider through the apache_airflow_provider entry point, exposes custom Airflow policies through the airflow.policy entry point, and registers UI plugins through the airflow.plugins entry point. These entry points allow Airflow to automatically discover and integrate Cosmos when the package is installed.
Usage
This file is consumed by Python build tools (pip, hatch, setuptools) when installing or packaging astronomer-cosmos. Developers modify it to add new dependencies, update version constraints, register new entry points, or configure optional dependency groups. CI/CD pipelines reference it to build release artifacts and to determine which optional dependencies to install for testing different execution backends.
Code Reference
Source Location
- Repository: Astronomer_Astronomer_cosmos
- File: pyproject.toml
Signature
Project metadata and core dependencies:
[project]
name = "astronomer-cosmos"
requires-python = ">=3.9"
dependencies = [
"apache-airflow>=2.9.0",
"Jinja2>=3.0.0",
"pydantic>=1.10.0",
"virtualenv",
]
Entry points:
[project.entry-points.apache_airflow_provider]
provider_info = "cosmos:get_provider_info"
[project.entry-points."airflow.policy"]
cosmos = "cosmos.airflow.policy"
[project.entry-points."airflow.plugins"]
cosmos = "cosmos.plugin:CosmosPlugin"
Optional dependency groups (selection):
[project.optional-dependencies]
docker = [
"apache-airflow-providers-docker>=3.5.0",
]
kubernetes = [
"apache-airflow-providers-cncf-kubernetes>=7.0.0",
]
aws = [
"apache-airflow-providers-amazon>=8.0.0",
]
azure = [
"apache-airflow-providers-microsoft-azure>=6.0.0",
]
gcp = [
"apache-airflow-providers-google>=10.0.0",
]
dbt-bigquery = [
"dbt-bigquery",
]
dbt-snowflake = [
"dbt-snowflake",
]
dbt-postgres = [
"dbt-postgres",
]
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| [project] | TOML table | Yes | Core package metadata including name, version, description, Python version constraint, and dependencies. |
| [project.optional-dependencies] | TOML table | No | Named groups of extra dependencies that can be installed selectively (e.g., pip install astronomer-cosmos[aws,docker]).
|
| [project.entry-points.*] | TOML tables | Yes | Entry point registrations that allow Airflow to discover Cosmos as a provider, policy module, and plugin. |
| [build-system] | TOML table | Yes | Build backend specification (e.g., hatchling or setuptools) and its requirements. |
Outputs
| Name | Type | Description |
|---|---|---|
| Wheel / sdist | Distribution files | Installable Python package artifacts produced by the build backend. |
| Provider registration | Airflow integration | Automatic registration of Cosmos as an Airflow provider, policy, and plugin through entry points. |
| Dependency resolution | pip metadata | Resolved dependency tree used by pip to install compatible versions of all required packages. |
Usage Examples
Installing with core dependencies only:
# pip install astronomer-cosmos
# This installs apache-airflow>=2.9.0, Jinja2>=3.0.0, pydantic>=1.10.0, virtualenv
Installing with cloud provider extras:
# pip install "astronomer-cosmos[aws,docker]"
# This installs core deps plus apache-airflow-providers-amazon and apache-airflow-providers-docker
Installing with dbt adapter extras:
# pip install "astronomer-cosmos[dbt-bigquery,gcp]"
# This installs core deps plus dbt-bigquery and apache-airflow-providers-google