Skip to content

Commit 72af356

Browse files
committed
Merge branch 'devel' into feat/explains-partition-and-split-loading
2 parents a85d683 + 5236e15 commit 72af356

File tree

111 files changed

+18988
-17241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+18988
-17241
lines changed

.github/workflows/lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
activate-environment: true
3939
enable-cache: true
4040

41+
- name: Check lockfile
42+
run: uv lock --check
43+
4144
- name: Install dependencies
4245
run: uv sync --all-extras --group airflow --group providers --group pipeline --group sources --group sentry-sdk --group dbt --group streamlit
4346

.github/workflows/test_docs_snippets.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,5 @@ jobs:
8787
- name: Test notebooks
8888
run: cd docs/notebooks && make test
8989

90-
90+
- name: Lint education notebooks
91+
run: make lint-notebooks

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ When you're ready to contribute, follow these steps:
4949
3. Write your code and tests.
5050
4. Lint your code by running `make lint` and test common modules with `make test-common`.
5151
5. If you're working on destination code, contact us to get access to test destinations.
52-
6. Create a pull request targeting the **devel** branch of the main repository.
52+
6. If you have added, removed or updated dependencies in the `pyproject.toml`, make sure `uv.lock` is up to date by running `uv lock`. If you are merging in upstream changes from the devel branch and get a conflict on the lockfile, it's best to take the devel version and re-run `uv lock` to re-apply your changes.
53+
7. Create a pull request targeting the **devel** branch of the main repository.
5354

5455
**Note:** for some special cases, you'd need to contact us to create a branch in this repository (not fork). See below.
5556

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ lint:
6464

6565
format:
6666
uv run black dlt docs tests --extend-exclude='.*syntax_error.py|_storage/.*'
67+
uv run black docs/education --ipynb --extend-exclude='.*syntax_error.py|_storage/.*'
6768

6869
lint-snippets:
6970
cd docs/tools && uv run python check_embedded_snippets.py full
@@ -91,6 +92,13 @@ lint-security:
9192
# go for ll by cleaning up eval and SQL warnings.
9293
uv run bandit -r dlt/ -n 3 -lll
9394

95+
lint-notebooks:
96+
uv run nbqa flake8 docs/education --extend-ignore=D,F704 --max-line-length=200
97+
uv run nbqa mypy docs/education \
98+
--ignore-missing-imports \
99+
--disable-error-code=no-redef \
100+
--disable-error-code=top-level-await
101+
94102
# check docstrings for all important public classes and functions
95103
lint-docstrings:
96104
uv run flake8 --count \
@@ -162,11 +170,18 @@ update-cli-docs:
162170
check-cli-docs:
163171
uv run dlt --debug render-docs docs/website/docs/reference/command-line-interface.md --compare
164172

173+
# Commands for running dashboard e2e tests
174+
# To run these tests locally, run `make start-dlt-dashboard-e2e` in one terminal and `make test-e2e-dashboard-headed` in another terminal
175+
165176
test-e2e-dashboard:
166177
uv run pytest --browser chromium tests/e2e
167178

168179
test-e2e-dashboard-headed:
169180
uv run pytest --headed --browser chromium tests/e2e
170181

171182
start-dlt-dashboard-e2e:
172-
uv run marimo run --headless dlt/helpers/dashboard/dlt_dashboard.py -- -- --pipelines-dir _storage/.dlt/pipelines --with_test_identifiers true
183+
uv run marimo run --headless dlt/helpers/dashboard/dlt_dashboard.py -- -- --pipelines-dir _storage/.dlt/pipelines --with_test_identifiers true
184+
185+
# creates the dashboard test pipelines globally for manual testingn of the dashboard app and cli
186+
create-test-pipelines:
187+
uv run python tests/helpers/dashboard/example_pipelines.py

dlt/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from dlt import sources
3030
from dlt.extract.decorators import source, resource, transformer, defer
3131
from dlt.destinations.decorators import destination
32-
from dlt.common.destination.dataset import SupportsDataset, SupportsRelation
3332
from dlt.dataset import dataset, Relation, Dataset
3433

