Skip to content

Conversation

@benpankow
Copy link
Member

Summary

Runs a pre-flight check before invoking an underlying dagster or dagster-components command which requires loading a Python entrypoint module for a project. If that module is not accessible, raises a clearly actionable error:

dg list defs
Could not locate module `my_project_no_sync.definitions` using Python executable /Users/ben/.pyenv/versions/dagster/bin/python.

You may need to run `pip install -e /Users/ben/repos/components_demo/my_project_no_sync`.

How I Tested These Changes

New unit tests.

Changelog

[dg] dg CLI tools now more clearly error when the target project is not installed to the Python venv.

@benpankow
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benpankow benpankow requested review from OwenKephart, alangenfeld, gibsondan and smackesey and removed request for OwenKephart April 22, 2025 23:57
)
module_name = str(project_context.code_location_target_module_name)

python_stmt = f'import importlib; import sys; sys.exit(1 if importlib.util.find_spec("{module_name}") is None else 0)'
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't feel great, a more robust option might be to move this to a really simple dagster-components CLI command.

@benpankow benpankow marked this pull request as draft April 23, 2025 00:21
@benpankow
Copy link
Member Author

throwing back into draft to rearchitect a bit

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