-
Notifications
You must be signed in to change notification settings - Fork 174
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
Super fast snippet linting & type checking #2019
Conversation
✅ Deploy Preview for dlt-hub-docs canceled.
|
566b1e7
to
15f232f
Compare
@@ -90,7 +90,7 @@ The destination decorator supports settings and secrets variables. If you, for e | |||
|
|||
```py | |||
@dlt.destination(batch_size=10, loader_file_format="jsonl", name="my_destination") | |||
def my_destination(items: TDataItems, table: TTableSchema, api_key: dlt.secrets.value) -> None: | |||
def my_destination(items: TDataItems, table: TTableSchema, api_key: str = dlt.secrets.value) -> None: |
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.
nice!
@@ -200,7 +202,7 @@ If you wish to create your own pipelines, you can leverage source and resource m | |||
base_id = "Please set me up!" # The ID of the base. | |||
|
|||
airtables = airtable_source(base_id=base_id) | |||
load_info = pipeline.run(load_data, write_disposition="replace") | |||
load_info = pipeline.run(airtables, write_disposition="replace") |
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.
👍
@@ -236,7 +236,7 @@ To create your data pipeline using single loading and [incremental data loading] | |||
1. To load data from a specific date, including dependent endpoints: | |||
|
|||
```py | |||
load_data = workable_source(start_date=datetime(2022, 1, 1), load_details=True) | |||
load_data = workable_source(start_date=DateTime(2022, 1, 1), load_details=True) |
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.
Here, the type is correct, but now it's not clear where DateTime
is coming from. Maybe it'd be better to explicitly use pendulum.DateTime
?
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.
Awesome work! I didn't know we have so many bugs in the examples.
Please check my comment regarding pendulum.DateTime
–could be a potential readability improvement.
8cc075a
to
b84e50c
Compare
Description
Lints and typechecks all docs snippets in one go. For this all snippets of each docs page are rendered into one python file and all those files have the same structure as the docs pages. Then the lint and typechecking commands are run on that full folder tree in one command each.
There is one benefit to this that I thought of when writing the dataset docs: For snippets on one docs page that relate to each other (which is a good way of writing pages anyway imho) we can typecheck across them and also make sure that variables stay the same type across one docs page. I think this will need a bit of more work from me though.
ToDo: