Show blueprint source path in blueprint list - #64
Merged
Conversation
Add a Location column to `blueprint list` so users can see which file each blueprint is defined in, rendered relative to the current working directory. The registry already tracked locations but stored them relative to an internal base dir, which is not meaningful at the CLI. Store the resolved absolute path instead and add `display_path()` to render paths relative to cwd (falling back to absolute when outside the tree). Duplicate/multiple DAG-args error messages now use the same cwd-relative rendering.
- Move display_path to a neutral blueprint/utils.py so the registry no longer owns a display concern and errors.py can reuse it without a cycle. - Render DuplicateBlueprintError / MultipleDagArgsError lazily in __str__, so locations are resolved relative to cwd at display time rather than at raise time (avoids stale hints if cwd changes between discovery and print). - Capture cwd once in 'blueprint list' and pass it as display_path(base=...). - Make the CLI location assertion OS-separator agnostic. - Add a docstring to _register_dag_args; split display_path tests into tests/test_utils.py and keep the absolute-location test in test_registry.
- tests/test_utils.py: build expected paths via Path() instead of POSIX literals, and ground the under-cwd test on a real file. - errors.py: pass raw constructor args to super().__init__ so repr() stays informative and the exceptions pickle correctly (round-trips reconstruct via __init__); __str__ still renders cwd-relative paths lazily. - utils.display_path: return falsy input unchanged instead of '.'. - MultipleDagArgsError: skip empty locations rather than rendering an empty bullet.
When 'blueprint list --template-dir DIR' is given, render each blueprint's Location relative to DIR (so paths read as 'blueprints.py' or 'etl/bp.py' rather than the full path from cwd). Falls back to cwd-relative when no template dir is supplied.
jeremybeard
marked this pull request as ready for review
June 22, 2026 18:04
Merged
jlaneve
added a commit
that referenced
this pull request
Jul 20, 2026
New since v0.3.0: .airflowignore support for DAG YAML discovery and blueprint lint (#67), build_all_airflow_dags rename for safe-mode discovery (#65), source paths in blueprint list (#64), and -h/-v shorthands (#63). Claude-Session: https://claude.ai/code/session_01J44AEQ8KTvUWxf6GnVRW66 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Location column to
blueprint listso users can immediately see which file each blueprint is defined in.--template-dir DIRis provided, the path is rendered relative toDIR.This addresses feedback that it was unclear where a given blueprint actually lives — the registry already tracked locations, but
blueprint listnever surfaced them.Example
Here the locations are shown relative to the supplied
--template-dir(soblueprints.pyrather thanexamples/advanced/dags/blueprints.py). The shown path is the location of the latest version (matching theClasscolumn).How
blueprint/utils.py::display_path(path, base=None)renders a path relative tobase(defaulting to the cwd), falling back to the absolute path when the file is not underbase(e.g. a sibling tree, or a different drive on Windows). Thelistcommand passes the resolved--template-dirasbasewhen one is given.DuplicateBlueprintError/MultipleDagArgsErrorrender their messages lazily in__str__, so locations are resolved relative to the cwd at display time rather than baked in when the error is raised. They pass their raw args tosuper().__init__()sorepr()stays informative and the exceptions remain picklable.Tests
tests/test_utils.py::TestDisplayPath—display_pathunder/outside the base, and the explicit-baseoverride.tests/test_registry.py::TestBlueprintLocations—list_blueprints()reports absolute locations.tests/test_cli.py::test_list_location_is_relative_to_template_dir— theLocationcolumn renders relative to--template-dir.All unit tests,
ruff, andtypass.