Skip to content

Commit

Permalink
Merge branch 'main' into add-new-notebook-docs-and-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
stichbury authored Oct 5, 2023
2 parents c993700 + 91c4009 commit 4f317a1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions kedro/framework/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ def find_pipelines() -> dict[str, Pipeline]: # noqa: PLR0912
pipeline_name = pipeline_dir.name
if pipeline_name == "__pycache__":
continue
# Prevent imports of hidden directories/files
if pipeline_name.startswith("."):
continue

pipeline_module_name = f"{PACKAGE_NAME}.pipelines.{pipeline_name}"
try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def _collect_requirements(requires):
"SQLAlchemy~=1.2",
"tables~=3.6.0; platform_system == 'Windows' and python_version<'3.8'",
"tables~=3.8.0; platform_system == 'Windows' and python_version>='3.8'", # Import issues with python 3.8 with pytables pinning to 3.8.0 fixes this https://github.com/PyTables/PyTables/issues/933#issuecomment-1555917593
"tables~=3.6; platform_system != 'Windows'",
"tables~=3.6, <3.9.0; platform_system != 'Windows'",
"tensorflow~=2.0; platform_system != 'Darwin' or platform_machine != 'arm64'",
# https://developer.apple.com/metal/tensorflow-plugin/
"tensorflow-macos~=2.0; platform_system == 'Darwin' and platform_machine == 'arm64'",
Expand Down
31 changes: 31 additions & 0 deletions tests/framework/project/test_pipeline_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,37 @@ def test_find_pipelines_skips_modules_without_create_pipelines_function(
assert sum(pipelines.values()).outputs() == pipeline_names


@pytest.mark.parametrize(
"mock_package_name_with_pipelines,pipeline_names",
[(x, x) for x in [set(), {"my_pipeline"}]],
indirect=True,
)
def test_find_pipelines_skips_hidden_modules(
mock_package_name_with_pipelines, pipeline_names
):
pipelines_dir = Path(sys.path[0]) / mock_package_name_with_pipelines / "pipelines"
pipeline_dir = pipelines_dir / ".ipynb_checkpoints"
pipeline_dir.mkdir()
(pipeline_dir / "__init__.py").write_text(
textwrap.dedent(
"""
from __future__ import annotations
from kedro.pipeline import Pipeline, node, pipeline
def create_pipeline(**kwargs) -> Pipeline:
return pipeline([node(lambda: 1, None, "simple_pipeline")])
"""
)
)

configure_project(mock_package_name_with_pipelines)
pipelines = find_pipelines()
assert set(pipelines) == pipeline_names | {"__default__"}
assert sum(pipelines.values()).outputs() == pipeline_names


@pytest.mark.parametrize(
"mock_package_name_with_pipelines,pipeline_names",
[(x, x) for x in [set(), {"my_pipeline"}]],
Expand Down

0 comments on commit 4f317a1

Please sign in to comment.