From 5b79fcfd90b9580d7a7b646d29bba6bdaf443be1 Mon Sep 17 00:00:00 2001 From: Simon Veitner Date: Mon, 24 Jun 2024 18:03:50 +0200 Subject: [PATCH] Add `say_hello`; update index --- hello_world_nbdev/_modidx.py | 3 ++- hello_world_nbdev/core.py | 7 +++++- nbs/00_core.ipynb | 45 +++++++++++++++++++++++++++++++----- nbs/index.ipynb | 18 ++++++++++++--- nbs/sidebar.yml | 5 ++++ 5 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 nbs/sidebar.yml diff --git a/hello_world_nbdev/_modidx.py b/hello_world_nbdev/_modidx.py index e0a641d..1f89449 100644 --- a/hello_world_nbdev/_modidx.py +++ b/hello_world_nbdev/_modidx.py @@ -5,4 +5,5 @@ 'doc_host': 'https://simveit.github.io', 'git_url': 'https://github.com/simveit/hello-world-nbdev', 'lib_path': 'hello_world_nbdev'}, - 'syms': {'hello_world_nbdev.core': {'hello_world_nbdev.core.foo': ('core.html#foo', 'hello_world_nbdev/core.py')}}} + 'syms': { 'hello_world_nbdev.core': { 'hello_world_nbdev.core.foo': ('core.html#foo', 'hello_world_nbdev/core.py'), + 'hello_world_nbdev.core.say_hello': ('core.html#say_hello', 'hello_world_nbdev/core.py')}}} diff --git a/hello_world_nbdev/core.py b/hello_world_nbdev/core.py index 6552cc5..e97ce12 100644 --- a/hello_world_nbdev/core.py +++ b/hello_world_nbdev/core.py @@ -1,7 +1,12 @@ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb. # %% auto 0 -__all__ = ['foo'] +__all__ = ['foo', 'say_hello'] # %% ../nbs/00_core.ipynb 3 def foo(): pass + +# %% ../nbs/00_core.ipynb 4 +def say_hello(to): + "Say hello to somebody" + return f'Hello {to}!' diff --git a/nbs/00_core.ipynb b/nbs/00_core.ipynb index 6671b71..c042fb0 100644 --- a/nbs/00_core.ipynb +++ b/nbs/00_core.ipynb @@ -4,14 +4,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# core\n", + "# Hello world from nbdev\n", "\n", - "> Fill in a module description here" + "> Hello, world :)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -38,6 +38,27 @@ "def foo(): pass" ] }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "#| export\n", + "def say_hello(to):\n", + " \"Say hello to somebody\"\n", + " return f'Hello {to}!'" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "assert say_hello(\"World\") == \"Hello World!\"" + ] + }, { "cell_type": "code", "execution_count": null, @@ -51,9 +72,21 @@ ], "metadata": { "kernelspec": { - "display_name": "python3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.4" } }, "nbformat": 4, diff --git a/nbs/index.ipynb b/nbs/index.ipynb index e13344c..0357297 100644 --- a/nbs/index.ipynb +++ b/nbs/index.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -16,7 +16,7 @@ "source": [ "# hello-world-nbdev\n", "\n", - "> Hello world repo for nbdev" + "> This is a page build with nbdev :)" ] }, { @@ -86,9 +86,21 @@ ], "metadata": { "kernelspec": { - "display_name": "python3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.4" } }, "nbformat": 4, diff --git a/nbs/sidebar.yml b/nbs/sidebar.yml new file mode 100644 index 0000000..45222d2 --- /dev/null +++ b/nbs/sidebar.yml @@ -0,0 +1,5 @@ +website: + sidebar: + contents: + - index.ipynb + - 00_core.ipynb