3534
from dlt.pipeline import (
@@ -80,8 +79,6 @@
8079
"TCredentials",
8180
"sources",
8281
"destinations",
83-
"SupportsDataset",
84-
"SupportsRelation",
8582
"dataset",
8683
"Relation",
8784
"Dataset",

dlt/cli/pipeline_command.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def pipeline_command(
3737
verbosity: int,
3838
dataset_name: str = None,
3939
destination: TDestinationReferenceArg = None,
40-
hot_reload: Optional[bool] = False,
4140
**command_kwargs: Any,
4241
) -> None:
4342
if operation == "list":
@@ -54,12 +53,15 @@ def pipeline_command(
5453

5554
# we may open the dashboard for a pipeline without checking if it exists
5655
if operation == "show" and not command_kwargs.get("streamlit"):
56+
# TODO: why this is imported here
5757
from dlt.common.utils import custom_environ
5858
from dlt.common.known_env import DLT_DATA_DIR
5959

6060
from dlt.helpers.dashboard.runner import run_dashboard
6161

6262
run_dashboard(pipeline_name, edit=command_kwargs.get("edit"), pipelines_dir=pipelines_dir)
63+
# return so streamlit does not run
64+
return
6365

6466
try:
6567
if verbosity > 0:
@@ -127,21 +129,16 @@ def _display_pending_packages() -> Tuple[Sequence[str], Sequence[str]]:
127129

128130
if operation == "show":
129131
from dlt.common.runtime import signals
130-
from dlt.helpers.streamlit_app import index
131132

132133
with signals.delayed_signals():
133134
streamlit_cmd = [
134135
"streamlit",
135136
"run",
136-
index.__file__,
137+
os.path.join(os.path.dirname(dlt.__file__), "helpers", "streamlit_app", "index.py"),
137138
"--client.showSidebarNavigation",
138139
"false",
139140
]
140141

141-
if hot_reload:
142-
streamlit_cmd.append("--server.runOnSave")
143-
streamlit_cmd.append("true")
144-
145142
streamlit_cmd.append("--")
146143
streamlit_cmd.append(pipeline_name)
147144
streamlit_cmd.append("--pipelines-dir")

dlt/cli/plugins.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ def configure_parser(self, pipe_cmd: argparse.ArgumentParser) -> None:
162162
action="store_true",
163163
help="List local pipelines",
164164
)
165-
pipe_cmd.add_argument(
166-
"--hot-reload",
167-
default=False,
168-
action="store_true",
169-
help="Reload streamlit app (for core development)",
170-
)
171165
pipe_cmd.add_argument("pipeline_name", nargs="?", help="Pipeline name")
172166
pipe_cmd.add_argument("--pipelines-dir", help="Pipelines working directory", default=None)
173167
pipe_cmd.add_argument(

dlt/common/data_types/type_helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
ensure_pendulum_date,
1919
ensure_pendulum_time,
2020
)
21-
from dlt.common.utils import map_nested_in_place, str2bool
21+
from dlt.common.utils import map_nested_values_in_place, str2bool
2222

2323

2424
def _py_type_to_sc_type(t: Type[Any]) -> TDataType:
@@ -75,7 +75,7 @@ def _py_type_to_sc_type(t: Type[Any]) -> TDataType:
7575

7676

7777
def json_to_str(value: Any) -> str:
78-
return json.dumps(map_nested_in_place(custom_pua_remove, value))
78+
return json.dumps(map_nested_values_in_place(custom_pua_remove, value))
7979

8080

8181
def coerce_from_date_types(
@@ -101,7 +101,7 @@ def coerce_value(to_type: TDataType, from_type: TDataType, value: Any) -> Any:
101101
if to_type == from_type:
102102
if to_type == "json":
103103
# nested types need custom encoding to be removed
104-
return map_nested_in_place(custom_pua_remove, value)
104+
return map_nested_values_in_place(custom_pua_remove, value)
105105
# Make sure we use enum value instead of the object itself
106106
# This check is faster than `isinstance(value, Enum)` for non-enum types
107107
if hasattr(value, "value"):

dlt/common/data_writers/writers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def write_header(self, columns_schema: TTableSchemaColumns) -> None:
188188
def write_data(self, items: Sequence[TDataItem]) -> None:
189189
super().write_data(items)
190190
for item in items:
191-
dialect = item.query_dialect()
191+
dialect = item.query_dialect
192192
query = item.to_sql()
193193
self._f.write("dialect: " + (dialect or "") + "\n" + query + "\n")
194194

dlt/common/destination/capabilities.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ def ensure_supported_type(
129129
)
130130

131131

132+
TCasefoldIdentifier = Callable[[str], str]
133+
134+
132135
@configspec
133136
class DestinationCapabilitiesContext(ContainerInjectableContext):
134137
"""Injectable destination capabilities required for many Pipeline stages ie. normalize"""
@@ -152,7 +155,7 @@ class DestinationCapabilitiesContext(ContainerInjectableContext):
152155
"Escapes table name, column name and other identifiers"
153156
escape_literal: Callable[[Any], Any] = None
154157
"Escapes string literal"
155-
casefold_identifier: Callable[[str], str] = str
158+
casefold_identifier: TCasefoldIdentifier = str
156159
"""Casing function applied by destination to represent case insensitive identifiers."""
157160
has_case_sensitive_identifiers: bool = None
158161
"""Tells if destination supports case sensitive identifiers"""

0 commit comments

Comments
 (0)