-
Notifications
You must be signed in to change notification settings - Fork 287
QoL: Friendly drop command 🐕🦺 #2720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dlt-hub-docs canceled.
|
136a09f
to
35f98e1
Compare
35f98e1
to
a27187f
Compare
import dlt | ||
|
||
settings = run_context.active().settings_dir | ||
abs_main_dir = dlt.current.pipeline().state["_local"]["initial_cwd"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is good but we can make it way better. initial_cwd
is not 100% reliable and we have run_context
. I'd do the following: whenever pipeline step is completed in Pipeline
class we store run_context info into the local state (you have a method to set such state) ie.
{"last_run_context": "settings_dir": run_context.active().settings_dir, "local_dir": ... }
then here we can compare current settings dir and last run settings dir and show this warning if they are really different
best place place to do that is in extract/normalize/load/sync_destination just before function returns.
we do that here because we have a writable state at that point so we do not need to load/save it again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dlt.current.pipeline()
is not always available. if it is not - skip all the checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have two pipeline commands to read/write local state:
get_local_state_val
set_local_state_val
main_path = main_module_file_path() | ||
# check if entry point is from cli command | ||
if main_path and main_path.endswith("dlt"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should run this check in any case
@@ -348,6 +349,16 @@ def _display_pending_packages() -> Tuple[Sequence[str], Sequence[str]]: | |||
fmt.warning(warning) | |||
return | |||
|
|||
fmt.echo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mhmmm maybe we should show this thing only when setting dirs differ? so exactly the same condition we have in config exeception?
Description
This PR aims to make the drop cli command friendly with appropriate warnings.
DropCommand.__init__() got an unexpected keyword argument 'project'
.Related Issues