Skip to content
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

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

Open
2 tasks
Tracked by #58
noklam opened this issue Aug 16, 2024 · 1 comment
Open
2 tasks
Tracked by #58
Labels
bug Something isn't working

Comments

@noklam
Copy link
Contributor

noklam commented Aug 16, 2024

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:
@Calychas
Copy link

Answering #51 (comment):

Just need the import error to go away ;). Any highlighting and Go to definition of a schema would be a major + though

@noklam noklam added the bug Something isn't working label Sep 23, 2024
@noklam noklam moved this to Todo in Kedro VS Code Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants