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

Add svg logo resource for ipython #1851

Merged
merged 8 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ include requirements.txt
include test_requirements.txt
include kedro/framework/project/default_logging.yml
include kedro/ipython/*.png
include kedro/ipython/*.svg
recursive-include templates *
3 changes: 2 additions & 1 deletion kedro/framework/cli/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _create_kernel(kernel_name: str, display_name: str) -> None:
on the CLI: https://ipython.readthedocs.io/en/stable/install/kernel_install.html.

On linux this creates a directory ~/.local/share/jupyter/kernels/{kernel_name}
containing kernel.json, logo-32x32.png and logo-64x64.png. An example kernel.json
containing kernel.json, logo-32x32.png, logo-64x64.png and logo-svg.svg. An example kernel.json
looks as follows:

{
Expand Down Expand Up @@ -159,6 +159,7 @@ def _create_kernel(kernel_name: str, display_name: str) -> None:
kedro_ipython_dir = Path(__file__).parents[2] / "ipython"
shutil.copy(kedro_ipython_dir / "logo-32x32.png", kernel_path)
shutil.copy(kedro_ipython_dir / "logo-64x64.png", kernel_path)
shutil.copy(kedro_ipython_dir / "logo-svg.svg", kernel_path)
except Exception as exc:
raise KedroCliError(
f"Cannot setup kedro kernel for Jupyter.\nError: {exc}"
Expand Down
19 changes: 19 additions & 0 deletions kedro/ipython/logo-svg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion tests/framework/cli/test_jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ def test_create_new_kernel(self):
assert kernel_spec.language == "python"
assert kernel_spec.argv[-2:] == ["--ext", "kedro.ipython"]
kernel_files = {file.name for file in Path(kernel_spec.resource_dir).iterdir()}
assert kernel_files == {"logo-32x32.png", "logo-64x64.png", "kernel.json"}
assert kernel_files == {
"kernel.json",
"logo-32x32.png",
"logo-64x64.png",
"logo-svg.svg",
}

def test_kernel_install_replaces(self):
_create_kernel("my_kernel_name", "My display name 1")
Expand Down