Skip to content

Support installation via entry-points - #74

Open
BasPH wants to merge 4 commits into
astronomer:mainfrom
BasPH:entry-point-blueprint-discovery
Open

Support installation via entry-points#74
BasPH wants to merge 4 commits into
astronomer:mainfrom
BasPH:entry-point-blueprint-discovery

Conversation

@BasPH

@BasPH BasPH commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Make Blueprints installable via entry-points. Solves #69.

This will support installing Blueprints from Python packages. That means a single Python package can be distributed instead of having to copy-paste Blueprint code into every project that needs to leverage templates.

Publishing Blueprint templates in a shared package requires declaring an entry point under the
airflow_blueprint.blueprints group in your package's pyproject.toml:

# pyproject.toml
[project.entry-points."airflow_blueprint.blueprints"]
company_blueprints = "company_blueprints"

Manual tests

The PR contains unit tests, but also verified manually. I've included a small example package under examples/shared-blueprints. Example usage:

# Build Blueprint with this PR
uv build  # builds dist/airflow_blueprint-0.4.0-py3-none-any.whl

# Build example package
cd examples/shared-blueprints
uv build  # builds examples/shared-blueprints/dist/shared_blueprints-0.1.0-py3-none-any.whl

# Copy wheels to example astro dev project
cp dist/airflow_blueprint-0.4.0-py3-none-any.whl [my astro dev project]
cp examples/shared-blueprints/dist/shared_blueprints-0.1.0-py3-none-any.whl [my astro dev project]

Then package into Dockerfile:

FROM astrocrpublic.azurecr.io/runtime:3.2-5

COPY airflow_blueprint-0.4.0-py3-none-any.whl .
COPY shared_blueprints-0.1.0-py3-none-any.whl .
RUN pip install airflow_blueprint-0.4.0-py3-none-any.whl shared_blueprints-0.1.0-py3-none-any.whl

Then:

astro dev start
astro dev bash -s
blueprint list

# see the "example" blueprint:

                                                                      Available Blueprints
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name                  ┃ Versions ┃ Description                                     ┃ Class               ┃ Location                                          ┃
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ example               │ 1        │ Example Blueprint template from shared package. │ Example             │ shared_blueprints.example                         │
├───────────────────────┼──────────┼─────────────────────────────────────────────────┼─────────────────────┼───────────────────────────────────────────────────┤
│ hello_world_blueprint │ 1        │ No description                                  │ HelloWorldBlueprint │ dags/blueprint_templates/hello_world_blueprint.py │
└───────────────────────┴──────────┴─────────────────────────────────────────────────┴─────────────────────┴───────────────────────────────────────────────────┘

@BasPH
BasPH marked this pull request as draft July 27, 2026 11:04
@BasPH
BasPH marked this pull request as ready for review July 27, 2026 11:12
Comment thread blueprint/registry.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have more than a single module with shared blueprints? For example, can I have team_1_shared_blueprints.whl and team_2_shared_blueprints.whl?

@BasPH BasPH Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's perfectly fine. I verified this manually by building 2 wheels with different package names:

                                                                      Available Blueprints
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name                  ┃ Versions ┃ Description                                     ┃ Class               ┃ Location                                          ┃
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ example               │ 1        │ Example Blueprint template from shared package. │ Example             │ shared_blueprints.example                         │
├───────────────────────┼──────────┼─────────────────────────────────────────────────┼─────────────────────┼───────────────────────────────────────────────────┤
│ example2              │ 1        │ Example Blueprint template from shared package. │ Example2            │ shared_blueprints_2.example                       │
├───────────────────────┼──────────┼─────────────────────────────────────────────────┼─────────────────────┼───────────────────────────────────────────────────┤
│ hello_world_blueprint │ 1        │ No description                                  │ HelloWorldBlueprint │ dags/blueprint_templates/hello_world_blueprint.py │
└───────────────────────┴──────────┴─────────────────────────────────────────────────┴─────────────────────┴───────────────────────────────────────────────────┘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants