-
Notifications
You must be signed in to change notification settings - Fork 229
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
synchronise pipeline protocol definitions and fix signature to use proper typing #2364
base: devel
Are you sure you want to change the base?
synchronise pipeline protocol definitions and fix signature to use proper typing #2364
Conversation
…rent implementation and fix type hints for optional fields
…tation and protocols in sync
✅ Deploy Preview for dlt-hub-docs canceled.
|
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 looks really good! we were considering using Unpack here and in many different places (ie. to represent resource hints). the problem was that support in code editors was really bad:
- you could not see arguments in Unpack, just kwargs
- docstrings for an argument are not automatically displayed
I just checked VSCODE and it looks like it works! What editor are you on @ubiquitousbyte ? we need to check pycharm, cursor (is it VSCODE based?) to make sure we are not breaking dev experience.
EDIT: vscode () does not display docstring for unpacked kwargs :/ ie.
pipeline.run([1, 2, 3], destination="bigquery")
I do not see docstrings when I hover over destination
. does it work for you?
…to use those as well
I wasn't getting the docstrings either. Adding them to I am using the Zed editor with EDIT: I do get doc strings for def __test(pipeline: "SupportsPipeline"):
return p.run(destination="bigquery") # <--- destination auto-completes with a docstring here I don't get doc strings for |
@rudolfix let me know if the insufficient auto-completion support for unpacked kwargs is a deal breaker for you. I'll revert back to the named arguments, but will still keep the |
@ubiquitousbyte let' me check your newest changes. I'd prefer to keep unpack OFC, thanks! |
Now I do not see any arguments at all... but there's still a chance. IMO if you convert for methods (that take see how methods above are used |
Description
Adds
Optional
to all arguments ofpipeline.run(...)
to makeNone
values acceptable by all type checkers.Related Issues
Additional Context
Extracts the
pipeline.run(...)
arguments into a typed dictionary and usesUnpack
to put them back inSupportsPipeline
,SupportsPipelineRun
andPipeline
. This way, the protocols and the implementation will always be in sync with each other.This also allows users of
dlt
to create custom wrappers aroundrun
with enhanced functionality. Here's an example of our customrun
wrapper:With the proposed changes here, we can refactor it into: