Skip to content

VS Code extension disable hook fail to initialise when use with other Kedro plugin #69

@noklam

Description

@noklam

Description

Split out from #51.

Part of settings.py:

from kedro_pandera.framework.config.resolvers import (  # noqa: E402
    resolve_dataframe_model,
    resolve_interpolated_yaml_schema,
    resolve_yaml_schema,
)

CONFIG_LOADER_ARGS = {
    "base_env": "base",
    "default_run_env": "local",
    "custom_resolvers": {
        # For vscode-kedro extension to work we need to import kedro_pandera resolvers manually
        "pa.dict": resolve_yaml_schema,
        "pa.yaml": resolve_interpolated_yaml_schema,
        "pa.python": resolve_dataframe_model,
    },
}

which is basically this - https://github.com/Galileo-Galilei/kedro-pandera/blob/4fa5ca3c8bbb31f2fcbed00e3dbcd03594ff4a01/kedro_pandera/framework/hooks/pandera_hook.py#L46

The error is thrown during initialization of the extension

Context

The reason for this to happen is because VS Code extension disable all the hooks. The failure is because the kedro-pandera resolver is registered via hook (and is now missing), thus the initialisation step fails when we try to get catalog config.

An example can be found here:

example_iris_data:
  type: pandas.CSVDataset
  filepath: data/01_raw/iris.csv
  metadata:
    pandera:
      schema: ${pa.yaml:_example_iris_data_schema}

Steps to Reproduce

Checklist

  • Have you read the "Requirements" section already?
  • Have you make sure you are running the extension with the correct virtual environment? Cmd + P and Python: Select Interpeter

Expected Result

Actual Result

-- If you received an error, place it here.
-- Separate them if you have more than one.

Your Environment

  • Kedro version used (pip show kedro or kedro -V):
  • Kedro VSCode version used
  • Python version used (python -V):
  • Operating system and version:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions