From a327dfd7d42c9060a7ab3210724ed49dc6d191bf Mon Sep 17 00:00:00 2001 From: github-bot Date: Fri, 23 Feb 2024 10:28:07 +0000 Subject: [PATCH] Deployed 3eb10bd to 0.6 with MkDocs 1.5.3 and mike 2.0.0 --- 0.6/CLI/index.html | 12 ++++++------ 0.6/Doc_Links_Utils/index.html | 4 ++-- 0.6/search/search_index.json | 2 +- 0.6/sitemap.xml.gz | Bin 579 -> 579 bytes 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/0.6/CLI/index.html b/0.6/CLI/index.html index 4aabaf1..bd6531e 100644 --- a/0.6/CLI/index.html +++ b/0.6/CLI/index.html @@ -1191,7 +1191,7 @@

readmedocs¤

-
 docs (root_path:str=<typer.models.OptionInfo object at 0x7fed567ba8e0>)
+
 docs (root_path:str=<typer.models.OptionInfo object at 0x7fdebeec59a0>)
 

CLI command for creating files for nbdev_mkdocs command

@@ -1202,10 +1202,10 @@

docs¤preview¤

 preview (root_path:str=<typer.models.OptionInfo object at
-          0x7fed567ba9a0>,
+          0x7fdebeec52e0>,
           use_relative_doc_links:bool=<typer.models.OptionInfo object at
-          0x7fed567baa00>, port:int=<typer.models.OptionInfo object at
-          0x7fed567ba820>)
+          0x7fdebeec5970>, port:int=<typer.models.OptionInfo object at
+          0x7fdebeec58b0>)
 

CLI command for creating files for nbdev_mkdocs command

@@ -1216,7 +1216,7 @@

previewprepare¤

 prepare (root_path:str=<typer.models.OptionInfo object at
-          0x7fed567ba9d0>)
+          0x7fdebeec53a0>)
 

CLI command for running tests and creating files for nbdev_mkdocs @@ -1227,7 +1227,7 @@

preparesource

new¤

-
 new (root_path:str=<typer.models.OptionInfo object at 0x7fed567baa60>)
+
 new (root_path:str=<typer.models.OptionInfo object at 0x7fdebeec5310>)
 

CLI command for creating files for nbdev_mkdocs command

diff --git a/0.6/Doc_Links_Utils/index.html b/0.6/Doc_Links_Utils/index.html index 0187b88..82c3a9f 100644 --- a/0.6/Doc_Links_Utils/index.html +++ b/0.6/Doc_Links_Utils/index.html @@ -1728,8 +1728,8 @@

Doc Links Utils

 fix_sym_links (s:str,
-                nbdev_lookup:<functools._lru_cache_wrapperobjectat0x7f5e6b
-                1187c0>, docs_versioning:str, lib_version:str,
+                nbdev_lookup:<functools._lru_cache_wrapperobjectat0x7f5824
+                b047c0>, docs_versioning:str, lib_version:str,
                 use_relative_doc_links:bool,
                 use_latest_doc_version:bool=False)
 
diff --git a/0.6/search/search_index.json b/0.6/search/search_index.json index 5406ebb..9d7c667 100644 --- a/0.6/search/search_index.json +++ b/0.6/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Material for nbdev","text":"

Documentation: https://nbdev-mkdocs.airt.ai

Source Code: https://github.com/airtai/nbdev-mkdocs

"},{"location":"#getting-started","title":"Getting Started","text":"

Material for nbdev is a nbdev extension that allows you to use Material for MkDocs to generate documentation for nbdev projects.

The key features are:

  • Material style documentation: Effortlessly create material style documentation for your nbdev projects with Material for MkDocs, a theme that provides a sleek and modern design for your documentation.
  • Auto generate docstrings: Instantly generate docstrings for your Python code using docstring-gen library, a tool that automatically generates docstrings for your functions and classes using Codex.
  • Create stunning social media share images: Boost your project\u2019s visibility by creating striking social share images using DALL-E.
  • Customizability: Add guides, release notes, customise the navigation menu and configure the Material for MkDocs easily to suit your project needs. With this documentation tool, you have more control over the look and feel of your documentation, allowing you to create a unique and personalized experience for your users.
"},{"location":"#workflow","title":"Workflow","text":"

Here\u2019s a quick comparison of Quarto and Material for nbdev development workflows:

Quarto workflow Material for nbdev workflow Install:
$ pip install notebook nbdev\n$ nbdev_install_quarto\n
Install:
$ pip install notebook nbdev\n$ nbdev_install_quarto\n$ pip install nbdev-mkdocs\n
Setup:
$ nbdev_new\n$ nbdev_install_hooks\n$ vi settings.ini\n$ pip install -e '.[dev]'\n
Setup:
$ nbdev_new\n$ nbdev_install_hooks\n$ vi settings.ini\n$ pip install -e '.[dev]'\n$ nbdev_mkdocs new\n$ vi mkdocs/mkdocs.yml\n
Development:
# Edit files\n$ nbdev_preview\n
Development:
# Edit files\n$ nbdev_mkdocs preview\n
Commit changes:
$ nbdev_prepare\n$ git commit -am \u201cCommit message\u201d\n$ git push\n
Commit changes:
$ nbdev_mkdocs prepare\n$ git commit -am \u201cCommit message\u201d\n$ git push\n
"},{"location":"#quick-start","title":"Quick start","text":"

The following quick start guide will walk you through installing and configuring nbdev-mkdocs for an existing nbdev project. It also assumes you\u2019ve already initialized your project with nbdev and installed all of the required libraries.

For detailed installation instructions and configuration options, please see the User Guide.

"},{"location":"#install","title":"Install","text":"

nbdev-mkdocs is published as a Python package and can be installed with pip:

pip install nbdev-mkdocs\n

Note that nbdev-mkdocs must be installed in the same Python environment as nbdev.

If the installation was successful, you should now have the nbdev-mkdocs installed on your system. Run the below command from the terminal to see the full list of available commands:

nbdev_mkdocs --help\n
 Usage: nbdev_mkdocs [OPTIONS] COMMAND [ARGS]...\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --install-completion          Install completion for the current shell.      \u2502\n\u2502 --show-completion             Show completion for the current shell, to copy \u2502\n\u2502                               it or customize the installation.              \u2502\n\u2502 --help                        Show this message and exit.                    \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 delete-pre-release-docs  Deletes deployed pre-release documentation          \u2502\n\u2502                          versions.                                           \u2502\n\u2502 docs                     Prepares files in 'mkdocs/docs' and then runs       \u2502\n\u2502                          'mkdocs build' command on them.                     \u2502\n\u2502 docstring                Command for adding docstrings to classes and        \u2502\n\u2502                          methods that don't have one using docstring-gen     \u2502\n\u2502                          library.                                            \u2502\n\u2502 new                      Creates files in 'mkdocs' subdirectory needed for   \u2502\n\u2502                          other 'nbdev_mkdocs' subcommands.                   \u2502\n\u2502 prepare                  Runs tests and prepares files in 'mkdocs/docs' and  \u2502\n\u2502                          then runs 'mkdocs build' command on them.           \u2502\n\u2502 preview                  Prepares files in 'mkdocs/docs' and then runs       \u2502\n\u2502                          'mkdocs serve' command on them.                     \u2502\n\u2502 readme                   Updates the README.md file from the 'readme_nb'     \u2502\n\u2502                          notebook. Unless explicitly changed in the          \u2502\n\u2502                          settings.ini file, the 'readme_nb' points to the    \u2502\n\u2502                          'index.ipynb' notebook in the 'nbs_path' directory. \u2502\n\u2502 social-image             Command for generating a custom social share image. \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n
"},{"location":"#setup","title":"Setup","text":"

After installing nbdev-mkdocs, bootstrap your project documentation by executing the following command from the project\u2019s root directory:

nbdev_mkdocs new\n

Using information from the project\u2019s settings.ini file, the above command creates files and directories required to build the documentation and saves it in the mkdocs subdirectory.

Note: You should only run the nbdev_mkdocs new command once for the project to initialise the files required for building Material for MkDocs documentation.

"},{"location":"#preview-changes","title":"Preview changes","text":"

nbdev_mkdocs lets you preview your changes as you write your documentation. Execute the following command from the project root directory to start a local server, and preview your documentation:

Note: If you haven\u2019t already installed your library locally, run pip install -e '.[dev]' command before running the nbdev_mkdocs prepare command.

nbdev_mkdocs preview\n
"},{"location":"#prepare-changes","title":"Prepare changes","text":"

To prepare your changes for Git push, we recommend executing the following commands:

First, run the nbdev_mkdocs prepare command in the terminal. This command exports the library, runs tests, and cleans the notebooks.

nbdev_mkdocs prepare\n

Then, run the nbdev_mkdocs readme command to update the README.md file from the \u2018readme_nb\u2019 notebook. By default, \u2018readme_nb\u2019 points to \u2018index.ipynb\u2019 notebook in the \u2018nbs_path\u2019 unless modified in the settings.ini file.

This command does everything the \u2018nbdev_readme\u2019 command does, plus it generates symbol references that are compatible with \u2018Material for nbdev\u2019.

nbdev_mkdocs readme\n

Finally, double-check your settings.ini file to ensure that it has all of the correct information. Then commit and push your additions to GitHub:

git commit -am'Commit Message'\ngit push\n
"},{"location":"#copyright","title":"Copyright","text":"

Copyright \u00a9 2022 onwards airt technologies ltd, Inc.

"},{"location":"#license","title":"License","text":"

This project is licensed under the terms of the Apache License 2.0

"},{"location":"API_Docs_Helper/","title":"API Docs Helper","text":"
from subprocess import CalledProcessError\nimport shutil\nimport unittest.mock\nfrom contextlib import contextmanager\nfrom tempfile import TemporaryDirectory\n\nfrom nbdev.doclinks import NbdevLookup\n\nfrom nbdev_mkdocs.mkdocs import prepare\n
/Users/harishm/.pyenv/versions/3.10.4/lib/python3.10/site-packages/pandas/compat/__init__.py:124: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.\n  warnings.warn(msg)\n
def sample_test_function():\n    pass\n\nsample_test_function.__module__ = \"custom_name._components.Sample.sample\"\n\n@contextmanager\ndef mock_getsourcefile():\n    with unittest.mock.patch('__main__.getsourcefile') as mock_getsourcefile:\n        mock_getsourcefile.return_value = '/Users/username/Dev/nbdev-mkdocs/custom_name/_components/Sample.py'\n        yield\n\n@contextmanager\ndef mock_get_config():\n    with unittest.mock.patch('__main__.get_config') as mock_get_config:\n        mock_get_config.return_value = {\"lib_path\": Path('/Users/username/Dev/nbdev-mkdocs/custom_name')}\n        yield\n\nwith mock_getsourcefile():\n    with mock_get_config():\n        actual = _get_symbol_filepath(sample_test_function)\n        expected = Path(\"custom_name/_components/Sample.py\")\n        print(actual)\n        assert actual == expected\n
custom_name/_components/Sample.py\n
actual = _get_symbol_filepath(prepare)\nexpected = Path(\"nbdev_mkdocs/mkdocs.py\")\nprint(actual)\n\nassert actual == expected\n
nbdev_mkdocs/mkdocs.py\n
expected = \"\\n\\n::: custom_name._components.Sample.sample_test_function\\n\"\n\nactual = _generate_autodoc(symbol=sample_test_function, symbol_path=Path(\"custom_name/_components/Sample.py\"))\nprint(actual)\nassert actual == expected\n
::: custom_name._components.Sample.sample_test_function\n
autodoc = \"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n\"\nactual = _add_mkdocstring_header_config(autodoc=autodoc, heading_level=2, show_category_heading=True, is_root_object=True)\n\nexpected = \"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n\"\ndisplay(actual)\nassert actual == expected\n
'\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n'\n
autodoc = \"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n\"\nactual = _add_mkdocstring_header_config(autodoc=autodoc, heading_level=2, show_category_heading=True, is_root_object=False)\n\nexpected = \"\"\"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\n    options:\n      heading_level: 4\n      show_root_full_path: false\n\"\"\"\ndisplay(actual)\nassert actual == expected\n
'\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n    options:\\n      heading_level: 4\\n      show_root_full_path: false\\n'\n
autodoc = \"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n\"\nactual = _add_mkdocstring_header_config(autodoc=autodoc, heading_level=2, show_category_heading=False, is_root_object=False)\n\nexpected = \"\"\"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\n    options:\n      heading_level: 3\n      show_root_full_path: false\n\"\"\"\ndisplay(actual)\nassert actual == expected\n
'\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n    options:\\n      heading_level: 3\\n      show_root_full_path: false\\n'\n
_generate_autodoc_string_mock_value = f'::: nbdev_mkdocs.mkdocs.prepare'\n\n@contextmanager\ndef mock_generate_autodoc_string():\n    with unittest.mock.patch('__main__._generate_autodoc_string') as mock_generate_autodoc_string:\n        mock_generate_autodoc_string.return_value = _generate_autodoc_string_mock_value\n        yield\n
with mock_generate_autodoc_string():\n    actual = _generate_autodoc_string(prepare)\n\nexpected = \"\"\"::: nbdev_mkdocs.mkdocs.prepare\"\"\"\ndisplay(actual)\nassert actual == expected\n
'::: nbdev_mkdocs.mkdocs.prepare'\n
class Car:\n    SOME_ATTRIBUTE = \"Some class attribute\"\n\n    def __init__(self, make: str, model: str, year: int, color: str):\n        self.make = make\n        self.model = model\n        self.year = year\n        self.color = color\n        self.is_running = False\n\n    def start(self):\n        self.is_running = True\n\n    def stop(self):\n        self.is_running = False\n\n    def drive(\n        self,\n        distance: float,\n        speed: Optional[float] = None,\n        passengers: Optional[int] = None,\n    ) -> float:\n        if not self.is_running:\n            raise ValueError(\"Cannot drive a stopped car.\")\n\n        if speed:\n            print(f\"Driving at {speed} km/h.\")\n\n        if passengers:\n            print(f\"Driving with {passengers} passengers.\")\n\n        return distance\n\n    def patched_method_in_same_file(self, s: str) -> str:\n        raise NotImplementedError()\n\n    @staticmethod\n    def i_am_a_static_method(name: str) -> str:\n        if not isinstance(name, str):\n            raise ValueError(\"I will accept only string\")\n        return f\"Hello, {name}\"\n\n    @classmethod\n    def i_am_a_class_method(cls):\n        return f\"Nothing\"\n\n\n\nactual = _filter_attributes_in_autodoc(Car)\nexpected = \"\"\"    options:\n      filters: [\"!^drive$\", \"!^i_am_a_class_method$\", \"!^i_am_a_static_method$\", \"!^patched_method_in_same_file$\", \"!^start$\", \"!^stop$\"]\"\"\"\ndisplay(actual)\nassert actual == expected\n
'    options:\\n      filters: [\"!^drive$\", \"!^i_am_a_class_method$\", \"!^i_am_a_static_method$\", \"!^patched_method_in_same_file$\", \"!^start$\", \"!^stop$\"]'\n
_mkdocs = \"\"\"\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n        - https://docs.python.org/3/objects.inv\n        options:\n          heading_level: 2\n          show_category_heading: true\n          show_root_heading: true\n          show_signature_annotations: true\n          show_if_no_docstring: true\n\nmarkdown_extensions:\n- md_in_html\n- pymdownx.arithmatex:\n    generic: true\n- pymdownx.superfences:\n        custom_fences:\n          - name: mermaid\n            class: mermaid\n            format: !!python/name:pymdownx.superfences.fence_code_format\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n    heading_level, show_category_heading = _get_mkdocstring_config(mkdocs_path=mkdocs_path)\n    actual = (heading_level, show_category_heading)\n    expected = (2, True)\n\n    display(actual)\n    assert actual == expected\n
(2, True)\n
_mkdocs = \"\"\"\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n        - https://docs.python.org/3/objects.inv\n        options:\n          show_root_heading: true\n          show_signature_annotations: true\n          show_if_no_docstring: true\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n    heading_level, show_category_heading = _get_mkdocstring_config(mkdocs_path=mkdocs_path)\n    actual = (heading_level, show_category_heading)\n    expected = (2, False)\n\n    display(actual)\n    assert actual == expected\n
(2, False)\n
_mkdocs = \"\"\"\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n        - https://docs.python.org/3/objects.inv\n        options:\n          heading_level: 5\n          show_category_heading: false\n          show_root_heading: true\n          show_signature_annotations: true\n          show_if_no_docstring: true\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n    heading_level, show_category_heading = _get_mkdocstring_config(mkdocs_path=mkdocs_path)\n    actual = (heading_level, show_category_heading)\n    expected = (5, False)\n\n    display(actual)\n    assert actual == expected\n
(5, False)\n

source

"},{"location":"API_Docs_Helper/#get_formatted_docstring_for_symbol","title":"get_formatted_docstring_for_symbol","text":"
 get_formatted_docstring_for_symbol (symbol:Union[function,Type[Any]],\n                                     mkdocs_path:pathlib.Path)\n

Recursively parses and get formatted docstring of a symbol.

Args: symbol: A Python class or function object to parse the docstring for. mkdocs_path: The path to the mkdocs folder.

Returns: A formatted docstring of the symbol and its members.

_mkdocs = \"\"\"\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n        - https://docs.python.org/3/objects.inv\n        options:\n          heading_level: 5\n          show_category_heading: false\n          show_root_heading: true\n          show_signature_annotations: true\n          show_if_no_docstring: true\n\"\"\"\n
class Car:\n    \"\"\"A class representing a car.\n\n    Attributes:\n        make: The make of the car.\n        model: The model of the car.\n        year: The year the car was made.\n        color: The color of the car.\n    \"\"\"\n\n    SOME_CLASS_ATTRIBUTE = \"some class attribute\"\n    second_class_attribute = \"second_class_attribute\"\n\n    def __init__(self, make: str, model: str, year: int, color: str):\n        \"\"\"Initialize a new car.\n\n        Args:\n            make: The make of the car.\n            model: The model of the car.\n            year: The year the car was made.\n            color: The color of the car.\n        \"\"\"\n        self.make = make\n        self.model = model\n        self.year = year\n        self.color = color\n        self.is_running = False\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n    with mock_generate_autodoc_string():\n        actual = get_formatted_docstring_for_symbol(Car, mkdocs_path)\n\n    expected = \"\"\"::: nbdev_mkdocs.mkdocs.prepare    options:\n      filters: []\n\n\"\"\"\n\n    print(actual)\n    assert actual == expected\n
::: nbdev_mkdocs.mkdocs.prepare    options:\n      filters: []\n
def fixture_function(\n    arg_1: str,\n    arg_2: Union[List[str], str],\n    arg_3: Optional[int],\n    arg_4: Optional[str] = None,\n) -> str:\n    \"\"\"This is a one line description for the function\n\n    Args:\n        arg_1: Argument 1\n        arg_2: Argument 2\n        arg_3: Argument 3\n        arg_4: Argument 4\n\n    Returns:\n        The concatinated string\n    \"\"\"\n    pass\n\nget_module_source_value = \"\"\"\ndef fixture_function(\n    arg_1: str,\n    arg_2: Union[List[str], str],\n    arg_3: Optional[int],\n    arg_4: Optional[str] = None,\n) -> str:\n    \\\"\\\"\\\"This is a one line description for the function\n\n    Args:\n        arg_1: Argument 1\n        arg_2: Argument 2\n        arg_3: Argument 3\n        arg_4: Argument 4\n\n    Returns:\n        The concatinated string\n    \\\"\\\"\\\"\n    pass\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n\n    expected = \"::: nbdev_mkdocs.mkdocs.prepare\"\n\n    with mock_generate_autodoc_string():\n        actual = get_formatted_docstring_for_symbol(fixture_function, mkdocs_path)\n    display(actual)\n    assert actual == expected\n
'::: nbdev_mkdocs.mkdocs.prepare'\n
"},{"location":"CHANGELOG/","title":"Release notes","text":""},{"location":"CHANGELOG/#061","title":"0.6.1","text":""},{"location":"CHANGELOG/#new-features","title":"New Features","text":"
  • Create new CLI command \"nbdev mkdocs readme\" (#206), thanks to @harishmohanraj
"},{"location":"CHANGELOG/#bugs-squashed","title":"Bugs Squashed","text":"
  • Do not run \"nbdev_docs\" while running \"nbdev_mkdocs docs\" (#208), thanks to @harishmohanraj

  • AttributeError: module 'openai' has no attribute 'error (#212), thanks to @harishmohanraj

"},{"location":"CHANGELOG/#060","title":"0.6.0","text":""},{"location":"CHANGELOG/#new-features_1","title":"New Features","text":"
  • Support for Python 3.7 has been removed.
"},{"location":"CHANGELOG/#bugs-squashed_1","title":"Bugs Squashed","text":"
  • Add correct URL to mkdocs config file when executing the social image generate CLI command (#202), thanks to @harishmohanraj

  • Fix docs build failure on Windows (#194), thanks to @harishmohanraj

"},{"location":"CHANGELOG/#051","title":"0.5.1","text":""},{"location":"CHANGELOG/#bugs-squashed_2","title":"Bugs Squashed","text":"
  • Fix the misalignment of class methods in the documentation (#186), thanks to @harishmohanraj
  • Fix build failures when the repository and exported library names differ (#184), thanks to @harishmohanraj
"},{"location":"CHANGELOG/#050","title":"0.5.0","text":""},{"location":"CHANGELOG/#new-features_2","title":"New Features","text":"
  • Replace static parsing of source files with dynamic import from library when extracting symbols (#180), thanks to @harishmohanraj
"},{"location":"CHANGELOG/#040","title":"0.4.0","text":""},{"location":"CHANGELOG/#bugs-squashed_3","title":"Bugs Squashed","text":"
  • Callout does not work (#179), thanks to @harishmohanraj
"},{"location":"CHANGELOG/#030","title":"0.3.0","text":""},{"location":"CHANGELOG/#bugs-squashed_4","title":"Bugs Squashed","text":"
  • Switch to chatGPT model from codex model (#171)
"},{"location":"CHANGELOG/#022","title":"0.2.2","text":""},{"location":"CHANGELOG/#bugs-squashed_5","title":"Bugs Squashed","text":"
  • Don't run nbdev_readme automatically (#168), thanks to @harishmohanraj
  • Closes #166
"},{"location":"CHANGELOG/#021","title":"0.2.1","text":""},{"location":"CHANGELOG/#bugs-squashed_6","title":"Bugs Squashed","text":"
  • Load symbols dynamically and link it to the docs (#160)
"},{"location":"CHANGELOG/#020","title":"0.2.0","text":""},{"location":"CHANGELOG/#bugs-squashed_7","title":"Bugs Squashed","text":"
  • Upgrade mkdocstrings and python handler

  • Fix prepare and preview tests (#155)

  • Add docs version in the link to the symbols (#151)

  • Fix link to symbols in docs (#144)

  • https://github.com/fastai/nbdev/blob/master/nbdev/doclinks.py#L87
"},{"location":"CHANGELOG/#010","title":"0.1.0","text":""},{"location":"CHANGELOG/#new-features_3","title":"New Features","text":"
  • Add documentation versioning (#72)
  • https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/

  • add detect-secrets to pre-commit hooks (#138)

  • Integrate docstring-gen into nbdev-mkdocs (#123)

  • Rename the CLI command \"nbdev_mkdocs generate-social-image\" to \"nbdev_mkdocs social-image generate\" (#127)

"},{"location":"CHANGELOG/#bugs-squashed_8","title":"Bugs Squashed","text":"
  • Hide the badges displayed on the index page in the docs (#118)

  • nbdev docs: The CI build status badge should not appear in the documentation. (#113)

  • nbdev docs: Locally referenced images are not showing up in the docs (#110)

"},{"location":"CHANGELOG/#004","title":"0.0.4","text":""},{"location":"CHANGELOG/#new-features_4","title":"New Features","text":"
  • Rename the CLI command \"nbdev_mkdocs generate-social-image\" to \"nbdev_mkdocs social-image generate\" (#127)

  • Integrate docstring-gen into nbdev-mkdocs (#123)

"},{"location":"CHANGELOG/#bugs-squashed_9","title":"Bugs Squashed","text":"
  • Hide the badges displayed on the index page in the docs (#118)

  • nbdev docs: The CI build status badge should not appear in the documentation. (#113)

  • nbdev docs: Locally referenced images are not showing up in the docs (#110)

"},{"location":"CHANGELOG/#003","title":"0.0.3","text":""},{"location":"CHANGELOG/#bugs-squashed_10","title":"Bugs Squashed","text":"
  • CI bug fix
"},{"location":"CHANGELOG/#002","title":"0.0.2","text":""},{"location":"CHANGELOG/#new-features_5","title":"New Features","text":"
  • If a CLI command documentation fails, rather than failing, print the exception in the terminal. (#107)

  • Make API, CLI and Releases configurable in the docs (#106)

  • Handle glob expressions while building the navigation tree for MkDocs (#100)

  • Build tensorflow based Docker image with preinstalled nbdev_mkdocs and all requirements (#95)

  • Build docker images with preinstalled nbdev_mkdocs and all requirements (#94)

  • Use AI to generate social image (#81)

  • Read sidebar.yml for generating the docs navigation (#62)

"},{"location":"CHANGELOG/#bugs-squashed_11","title":"Bugs Squashed","text":"
  • Uploading large images breaks the social share image. (#98)

  • Copy requirements in dev-requirements for client projects and not for nbdev-mkdocs (#79)

  • Install mkdoc-nbdev from pypi instead of git (#54)

  • The following code in deployed.yml installs the git version for all our projects, but it should do that only for the nbdev-mkdocs project:
"},{"location":"CHANGELOG/#001","title":"0.0.1","text":""},{"location":"CHANGELOG/#new-features_6","title":"New Features","text":"
  • Add stuffs to gitignore when you run nbdev_new (#59)

  • Create new repo for maintaining workflows (#52)

  • Call nbdev_prepare internally when calling nbdev_mkdocs prepare (#43)

  • Enable local development (#36)

  • Use quarto to convert notebooks into markdown (#35), thanks to @harishmohanraj

  • Update ghp deploy action template (#33), thanks to @harishmohanraj

  • Use nbdev and quarto for converting notebooks into markdown files (#31)

    • Update walkthrough docs to install quarto
  • Create new deploy action as part of the nbdev-mkdocs new command (#25)

  • Implement logic to hide cells in guides notebook (#24)

  • Generate cli docs (#14), thanks to @harishmohanraj

  • Closes #4

  • Add release page (#10), thanks to @harish-airt

  • Closes #8

  • Initial commit, thanx to @davorrunje

"},{"location":"CLI/","title":"CLI","text":"
import shutil\nfrom tempfile import TemporaryDirectory\n\nfrom typer.testing import CliRunner\n\nfrom nbdev_mkdocs._helpers.utils import set_cwd\n
runner = CliRunner()\n
"},{"location":"CLI/#readme","title":"readme","text":"
 readme ()\n

CLI command for updating the README.md file from the readme_nb notebook.

"},{"location":"CLI/#docs","title":"docs","text":"
 docs (root_path:str=<typer.models.OptionInfo object at 0x7fed567ba8e0>)\n

CLI command for creating files for nbdev_mkdocs command

source

"},{"location":"CLI/#preview","title":"preview","text":"
 preview (root_path:str=<typer.models.OptionInfo object at\n          0x7fed567ba9a0>,\n          use_relative_doc_links:bool=<typer.models.OptionInfo object at\n          0x7fed567baa00>, port:int=<typer.models.OptionInfo object at\n          0x7fed567ba820>)\n

CLI command for creating files for nbdev_mkdocs command

source

"},{"location":"CLI/#prepare","title":"prepare","text":"
 prepare (root_path:str=<typer.models.OptionInfo object at\n          0x7fed567ba9d0>)\n

CLI command for running tests and creating files for nbdev_mkdocs command.

source

"},{"location":"CLI/#new","title":"new","text":"
 new (root_path:str=<typer.models.OptionInfo object at 0x7fed567baa60>)\n

CLI command for creating files for nbdev_mkdocs command

_sample_function = \"\"\"\ndef sum(num1: int, num2: int) -> int:\n    return num1 + num2\n\"\"\"\nwith TemporaryDirectory() as d:\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", Path(d) / \"settings.ini\")\n\n    with set_cwd(d):\n        nbs_path = Path(d) / \"nbs\"\n        Path(nbs_path).mkdir()\n\n        test_file_path = nbs_path / \"test.py\"\n        with open(test_file_path, \"w\", encoding=\"utf-8\") as f:\n            f.write(_sample_function)\n\n        result = runner.invoke(_app, [\"docstring\", \"generate\"])\n        print(result.stdout)\n        assert result.exit_code == 0, f\"result.stdout={result.stdout} result.exit_code={result.exit_code}\"\n\n        with open(test_file_path, \"r\", encoding=\"utf-8\") as f:\n            actual = f.read()\n\n        print(actual)\n        assert \"docstring-gen\" in actual, actual\n\n        result = runner.invoke(\n            _app, [\"docstring\", \"generate\", \"-p\", f\"{d}/invalid_directory_name\"]\n        )\n        print(result.stdout)\n        assert result.exit_code == 1, result.exit_code\n
Successfully added docstrings to /private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpk5xf8cpt/nbs/test.py\n\n\ndef sum(num1: int, num2: int) -> int:\n    \"\"\"Calculates the sum of two numbers.\n\n    Args:\n        num1: The first number.\n        num2: The second number.\n\n    Returns:\n        The sum of num1 and num2.\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)\n    \"\"\"\n    return num1 + num2\n\nPath '/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpk5xf8cpt/invalid_directory_name' does not exists!\n
all_branches = (\n    \"0.0.5rc10 [dev]\\n0.0.5dev\\n0.0.5rc0\\n0.0.4 [latest]\\n0.0.3\\n0.0.2\\n0.0.1\\n\"\n)\nexpected = \"0.0.5rc10\\n0.0.5dev\\n0.0.5rc0\"\nactual = _filter_rc_branches(all_branches)\nprint(actual)\nassert actual == expected\n
0.0.5rc10\n0.0.5dev\n0.0.5rc0\n
all_branches = \"0.0.4 [latest]\\n0.0.3\\n0.0.2\\n0.0.1\\n\"\nexpected = \"\"\nactual = _filter_rc_branches(all_branches)\nprint(actual)\nassert actual == expected\n
all_versions = \"0.0.5rc10 [dev]\\n0.0.5dev\\n0.0.5rc0\"\nexpected = [\"0.0.5rc10\", \"0.0.5dev\", \"0.0.5rc0\"]\n\nactual = _get_version_numbers(all_versions)\nprint(actual)\nassert actual == expected\n
['0.0.5rc10', '0.0.5dev', '0.0.5rc0']\n
"},{"location":"CLI/#delete_pre_release_docs","title":"delete_pre_release_docs","text":"
 delete_pre_release_docs ()\n

Deletes deployed pre-release documentation versions.

result = runner.invoke(_app, [\"--help\"])\nprint(result.stdout)\n
                                                                                                                   \n Usage: root [OPTIONS] COMMAND [ARGS]...                                                                           \n                                                                                                                   \n
\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --install-completion          Install completion for the current shell.                                         \u2502\n\u2502 --show-completion             Show completion for the current shell, to copy it or customize the installation.  \u2502\n\u2502 --help                        Show this message and exit.                                                       \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n
\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 delete-pre-release-docs  Deletes deployed pre-release documentation versions.                                   \u2502\n\u2502 docs                     Prepares files in 'mkdocs/docs' and then runs 'mkdocs build' command on them.          \u2502\n\u2502 docstring                Command for adding docstrings to classes and methods that don't have one using         \u2502\n\u2502                          docstring-gen library.                                                                 \u2502\n\u2502 new                      Creates files in 'mkdocs' subdirectory needed for other 'nbdev_mkdocs' subcommands.    \u2502\n\u2502 prepare                  Runs tests and prepares files in 'mkdocs/docs' and then runs 'mkdocs build' command on \u2502\n\u2502                          them.                                                                                  \u2502\n\u2502 preview                  Prepares files in 'mkdocs/docs' and then runs 'mkdocs serve' command on them.          \u2502\n\u2502 readme                   Updates the README.md file from the 'readme_nb' notebook. Unless explicitly changed in \u2502\n\u2502                          the settings.ini file, the 'readme_nb' points to the 'index.ipynb' notebook in the     \u2502\n\u2502                          'nbs_path' directory.                                                                  \u2502\n\u2502 social-image             Command for generating a custom social share image.                                    \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n
"},{"location":"CLI_Doc_Helper/","title":"CLI Doc Helper","text":"
import subprocess\nfrom tempfile import TemporaryDirectory\n

source

"},{"location":"CLI_Doc_Helper/#generate_cli_doc","title":"generate_cli_doc","text":"
 generate_cli_doc (module_name:str, app_name:str)\n

Generate CLI documentation for a Typer app.

Args: module_name: The name of the module containing the Typer app. app_name: The name of the Typer app.

Returns: The CLI documentation for the Typer app.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

module_name = \"nbdev_mkdocs._cli\"\napp_name = \"nbdev_mkdocs\"\nactual = generate_cli_doc(module_name, app_name)\nprint(actual)\nfor cmd in [\"nbdev_mkdocs new\", \"nbdev_mkdocs prepare\", \"nbdev_mkdocs preview\"]:\n    assert cmd in actual, f\"cmd={cmd}, actual={actual}\"\n
# `nbdev_mkdocs`\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs [OPTIONS] COMMAND [ARGS]...\n```\n\n**Options**:\n\n* `--install-completion`: Install completion for the current shell.\n* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.\n* `--help`: Show this message and exit.\n\n**Commands**:\n\n* `docs`: Prepares files in **mkdocs/docs** and then...\n* `new`: Creates files in **mkdocs** subdirectory...\n* `prepare`: Runs tests and prepares files in...\n* `preview`: Prepares files in **mkdocs/docs** and then...\n* `social-image`: Command for generating a custom social...\n\n## `nbdev_mkdocs docs`\n\nPrepares files in **mkdocs/docs** and then runs **mkdocs build** command on them\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs docs [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: Project's root path.  [default: .]\n* `--help`: Show this message and exit.\n\n## `nbdev_mkdocs new`\n\nCreates files in **mkdocs** subdirectory needed for other **nbdev_mkdocs** subcommands\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs new [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: [default: .]\n* `--help`: Show this message and exit.\n\n## `nbdev_mkdocs prepare`\n\nRuns tests and prepares files in **mkdocs/docs** and then runs **mkdocs build** command on them\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs prepare [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: [default: .]\n* `--help`: Show this message and exit.\n\n## `nbdev_mkdocs preview`\n\nPrepares files in **mkdocs/docs** and then runs **mkdocs serve** command on them\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs preview [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: path under which mkdocs directory will be created  [default: .]\n* `--port INTEGER`: port to use  [default: 4000]\n* `--help`: Show this message and exit.\n\n## `nbdev_mkdocs social-image`\n\nCommand for generating a custom social share image.\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs social-image [OPTIONS] COMMAND [ARGS]...\n```\n\n**Options**:\n\n* `--help`: Show this message and exit.\n\n**Commands**:\n\n* `generate`: Generate a custom social share image\n\n### `nbdev_mkdocs social-image generate`\n\nGenerate a custom social share image\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs social-image generate [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: Project's root path.  [default: .]\n* `--generator [file|dall_e]`: Generator to use to create the social image. Valid options are: 'file' and 'dall_e'. Choose 'file' if you want to use an existing image from your local machine in the social share image.  [default: file]\n* `--prompt TEXT`: The prompt to use for generating the image.  [default: Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render]\n* `--image-path TEXT`: Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used.\n* `--help`: Show this message and exit.\n
"},{"location":"CLI_Docs_Generator/","title":"CLI Docs Generator","text":"
import shutil\nfrom pathlib import Path\nfrom unittest.mock import patch, MagicMock\nfrom contextlib import contextmanager\nfrom tempfile import TemporaryDirectory\n\nfrom fastcore.foundation import Config\n
@contextmanager\ndef mock_nbdev_readme(mock_contents, d):\n    with patch('__main__.nbdev_readme') as mock_nbdev_readme:\n        mock_nbdev_readme.__wrapped__ = MagicMock()\n        with open((Path(d) / \"README.md\"), \"w\", encoding=\"utf-8\") as f:\n            f.write(mock_contents)\n        yield\n\n\n\n_mock_nbdev_readme_return_value = \"\"\"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\"\"\nwith TemporaryDirectory() as d:\n    with mock_nbdev_readme(_mock_nbdev_readme_return_value, d):\n        nbdev_readme.__wrapped__()\n\n        with open((Path(d) / \"README.md\"), \"r\", encoding=\"utf-8\") as f:\n            contents = f.read()\n\n        print(contents)\n        assert contents == _mock_nbdev_readme_return_value\n
This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\n
@contextmanager\ndef mock_get_config(d, cfg):\n    with patch(\"__main__.get_config\") as mock_get_config:\n        mock_get_config.return_value = cfg\n        yield\n\nwith TemporaryDirectory() as d:\n    _d = dict(\n        config_path=Path(d),\n        doc_host=\"https://airtai.github.io\",\n        lib_path=Path(d) / \"nbdev_mkdocs\",\n        doc_baseurl=\"/nbdev-mkdocs\",\n        docs_versioning=\"minor\",\n        version=\"0.7.0rc0\",\n        lib_name=\"nbdev-mkdocs\",\n    )\n\n    _types = dict(config_path=Path, doc_host=str, lib_path=Path, doc_baseurl=str, docs_versioning=str, version=str, lib_name=str)\n    cfg = Config(str(Path(d)), \"test_settings.ini\", create=_d, save=False, types=_types)\n    with mock_get_config(d, cfg):\n        cfg = get_config()\n\n        print(cfg.config_path)\n        assert cfg.config_path == Path(d)\n        assert cfg.doc_host == 'https://airtai.github.io'\n        assert cfg.lib_path.name == 'nbdev_mkdocs'\n
/tmp/tmpna2i1g2b\n

source

"},{"location":"CLI_Docs_Generator/#update_readme","title":"update_readme","text":"
 update_readme ()\n

Update the readme file and fix the symbol links

fixture = \"\"\"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\"\"\nexpected = {\n    \"minor\": \"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n    \"patch\": \"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n    \"None\": \"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n}\n\nfor docs_versioning in [\"minor\", \"patch\", \"None\", \"\"]:\n    with TemporaryDirectory() as d:\n        readme_path = Path(d) / \"README.md\"\n        _d = dict(\n            config_path=Path(d),\n            doc_host=\"https://airtai.github.io\",\n            lib_path=Path(d) / \"nbdev_mkdocs\",\n            doc_baseurl=\"/nbdev-mkdocs\",\n            docs_versioning=docs_versioning,\n            version=\"0.1.0\",\n            lib_name=\"nbdev-mkdocs\",\n        )\n\n        _types = dict(config_path=Path, doc_host=str, lib_path=Path, doc_baseurl=str, docs_versioning=str, version=str, lib_name=str)\n        cfg = Config(str(Path(d)), \"test_settings.ini\", create=_d, save=False, types=_types)\n        with mock_get_config(d, cfg):\n            with mock_nbdev_readme(fixture, d):\n                update_readme()\n\n            with open(readme_path, \"r\", encoding=\"utf-8\") as f:\n                actual = f.read()\n            print(actual)\n            if docs_versioning == \"\":\n                assert actual == expected[\"None\"]\n            else:\n                assert actual == expected[docs_versioning], f\"actual={actual}, expected={expected[doc_version]}\"\n
This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\nThis is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\nThis is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\nThis is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n
fixture = \"\"\"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\"\"\nexpected = \"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n\nwith TemporaryDirectory() as d:\n    readme_path = Path(d) / \"README.md\"\n    _d = dict(\n        config_path=Path(d),\n        doc_host=\"https://airtai.github.io\",\n        lib_path=Path(d) / \"nbdev_mkdocs\",\n        doc_baseurl=\"/nbdev-mkdocs\",\n        version=\"0.1.0\",\n        lib_name=\"nbdev-mkdocs\",\n    )\n\n    _types = dict(config_path=Path, doc_host=str, lib_path=Path, doc_baseurl=str, version=str, lib_name=str)\n    cfg = Config(str(Path(d)), \"test_settings.ini\", create=_d, save=False, types=_types)\n    with mock_get_config(d, cfg):\n        with mock_nbdev_readme(fixture, d):\n            update_readme()\n\n        with open(readme_path, \"r\", encoding=\"utf-8\") as f:\n            actual = f.read()\n        print(actual)\n        assert actual == expected\n
This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n
"},{"location":"Doc_Links_Utils/","title":"Doc Links Utils","text":"
import unittest.mock\nfrom contextlib import contextmanager\nfrom unittest.mock import MagicMock\n\nimport pytest\n
fixture = \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\nexpected = \"nbdev_mkdocs.mkdocs.prepare\"\nactual = _get_backtick_enclosed_string(fixture)\ndisplay(actual)\nassert actual == expected\n\nfixture = \"[`google`](https://www.google.com/)\"\nexpected = \"google\"\nactual = _get_backtick_enclosed_string(fixture)\ndisplay(actual)\nassert actual == expected\n\nfixture = \"[`airt.client.Client.get_token`](https://docs.airt.ai/api_client.html#client.get_token)\"\nexpected = \"airt.client.Client.get_token\"\nactual = _get_backtick_enclosed_string(fixture)\ndisplay(actual)\nassert actual == expected\n
'nbdev_mkdocs.mkdocs.prepare'\n\n'google'\n\n'airt.client.Client.get_token'\n
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev\")\nsymbol_details = (\n    \"https://nbdev.fast.ai/api/doclinks.html#nbdevlookup.linkify\",\n    \"nbdev/doclinks.py\",\n    \"https://github.com/fastai/nbdev/blob/master/nbdev/doclinks.py\",\n)\nexpected = \"nbdev.doclinks.NbdevLookup.linkify\"\nactual = _get_sym_path_from_nbdev_lookup(nbdev_lookup, symbol_details)\nprint(actual)\n\nassert actual == expected\n
nbdev.doclinks.NbdevLookup.linkify\n
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\nsymbol_details = (\n    \"https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare\",\n    \"nbdev_mkdocs/mkdocs.py\",\n    \"https://github.com/airtai/nbdev-mkdocs/blob/main/nbdev_mkdocs/mkdocs.py\",\n)\nexpected = \"nbdev_mkdocs.mkdocs.prepare\"\nactual = _get_sym_path_from_nbdev_lookup(nbdev_lookup, symbol_details)\nprint(actual)\n\nassert actual == expected\n
nbdev_mkdocs.mkdocs.prepare\n
with unittest.mock.patch(\"importlib.import_module\") as mock:\n    mock_object = MagicMock()\n    mock_object.whatever = MagicMock()\n    mock_object.whatever.something = \"it works\"\n    mock.return_value = mock_object\n\n    m = importlib.import_module(\"invalid_module\")\n    print(m.whatever.something)\n\n    assert m.whatever.something == \"it works\"\n
it works\n
@contextmanager\ndef mock_fastkafka():\n    with unittest.mock.patch(\"__main__.importlib\") as mock:\n        mock_module = MagicMock(name=\"mock_module\")\n        mock_module._application = MagicMock(name=\"_application\")\n        mock_module._application.app = MagicMock(name=\"app\")\n        mock_module._application.app.FastKafka = MagicMock(name=\"FastKafka\")\n        mock_module._application.app.FastKafka.__qualname__ = \"FastKafka\"\n        mock_module._application.app.FastKafka.__module__ = \"fastkafka\"\n\n        mock_module._application.app.FastKafka.get_topics = MagicMock()\n        mock_module._application.app.FastKafka.get_topics.__qualname__ = (\n            \"FastKafka.get_topics\"\n        )\n        mock_module._application.app.FastKafka.get_topics.__module__ = (\n            \"fastkafka._application.app\"\n        )\n\n        def import_module(s: str, m=mock_module):\n            if s == \"fastkafka._application.app\":\n                return m._application.app\n            elif s == \"fastkafka\":\n                return m._application.app\n            raise ModuleNotFoundError(s)\n\n        mock.import_module = import_module\n\n        yield\n
with mock_fastkafka():\n    m = importlib.import_module(\"fastkafka\")\n    print(m.FastKafka.__module__)\n    print(m.FastKafka.__qualname__)\n    assert m.FastKafka.__module__ == \"fastkafka\"\n    assert m.FastKafka.__qualname__ == \"FastKafka\"\n
fastkafka\nFastKafka\n
with mock_fastkafka():\n    m = importlib.import_module(\"fastkafka._application.app\")\n    print(m.FastKafka.__module__)\n    print(m.FastKafka.__qualname__)\n    assert m.FastKafka.__module__ == \"fastkafka\"\n    assert m.FastKafka.__qualname__ == \"FastKafka\"\n
fastkafka\nFastKafka\n
with mock_fastkafka():\n    fixture = \"fastkafka._application.app.FastKafka\"\n    expected = \"fastkafka.FastKafka\"\n\n    actual = _import_symbol(fixture)\n    print(actual)\n    print(actual.__module__ + \".\" + actual.__qualname__)\n    assert actual.__module__ + \".\" + actual.__qualname__ == expected\n
<MagicMock name='FastKafka' id='140320610827424'>\nfastkafka.FastKafka\n
with mock_fastkafka():\n    fixture = \"fastkafka._application.app.FastKafka.get_topics\"\n    expected = \"fastkafka._application.app.FastKafka.get_topics\"\n\n    actual = _import_symbol(fixture)\n    print(actual.__module__ + \".\" + actual.__qualname__)\n    assert actual.__module__ + \".\" + actual.__qualname__ == expected\n
fastkafka._application.app.FastKafka.get_topics\n
fixture = \"nbdev_mkdocs.mkdocs.prepare\"\nexpected = \"nbdev_mkdocs.mkdocs.prepare\"\n\nactual = _import_symbol(fixture)\nprint(actual.__module__ + \".\" + actual.__qualname__)\nassert actual.__module__ + \".\" + actual.__qualname__ == expected\n
nbdev_mkdocs.mkdocs.prepare\n
fixture = \"nbdev.doclinks.NbdevLookup.linkify\"\nexpected = \"nbdev.doclinks.NbdevLookup.linkify\"\n\nactual = _import_symbol(fixture)\nprint(actual.__module__ + \".\" + actual.__qualname__)\nassert actual.__module__ + \".\" + actual.__qualname__ == expected\n
nbdev.doclinks.NbdevLookup.linkify\n
with pytest.raises(ModuleNotFoundError) as e:\n    _import_symbol(\"invalid_package.module.symbol\")\nstr(e.value)\n
'ModuleNotFound: invalid_package.module.symbol'\n
docs_versioning = \"minor\"\nlib_version = \"2.3.4\"\nactual = _get_current_docs_version(docs_versioning, lib_version)\nexpected = \"2.3\"\n\nprint(actual)\nassert actual == expected\n
2.3\n
docs_versioning = \"patch\"\nlib_version = \"1.0.1\"\nactual = _get_current_docs_version(docs_versioning, lib_version)\nexpected = \"1.0.1\"\n\nprint(actual)\nassert actual == expected\n
1.0.1\n
docs_versioning = \"minor\"\nlib_version = \"1.0.1dev\"\nactual = _get_current_docs_version(docs_versioning, lib_version)\nexpected = \"1.0.1dev\"\n\nprint(actual)\nassert actual == expected\n
1.0.1dev\n
docs_versioning = \"patch\"\nlib_version = \"1.0.1rc0\"\nactual = _get_current_docs_version(docs_versioning, lib_version)\nexpected = \"1.0.1rc0\"\n\nprint(actual)\nassert actual == expected\n
1.0.1rc0\n
for docs_versioning in [\"minor\", \"patch\"]:\n    fixed_part = \"https://airtai.github.io/fastkafka\"\n    lib_version = \"0.0.1\"\n    use_latest_doc_version = True\n\n    expected = \"https://airtai.github.io/fastkafka/latest\"\n    actual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\n    print(actual)\n\n    assert actual == expected\n
https://airtai.github.io/fastkafka/latest\nhttps://airtai.github.io/fastkafka/latest\n
for docs_versioning in [\"\", \"None\"]:\n    fixed_part = \"https://airtai.github.io/fastkafka\"\n    lib_version = \"0.0.1\"\n    use_latest_doc_version = True\n\n    expected = \"https://airtai.github.io/fastkafka\"\n    actual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\n    print(actual)\n\n    assert actual == expected\n
https://airtai.github.io/fastkafka\nhttps://airtai.github.io/fastkafka\n
fixed_part = \"https://airtai.github.io/fastkafka\"\ndocs_versioning = \"\"\nlib_version = \"0.0.1\"\nuse_latest_doc_version = False\n\nexpected = \"https://airtai.github.io/fastkafka\"\nactual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\nprint(actual)\n\nassert actual == expected\n
https://airtai.github.io/fastkafka\n
fixed_part = \"https://airtai.github.io/fastkafka\"\ndocs_versioning = \"None\"\nlib_version = \"0.0.1\"\nuse_latest_doc_version = False\n\nexpected = \"https://airtai.github.io/fastkafka\"\nactual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\nprint(actual)\n\nassert actual == expected\n
https://airtai.github.io/fastkafka\n
fixed_part = \"https://airtai.github.io/fastkafka\"\ndocs_versioning = \"minor\"\nlib_version = \"0.1.0\"\nuse_latest_doc_version = False\n\nexpected = \"https://airtai.github.io/fastkafka/0.1\"\nactual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\nprint(actual)\n\nassert actual == expected\n
https://airtai.github.io/fastkafka/0.1\n
fixed_part = \"https://airtai.github.io/fastkafka\"\ndocs_versioning = \"patch\"\nlib_version = \"0.1.0\"\nuse_latest_doc_version = False\n\nexpected = \"https://airtai.github.io/fastkafka/0.1.0\"\nactual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\nprint(actual)\n\nassert actual == expected\n
https://airtai.github.io/fastkafka/0.1.0\n
o = _import_symbol(\"nbdev_mkdocs.mkdocs.prepare\")\nexpected = \"nbdev_mkdocs/mkdocs/prepare\"\n\nactual = _get_relative_sym_path(o)\nprint(actual)\nassert actual == expected\n
nbdev_mkdocs/mkdocs/prepare\n
with mock_fastkafka():\n    o = _import_symbol(\"fastkafka._application.app.FastKafka\")\n    expected = \"fastkafka/FastKafka\"\n\n    actual = _get_relative_sym_path(o)\n    print(actual)\n    assert actual == expected\n
fastkafka/FastKafka\n
with mock_fastkafka():\n    o = _import_symbol(\"fastkafka._application.app.FastKafka.get_topics\")\n    expected = \"fastkafka/FastKafka\"\n\n    actual = _get_relative_sym_path(o)\n    print(actual)\n    assert actual == expected\n
fastkafka/FastKafka\n
o = _import_symbol(\"nbdev.doclinks.NbdevLookup.linkify\")\nexpected = \"nbdev/doclinks/NbdevLookup\"\n\nactual = _get_relative_sym_path(o)\nprint(actual)\nassert actual == expected\n
nbdev/doclinks/NbdevLookup\n
o = _import_symbol(\"nbdev.doclinks.NbdevLookup\")\nexpected = \"nbdev/doclinks/NbdevLookup\"\n\nactual = _get_relative_sym_path(o)\nprint(actual)\nassert actual == expected\n
nbdev/doclinks/NbdevLookup\n
@contextmanager\ndef mock_fastkafka_nbdev_loopup():\n    syms = {\n        \"fastkafka._application.app.FastKafka\": (\n            \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka\",\n            \"fastkafka/_application/app.py\",\n            \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n        ),\n        \"fastkafka._application.app.FastKafka.get_topics\": (\n            \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka.get_topics\",\n            \"fastkafka/_application/app.py\",\n            \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n        ),\n    }\n    mock_entries = {\n        \"fastkafka\": {\n            \"syms\": {\n                \"fastkafka._application.app\": syms,\n            },\n            \"settings\": {\n                \"branch\": \"main\",\n                \"doc_baseurl\": \"/fastkafka\",\n                \"doc_host\": \"https://airtai.github.io\",\n                \"git_url\": \"https://github.com/airtai/fastkafka\",\n                \"lib_path\": \"fastkafka\",\n            },\n        }\n    }\n\n    nbdev_lookup = NbdevLookup(incl_libs=\"fastkafka\")\n    nbdev_lookup.entries = mock_entries\n    nbdev_lookup.syms = syms\n\n    yield nbdev_lookup\n
with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n    print(mock_nbdev_lookup[\"fastkafka._application.app.FastKafka\"])\n    assert mock_nbdev_lookup[\"fastkafka._application.app.FastKafka\"]\n
('https://airtai.github.io/fastkafka/fastkafka.html#fastkafka', 'fastkafka/_application/app.py', 'https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py')\n
expected = [\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/latest/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/latest/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n]\nwith mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n    with mock_fastkafka():\n        symbol = \"fastkafka.FastKafka.get_topics\"\n        symbol_details = (\n            \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka.get_topics\",\n            \"fastkafka/_application/app.py\",\n            \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n        )\n        docs_versioning = \"\"\n        lib_version = \"0.0.1\"\n\n        for i, docs_versioning in enumerate([\"\", \"None\", \"minor\", \"patch\"]):\n            actual = _update_link(\n                symbol,\n                symbol_details,\n                mock_nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                False,\n                True\n            )\n            print(actual)\n\n            assert actual == expected[i], actual\n
[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/latest/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/latest/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n
expected = [\n    \"[`fastkafka.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n]\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n        with mock_fastkafka():\n            symbol = \"fastkafka.FastKafka.get_topics\"\n            symbol_details = (\n                \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka.get_topics\",\n                \"fastkafka/_application/app.py\",\n                \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n            )\n            docs_versioning = \"\"\n            lib_version = \"0.0.1\"\n\n            for docs_versioning in [\"\", \"None\"]:\n                actual = _update_link(\n                    symbol,\n                    symbol_details,\n                    mock_nbdev_lookup,\n                    docs_versioning,\n                    lib_version,\n                    use_relative_doc_links,\n                    False\n                )\n                print(actual)\n\n                assert actual == expected[i], actual\n
[`fastkafka.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n
expected = [\n    \"[`fastkafka.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)\",\n    \"[`fastkafka.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)\",\n]\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n        with mock_fastkafka():\n            symbol = \"fastkafka.FastKafka\"\n            symbol_details = (\n                \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka\",\n                \"fastkafka/_application/app.py\",\n                \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n            )\n            docs_versioning = \"\"\n            lib_version = \"0.0.1\"\n\n            for docs_versioning in [\"\", \"None\"]:\n                actual = _update_link(\n                    symbol,\n                    symbol_details,\n                    mock_nbdev_lookup,\n                    docs_versioning,\n                    lib_version,\n                    use_relative_doc_links,\n                    False\n                )\n                print(actual)\n\n                assert actual == expected[i], actual\n
[`fastkafka.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)\n[`fastkafka.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)\n[`fastkafka.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)\n[`fastkafka.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)\n
expected = [\n    \"[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n    \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n]\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\n    symbol = \"nbdev_mkdocs.mkdocs.prepare\"\n    symbol_details = (\n        \"https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare\",\n        \"nbdev_mkdocs/mkdocs.py\",\n        \"https://github.com/airtai/nbdev-mkdocs/blob/main/nbdev_mkdocs/mkdocs.py\",\n    )\n    docs_versioning = \"patch\"\n    lib_version = \"0.0.1\"\n    actual = _update_link(\n        symbol,\n        symbol_details,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        False\n    )\n    print(actual)\n\n    assert actual == expected[i], actual\n
[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n
expected = [\n    \"[`prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n    \"[`prepare`](https://airtai.github.io/nbdev-mkdocs/0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n]\n\nnbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\nsymbol = \"prepare\"\nsymbol_details = (\n    \"https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare\",\n    \"nbdev_mkdocs/mkdocs.py\",\n    \"https://github.com/airtai/nbdev-mkdocs/blob/main/nbdev_mkdocs/mkdocs.py\",\n)\ndocs_versioning = \"minor\"\nlib_version = \"0.1.0\"\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    actual = _update_link(\n        symbol,\n        symbol_details,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        False,\n    )\n    print(actual)\n\n    assert actual == expected[i], actual\n
[`prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`prepare`](https://airtai.github.io/nbdev-mkdocs/0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\nsymbol = \"nbdev_mkdocs.mkdocs.prepare\"\nsymbol_details = (\n    \"https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare\",\n    \"nbdev_mkdocs/mkdocs.py\",\n    \"https://github.com/airtai/nbdev-mkdocs/blob/main/nbdev_mkdocs/mkdocs.py\",\n)\n\nlib_version = \"0.0.1rc0\"\nuse_relative_doc_links = False\n\nfor docs_versioning in [\"minor\", \"patch\"]:\n    actual = _update_link(\n        symbol,\n        symbol_details,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        False\n    )\n\n    expected = \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1rc0/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    print(actual)\n\n    assert actual == expected, actual\n\nuse_relative_doc_links = True\nfor docs_versioning in [\"minor\", \"patch\"]:\n    actual = _update_link(\n        symbol,\n        symbol_details=symbol_details,\n        nbdev_lookup=nbdev_lookup,\n        docs_versioning=docs_versioning,\n        lib_version=lib_version,\n        use_relative_doc_links=use_relative_doc_links,\n        use_latest_doc_version=False\n    )\n\n    expected = \"[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    print(actual)\n\n    assert actual == expected, actual\n
[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1rc0/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1rc0/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n

source

"},{"location":"Doc_Links_Utils/#fix_sym_links","title":"fix_sym_links","text":"
 fix_sym_links (s:str,\n                nbdev_lookup:<functools._lru_cache_wrapperobjectat0x7f5e6b\n                1187c0>, docs_versioning:str, lib_version:str,\n                use_relative_doc_links:bool,\n                use_latest_doc_version:bool=False)\n

Fix the default sym links generated by nbdev in the given string.

Args: s: The string to fix nbdev_lookup: Instance of the NbdevLookup class. docs_versioning: The value set for docs_versioning flag in settings.ini file. lib_version: The current version of the library. use_relative_doc_links: If set to True, relative link to symbols will be add in the generated documentation for easier local navigation. use_latest_doc_version: If set to True, the latest version of the docs will be appended to the symbol link.

Returns: The string with correct links added to the symbol references.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Type Default Details s str nbdev_lookup NbdevLookup docs_versioning str lib_version str use_relative_doc_links bool use_latest_doc_version bool False Returns str type: ignore
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\ndocs_versioning = \"patch\"\nlib_version = \"0.1.1\"\n\nuse_relative_doc_links = False\nuse_latest_doc_version = True\nfor symbol in [\"prepare\", \"nbdev_mkdocs.mkdocs.prepare\"]:\n    fixture = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n    expected = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    actual = fix_sym_links(\n        fixture,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        use_latest_doc_version,\n    )\n    display(actual)\n    assert actual == expected\n\n\nfixture = f\"This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\nexpected = f\"This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\nfor docs_versioning in [\"\", \"None\"]:\n    actual = fix_sym_links(\n        fixture,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        use_latest_doc_version,\n    )\n    display(actual)\n    assert actual == expected, expected\n
'This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\ndocs_versioning = \"patch\"\nlib_version = \"0.1.1\"\n\nuse_relative_doc_links = False\nfor symbol in [\"prepare\", \"nbdev_mkdocs.mkdocs.prepare\"]:\n    fixture = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n    expected = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/0.1.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    actual = fix_sym_links(\n        fixture, nbdev_lookup, docs_versioning, lib_version, use_relative_doc_links\n    )\n    display(actual)\n    assert actual == expected\n\nuse_relative_doc_links = True\nfor symbol in [\"prepare\", \"nbdev_mkdocs.mkdocs.prepare\"]:\n    fixture = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n    expected = f\"This is a link to a symbol: [`{symbol}`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    actual = fix_sym_links(\n        fixture, nbdev_lookup, docs_versioning, lib_version, use_relative_doc_links\n    )\n    display(actual)\n    assert actual == expected\n
'This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/0.1.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.1.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n
# Tests for external links\n\nnbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\ndocs_versioning = \"None\"\nlib_version = \"0.1.1\"\n\nuse_relative_doc_links = False\nfor external_link in [\n    \"[`google`](https://www.google.com/)\",\n    \"[`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)\",\n]:\n    fixture = f\"Link to external link, do not modify: {external_link}\"\n    expected = f\"Link to external link, do not modify: {external_link}\"\n\n    actual = fix_sym_links(\n        fixture, nbdev_lookup, docs_versioning, lib_version, use_relative_doc_links\n    )\n    display(actual)\n    assert actual == expected, actual\n\nuse_relative_doc_links = True\nfor external_link in [\n    \"[`google`](https://www.google.com/)\",\n    \"[`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)\",\n]:\n    fixture = f\"Link to external link, do not modify: {external_link}\"\n    expected = f\"Link to external link, do not modify: {external_link}\"\n\n    actual = fix_sym_links(\n        fixture, nbdev_lookup, docs_versioning, lib_version, use_relative_doc_links\n    )\n    display(actual)\n    assert actual == expected, actual\n
'Link to external link, do not modify: [`google`](https://www.google.com/)'\n\n'Link to external link, do not modify: [`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)'\n\n'Link to external link, do not modify: [`google`](https://www.google.com/)'\n\n'Link to external link, do not modify: [`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)'\n
docs_versioning = \"None\"\nlib_version = \"0.1.1\"\nfixture = \"This is a link to a symbol: [`fastkafka._application.app.FastKafka`](https://airtai.github.io/fastkafka/fastkafka.html#fastkafka)\"\nexpected = [\n    \"This is a link to a symbol: [`fastkafka._application.app.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)\",\n    \"This is a link to a symbol: [`fastkafka._application.app.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)\",\n]\nfor i, use_relative_doc_links in enumerate([True, False]):\n    with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n        with mock_fastkafka():\n            actual = fix_sym_links(\n                fixture,\n                mock_nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                use_relative_doc_links,\n            )\n            display(actual)\n            assert actual == expected[i]\n
'This is a link to a symbol: [`fastkafka._application.app.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)'\n\n'This is a link to a symbol: [`fastkafka._application.app.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)'\n
docs_versioning = \"None\"\nlib_version = \"0.1.1\"\n\nfixture = \"This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](https://airtai.github.io/fastkafka/fastkafka.html#fastkafka)\"\nexpected = [\n    \"This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n]\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n        with mock_fastkafka():\n            actual = fix_sym_links(\n                fixture,\n                mock_nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                use_relative_doc_links,\n            )\n            display(actual)\n            assert actual == expected[i]\n
'This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)'\n\n'This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)'\n
"},{"location":"Docstring/","title":"Docstring helpers","text":"
import numpy as np\nimport pytest\n
logger.warning(\"xs\")\n
WARNING:__main__:xs\n
def f(i: str, *, a: int = 0):\n    \"\"\"Very cool function\n\n    **f** is a very cool function\n\n    Args:\n        i: something\n        a: something else\n\n    Example:\n        The following snippet prints out greetings for two names:\n        ```python\n        print(\"hello {fill in name_1}\")\n        print(\"goodbye {fill in name_2}\")\n        ```\n\n\n    Example:\n        Yet another example\n        ```python\n        password = {fill in password}\n        print(f\"this is your password: {password}\")\n\n\n        from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n        print(\"Logging in...\")\n        ```\n\n    \"\"\"\n    raise NotImplemented()\n
def g():\n    \"\"\"Function\n\n    Example:\n        ```python\n        from airt.helpers import print_header\n\n        print(\"hello world\")\n        ```\n\n    Example:\n        ``` python\n        from nbdev_mkdocs._package_data import get_root_data_path\n\n        req_path = get_root_data_path() / \"requirements.txt\"\n        print(f\"Path is: {req_path.resolve()}\")\n        assert req_path.exists()\n        ```\n    \"\"\"\n\n\n_extract_examples_from_docstring(g)\n
['\\nfrom airt.helpers import print_header\\n\\nprint(\"hello world\")\\n',\n '\\nfrom nbdev_mkdocs._package_data import get_root_data_path\\n\\nreq_path = get_root_data_path() / \"requirements.txt\"\\nprint(f\"Path is: {req_path.resolve()}\")\\nassert req_path.exists()\\n']\n
_extract_examples_from_docstring(f)\n
['\\nprint(\"hello {fill in name_1}\")\\nprint(\"goodbye {fill in name_2}\")\\n',\n '\\npassword = {fill in password}\\nprint(f\"this is your password: {password}\")\\n\\n\\nfrom  nbdev_mkdocs.docstring import run_examples_from_docstring\\n\\nprint(\"Logging in...\")\\n']\n
expected = [\n    textwrap.dedent(\n        \"\"\"\n            print(\"hello {fill in name_1}\")\n            print(\"goodbye {fill in name_2}\")\n        \"\"\"\n    ),\n    textwrap.dedent(\n        \"\"\"\n            password = {fill in password}\n            print(f\"this is your password: {password}\")\n\n\n            from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n            print(\"Logging in...\")\n        \"\"\"\n    ),\n]\n\nexamples = _extract_examples_from_docstring(f)\nfor example in examples:\n    print(example)\n\nnp.testing.assert_array_equal(examples, expected)\n
\nprint(\"hello {fill in name_1}\")\nprint(\"goodbye {fill in name_2}\")\n\n
\npassword = {fill in password}\nprint(f\"this is your password: {password}\")\n\n\nfrom  nbdev_mkdocs.docstring import run_examples_from_docstring\n\nprint(\"Logging in...\")\n\n
examples[0] == expected[0]\n
True\n
expected = [\"name_1\", \"name_2\", \"password\"]\n\nkeywords = _get_keywords(examples)\n\nnp.testing.assert_array_equal(keywords, expected)\n
expected = [\n    textwrap.dedent(\n        \"\"\"\n            print(\"hello davor\")\n            print(\"goodbye kumaran\")\n        \"\"\"\n    ),\n    textwrap.dedent(\n        \"\"\"\n            password = 'not_a_password'\n            print(f\"this is your password: {password}\")\n\n\n            from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n            print(\"Logging in...\")\n        \"\"\"\n    ),\n]\n\nactual = _replace_keywords(\n    examples, name_1=\"davor\", name_2=\"kumaran\", password=\"'not_a_password'\"\n)\nfor x in actual:\n    print(x)\n\nnp.testing.assert_array_equal(actual, expected)\n
\nprint(\"hello davor\")\nprint(\"goodbye kumaran\")\n\n
\npassword = 'not_a_password'\nprint(f\"this is your password: {password}\")\n\n\nfrom  nbdev_mkdocs.docstring import run_examples_from_docstring\n\nprint(\"Logging in...\")\n\n
width = 80\n\nconsole = Console(width=width)\n# panel = Panel(\ng = Group(\n    Rule(\"Code\"),\n    'print(\"stuff\")',\n    _format_output(\"hello world and one more time world\", title=\"output\", width=width),\n    _format_output(\n        \"hello world and one more time world\",\n        title=\"output\",\n        sub_dict={\"world\": \"*****\"},\n        width=width,\n    ),\n    _format_output(\n        \"hello world and one more time world\",\n        title=\"output\",\n        sub_dict={\"world\": \"*****\"},\n        supress=True,\n        width=width,\n    ),\n)  # ,\n#     title=\"Test: _format_output()\",\n#     width=width\n# )\n# console.print(panel)\nconsole.print(g)\n
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 Code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nprint(\"stuff\")\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 output \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nhello world and one more time world\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 output \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nhello ***** and one more time *****\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 output supressed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nN/A\n

source

"},{"location":"Docstring/#run_examples_from_docstring","title":"run_examples_from_docstring","text":"
 run_examples_from_docstring (o:Any, supress_stdout:bool=False,\n                              supress_stderr:bool=False,\n                              sub_dict:Optional[Dict[str,str]]=None,\n                              width:Optional[int]=80, **kwargs:str)\n

Runs example from a docstring

Parses docstring of an objects looking for examples. The examples are then saved into files and executed in a separate process.

Note: Execution context is not the same as the one in the notebook because we want examples to work from user code. Make sure you compiled the library prior to executing the examples, otherwise you might be running them agains an old version of the library.

Args: o: an object, typically a function or a class, for which docstring is being parsed for examples supress_stdout: omit stdout from output, typically due to security considerations supress_stderr: omit stderr from output, typically due to security considerations sub_dict: a dictionary mapping regexp patterns into replacement strings used to mask stdout and stderr, typically used to mask sensitive information such as passwords

**kwargs: arguments use to replace \"{fill in **param**}\" in docstring with the actual values when running examples\n

Raises: ValueError: if some params are missing from the kwargs RuntimeException: if example fails

Example: ```python from nbdev_mkdocs.docstring import run_examples_from_docstring

def f():\n    ```python\n    Example:\n        print(\"Hello {fill in name}!\")\n        print(\"Goodbye {fill in other_name}!\")\n    ```\n    pass\n\nrun_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")\n```\n

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

print(run_examples_from_docstring.__doc__)\n
Runs example from a docstring\n\n    Parses docstring of an objects looking for examples. The examples are then saved into files and executed\n    in a separate process.\n\n    Note:\n        Execution context is not the same as the one in the notebook because we want examples to work from\n        user code. Make sure you compiled the library prior to executing the examples, otherwise you might\n        be running them agains an old version of the library.\n\n    Args:\n        o: an object, typically a function or a class, for which docstring is being parsed for examples\n        supress_stdout: omit stdout from output, typically due to security considerations\n        supress_stderr: omit stderr from output, typically due to security considerations\n        sub_dict: a dictionary mapping regexp patterns into replacement strings used to mask stdout and\n            stderr, typically used to mask sensitive information such as passwords\n\n        **kwargs: arguments use to replace \"{fill in **param**}\" in docstring with the actual values when running \nexamples\n\n    Raises:\n        ValueError: if some params are missing from the **kwargs**\n        RuntimeException: if example fails\n\n    Example:\n        ```python\n        from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n        def f():\n            
Example:\n    <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">print</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008000; text-decoration-color: #008000\">\"Hello {fill in name}!\"</span><span style=\"font-weight: bold\">)</span>\n    <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">print</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008000; text-decoration-color: #008000\">\"Goodbye {fill in other_name}!\"</span><span style=\"font-weight: bold\">)</span>\n
\n pass\n\n\n run_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")\n ```\n\n !!! note\n\n The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n \n
examples = _extract_examples_from_docstring(run_examples_from_docstring)\n\nconsole = Console(width=80)\nconsole.print(Panel(examples[0]))\n
ERROR:griffe.agents.nodes:Failed to parse annotation from 'Name' node: 'NoneType' object has no attribute 'resolve'\nERROR:griffe.agents.nodes:Failed to parse annotation from 'Name' node: 'NoneType' object has no attribute 'resolve'\n
\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502                                                                              \u2502\n\u2502 from  nbdev_mkdocs.docstring import run_examples_from_docstring              \u2502\n\u2502                                                                              \u2502\n\u2502 def f():                                                                     \u2502\n\u2502     ```python                                                                \u2502\n\u2502     Example:                                                                 \u2502\n\u2502         print(\"Hello {fill in name}!\")                                       \u2502\n\u2502         print(\"Goodbye {fill in other_name}!\")                               \u2502\n\u2502     ```                                                                      \u2502\n\u2502     pass                                                                     \u2502\n\u2502                                                                              \u2502\n\u2502                                                                              \u2502\n\u2502 run_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")               \u2502\n\u2502                                                                              \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n
run_examples_from_docstring(\n    f,\n    name_1=\"davor\",\n    name_2=\"all\",\n    password='\"zeko\"',\n    supress_stderr=True,\n    sub_dict={\"zeko\": \"*\" * 12},\n)\n
Example:\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n    print(\"hello {fill in name_1}\")\n    print(\"goodbye {fill in name_2}\")\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stdout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nhello davor\ngoodbye all\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stderr supressed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nN/A\n
Example:\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n    password = {fill in password}\n    print(f\"this is your password: {password}\")\n\n\n    from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n    print(\"Logging in...\")\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stdout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nthis is your password: ************\nLogging in...\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stderr supressed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nN/A\n
with pytest.raises(ValueError) as e:\n    run_examples_from_docstring(f, name_1=\"davor\")\n\ne.value\n
ValueError(\"{'name_2', 'password', 'name_1'} > {'name_1'}\")\n
class C:\n    \"\"\"Cool class with broken example\n\n    Example:\n        ```python\n        from nbdev_mkdocs.docstring import run_examples_from_docstring\n\n        raise NotImplementedError(\"expected to fail\")\n        ```\n    \"\"\"\n\n    pass\n
with pytest.raises(RuntimeError) as e:\n    run_examples_from_docstring(C)\ne.value\n
Example:\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n    from nbdev_mkdocs.docstring import run_examples_from_docstring\n\n    raise NotImplementedError(\"expected to fail\")\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stdout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stderr \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nTraceback (most recent call last):\n  File \n\"/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpzpgw9w14/example.py\", line \n4, in <module>\n    raise NotImplementedError(\"expected to fail\")\nNotImplementedError: expected to fail\n\n
RuntimeError('Traceback (most recent call last):\\n  File \"/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpzpgw9w14/example.py\", line 4, in <module>\\n    raise NotImplementedError(\"expected to fail\")\\nNotImplementedError: expected to fail\\n')\n
from nbdev_mkdocs._package_data import get_root_data_path\n
print(get_root_data_path.__doc__)\n
Returns path to package_data in lib\n\n    Example:\n        ``` python\n        from nbdev_mkdocs._package_data import get_root_data_path\n\n        mkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\n        print(f\"Path is: {mkdocs_template_path.resolve()}\")\n        assert mkdocs_template_path.exists()\n\n        ```\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \n
_extract_examples_from_docstring(get_root_data_path)\n
['\\nfrom nbdev_mkdocs._package_data import get_root_data_path\\n\\nmkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\\nprint(f\"Path is: {mkdocs_template_path.resolve()}\")\\nassert mkdocs_template_path.exists()\\n\\n']\n
"},{"location":"Mkdocs/","title":"Mkdocs","text":"
import asyncio\nimport json\nimport random\nimport string\nimport unittest.mock\nfrom contextlib import contextmanager\nfrom tempfile import TemporaryDirectory\nfrom unittest.mock import patch\nfrom inspect import getsource, getsourcefile\n\nimport numpy as np\nimport pytest\nfrom fastcore.imports import IN_NOTEBOOK\nfrom nbdev.config import nbdev_create_config\nfrom nbdev.quarto import nbdev_readme\nfrom ruamel.yaml import YAML\nimport nbformat\n\nfrom nbdev_mkdocs.social_image_generator import _read_yaml_file\n
"},{"location":"Mkdocs/#create-new","title":"Create new","text":""},{"location":"Mkdocs/#create-mkdocs-dir","title":"Create mkdocs dir","text":"
with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    _create_mkdocs_dir(d)\n\n    print(\"\\n\".join([str(p) for p in (Path(d) / \"mkdocs\").glob(\"**/*\")]))\n
Directory /tmp/tmpwr9ip3mc/mkdocs created.\n/tmp/tmpwr9ip3mc/mkdocs/site_overrides\n/tmp/tmpwr9ip3mc/mkdocs/docs\n/tmp/tmpwr9ip3mc/mkdocs/site\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides\n/tmp/tmpwr9ip3mc/mkdocs/site_overrides/main.html\n/tmp/tmpwr9ip3mc/mkdocs/site_overrides/partials\n/tmp/tmpwr9ip3mc/mkdocs/site_overrides/partials/copyright.html\n/tmp/tmpwr9ip3mc/mkdocs/docs/images\n/tmp/tmpwr9ip3mc/mkdocs/docs/images/.ipynb_checkpoints\n/tmp/tmpwr9ip3mc/mkdocs/site/assets\n/tmp/tmpwr9ip3mc/mkdocs/site/assets/.ipynb_checkpoints\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/images\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/js\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/css\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/images/compass-outline.png\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/images/default_social_logo.png\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/js/extra.js\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/js/mathjax.js\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/css/extra.css\n
"},{"location":"Mkdocs/#create-mkdocsyml","title":"Create Mkdocs.yml","text":"
assert _mkdocs_template_path.exists()\n
print(_mkdocs_template)\n
# Site\nsite_name: {title}\nsite_url: {doc_host}{doc_baseurl}\nsite_author: {author}\nsite_description: {description}\n\n# Repository\nrepo_name: {repo}\nrepo_url: {git_url}\nedit_uri: \"\"\n\ncopyright: {copyright}\n\ndocs_dir: docs\nsite_dir: site\n\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n            - https://docs.python.org/3/objects.inv\n        options:\n            heading_level: 2\n            show_category_heading: true\n            show_root_heading: true\n            show_root_toc_entry: true\n            show_signature_annotations: true\n            show_if_no_docstring: true\n\nmarkdown_extensions:\n    - md_in_html\n    - pymdownx.arithmatex:\n        generic: true\n    - pymdownx.inlinehilite\n    - pymdownx.details\n    - pymdownx.emoji\n    - pymdownx.magiclink\n    - pymdownx.superfences:\n        custom_fences:\n          - name: mermaid\n            class: mermaid\n            format: !!python/name:pymdownx.superfences.fence_code_format\n    - pymdownx.tasklist\n    - pymdownx.highlight:\n        linenums: false\n    - pymdownx.snippets:\n        check_paths: true\n    - pymdownx.tabbed:\n        alternate_style: true\n    - admonition\n    - toc:\n        permalink: \"\u00a4\"\n#     - callouts\n\ntheme:\n  name: material\n  custom_dir: site_overrides\n  features:\n    - navigation.instant\n#     - navigation.tabs\n#     - navigation.tabs.sticky\n#     - navigation.sections\n#     - navigation.expand\n    - navigation.indexes\n    - navigation.top\n#     - toc.integrates\n    - search.suggest\n    - search.highlight\n    - search.share\n  palette:\n    - scheme: slate\n      primary: black\n      accent: yellow\n      toggle:\n        icon: material/toggle-switch\n        name: Switch to light mode\n    - scheme: default\n      primary: black # deep orange\n      accent: red\n      toggle:\n        icon: material/toggle-switch-off-outline\n        name: Switch to dark mode\n  icon:\n    repo: fontawesome/brands/github\n#     repo: fontawesome/brands/gitlab\n    logo: material/compass-outline\n#     admonition:\n#         <type>: <icon> \n  favicon: overrides/images/compass-outline.png\n\nextra_css:\n  - overrides/css/extra.css\n\nextra_javascript:\n  - overrides/js/extra.js\n  - overrides/js/mathjax.js\n  - https://polyfill.io/v3/polyfill.min.js?features=es6\n  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js  \nextra:\n  version:\n    provider: mike\n  social_image: \"\"\n
with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    kwargs = _get_kwargs_from_settings(settings_path)\n\n    actual = _mkdocs_template.format(**kwargs)\n\nkwargs\n
{'title': 'nbdev-mkdocs',\n 'doc_host': 'https://airtai.github.io',\n 'doc_baseurl': '/nbdev-mkdocs',\n 'author': 'airt',\n 'description': 'Extension of nbdev for generating documentation using Material for Mkdocs instead of Quarto',\n 'repo': 'nbdev-mkdocs',\n 'git_url': 'https://github.com/airtai/nbdev-mkdocs',\n 'copyright': '2022 onwards, airt'}\n
with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    _create_mkdocs_yaml(d)\n\n#     !cat {d}/mkdocs/mkdocs.yml\n
File '/tmp/tmpc7rr0nih/mkdocs/mkdocs.yml' generated.\n
"},{"location":"Mkdocs/#create-summary_templatetxt","title":"Create summary_template.txt","text":"
with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    _create_mkdocs_yaml(d)\n    _create_summary_template(d)\n\n    sidebar = \"\"\"- [Home](index.md)\n- Guides\n    - [Guide one](docs/guide_1.md)\n- Tutorial\n    - [Tutorial one](docs/tutorial_1.md)\"\"\"\n\n    api = \"\"\"    - [numpy.array](api/numpy/array.md)\"\"\"\n\n    cli = \"\"\"    - [my-cli](cli/my_cli.md)\"\"\"\n\n    changelog = \"(CHANGELOG.md)\"\n\n    with open((Path(d) / \"mkdocs/summary_template.txt\"), \"r\", encoding=\"utf-8\") as f:\n        summary_template = f.read()\n        actual = summary_template.format(\n            sidebar=sidebar, api=api, cli=cli, changelog=changelog\n        )\n\nexpected = \"\"\"- [Home](index.md)\n- Guides\n    - [Guide one](docs/guide_1.md)\n- Tutorial\n    - [Tutorial one](docs/tutorial_1.md)\n- API\n    - [numpy.array](api/numpy/array.md)\n- CLI\n    - [my-cli](cli/my_cli.md)\n- [Releases](CHANGELOG.md)\n\"\"\"\nprint(actual)\n\nassert actual == expected, actual\n
File '/tmp/tmp0g5s2f4t/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp0g5s2f4t/mkdocs/summary_template.txt' generated.\n- [Home](index.md)\n- Guides\n    - [Guide one](docs/guide_1.md)\n- Tutorial\n    - [Tutorial one](docs/tutorial_1.md)\n- API\n    - [numpy.array](api/numpy/array.md)\n- CLI\n    - [my-cli](cli/my_cli.md)\n- [Releases](CHANGELOG.md)\n
with TemporaryDirectory() as d:\n    assert not (Path(d) / \".github\" / \"workflows\" / \"deploy.yaml\").exists()\n    _replace_ghp_deploy_action(d)\n    assert (Path(d) / \".github\" / \"workflows\" / \"deploy.yaml\").exists()\n
@contextmanager\ndef unset_env_var(name: str):\n    \"\"\"Unset an environment variable.\n\n    Args:\n        name: The name of the environment variable to unset.\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    in_test_defined = name in os.environ\n    if in_test_defined:\n        original_value = os.environ.get(name)\n        del os.environ[name]\n    try:\n        yield\n    finally:\n        if in_test_defined:\n            os.environ[name] = original_value\n\n\ndef run_nbdev_new(d, random_string: str = None):\n    \"\"\"Run nbdev_new\n\n    Args:\n        d: the directory to run nbdev_new in\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    Path(Path(d) / \"nbs\").mkdir(exist_ok=True)\n\n    # Create a sample .gitignore file\n    gitignore_path = Path(d) / \".gitignore\"\n    sample_git_ignore = (\n        \"_docs/\"\n        \"_proc/\\n\"\n        \"*.bak\\n\"\n        \"# Byte-compiled / optimized / DLL files\\n\"\n        \"__pycache__/\"\n    )\n\n    with gitignore_path.open(\"w\", encoding=\"utf-8\") as f:\n        f.write(sample_git_ignore)\n\n    assert gitignore_path.exists()\n\n    # copy nbdev-mkdocs/nbs/index.ipynb folder to {d}/nbs/index.ipynb\n    for fname in [\"index.ipynb\"]:\n        shutil.copyfile(path / \"nbs\" / fname, Path(d) / \"nbs\" / fname)\n\n    # copy config files from nbdev-mkdocs/ to {d}/\n    for fname in [\"setup.py\"]:\n        shutil.copyfile(path / fname, Path(d) / fname)\n\n    # Generate settings.ini using nbdev in {d}\n    with set_cwd(d):\n        repo = f\"repo_{random_string}\" if random_string != None else \"repo\"\n        nbdev_create_config(\n            repo=repo,\n            branch=\"branch\",\n            user=\"user\",\n            author=\"author\",\n            author_email=\"author@mail.com\",\n            description=\"description\",\n        )\n        refresh_quarto_yml()\n\n        with unset_env_var(\"IN_TEST\"):\n            nbdev_export.__wrapped__()\n\n        nbdev_readme.__wrapped__(chk_time=True)\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n    assert (Path(d) / \"repo\").exists()\n\n    gitignore_path = Path(d) / \".gitignore\"\n\n    with open(gitignore_path, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n        assert \"mkdocs/docs/\" not in contents\n        assert \"mkdocs/site/\" not in contents\n\n    _update_gitignore_file(d)\n\n    with open(gitignore_path, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n        print(contents)\n        assert \"mkdocs/docs/\" in contents\n        assert \"mkdocs/site/\" in contents\n
settings.ini created.\n_docs/_proc/\n*.bak\n# Byte-compiled / optimized / DLL files\n__pycache__/\n\n# nbdev_mkdocs\nmkdocs/docs/\nmkdocs/site/\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    _create_mkdocs_dir(d)\n    _create_mkdocs_yaml(d)\n    _create_summary_template(d)\n    _replace_ghp_deploy_action(d)\n    _update_gitignore_file(d)\n\n    _generate_default_social_image_link(d)\n\n    def _f():\n        with _read_yaml_file(Path(d) / \"mkdocs/mkdocs.yml\") as (yaml, config):\n            print(config)\n            assert config[\"extra\"][\"social_image\"] != \"\"\n\n    _f()\n
settings.ini created.\nDirectory /tmp/tmp3t28sqwd/mkdocs created.\nFile '/tmp/tmp3t28sqwd/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp3t28sqwd/mkdocs/summary_template.txt' generated.\n{'site_name': 'repo', 'site_url': 'https://user.github.io/repo', 'site_author': 'author', 'site_description': 'description', 'repo_name': 'repo', 'repo_url': 'https://github.com/user/repo', 'edit_uri': '', 'copyright': '2023 onwards, author', 'docs_dir': 'docs', 'site_dir': 'site', 'plugins': [{'literate-nav': {'nav_file': 'SUMMARY.md'}}, 'search', {'mkdocstrings': {'handlers': {'python': {'import': ['https://docs.python.org/3/objects.inv'], 'options': {'heading_level': 2, 'show_category_heading': True, 'show_root_heading': True, 'show_root_toc_entry': True, 'show_signature_annotations': True, 'show_if_no_docstring': True}}}}}], 'markdown_extensions': ['md_in_html', {'pymdownx.arithmatex': {'generic': True}}, 'pymdownx.inlinehilite', 'pymdownx.details', 'pymdownx.emoji', 'pymdownx.magiclink', {'pymdownx.superfences': {'custom_fences': [{'name': 'mermaid', 'class': 'mermaid', 'format': <ruamel.yaml.comments.TaggedScalar object>}]}}, 'pymdownx.tasklist', {'pymdownx.highlight': {'linenums': False}}, {'pymdownx.snippets': {'check_paths': True}}, {'pymdownx.tabbed': {'alternate_style': True}}, 'admonition', {'toc': {'permalink': '\u00a4'}}], 'theme': {'name': 'material', 'custom_dir': 'site_overrides', 'features': ['navigation.instant', 'navigation.indexes', 'navigation.top', 'search.suggest', 'search.highlight', 'search.share'], 'palette': [{'scheme': 'slate', 'primary': 'black', 'accent': 'yellow', 'toggle': {'icon': 'material/toggle-switch', 'name': 'Switch to light mode'}}, {'scheme': 'default', 'primary': 'black', 'accent': 'red', 'toggle': {'icon': 'material/toggle-switch-off-outline', 'name': 'Switch to dark mode'}}], 'icon': {'repo': 'fontawesome/brands/github', 'logo': 'material/compass-outline'}, 'favicon': 'overrides/images/compass-outline.png'}, 'extra_css': ['overrides/css/extra.css'], 'extra_javascript': ['overrides/js/extra.js', 'overrides/js/mathjax.js', 'https://polyfill.io/v3/polyfill.min.js?features=es6', 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'], 'extra': {'version': {'provider': 'mike'}, 'social_image': 'https://opengraph.githubassets.com/1688963841.721823/user/repo'}}\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
"},{"location":"Mkdocs/#bringing-it-all-together","title":"Bringing it all together","text":"

source

"},{"location":"Mkdocs/#new","title":"new","text":"
 new (root_path:str)\n

Initialize mkdocs project files

Creates mkdocs directory in the root_path directory and populates it with initial values. You should edit mkdocs.yml file to customize it if needed.

Args: root_path: The path to the root of the project

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    new(d)\n\n    mkdocs_path = Path(d) / \"mkdocs\"\n\n    assert mkdocs_path.exists()\n    assert (mkdocs_path / \"mkdocs.yml\").exists()\n    assert (mkdocs_path / \"site_overrides\" / \"main.html\").exists()\n    assert (mkdocs_path / \"site_overrides\" / \"partials\" / \"copyright.html\").exists()\n    assert (mkdocs_path / \"summary_template.txt\").exists()\n\n    gitignore_path = Path(d) / \".gitignore\"\n    with open(gitignore_path, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n        print(contents)\n        assert \"mkdocs/docs/\" in contents\n        assert \"mkdocs/site/\" in contents\n\n    def _f():\n        with _read_yaml_file(Path(d) / \"mkdocs/mkdocs.yml\") as (yaml, config):\n            print(config)\n            assert config[\"extra\"][\"social_image\"] != \"\"\n\n    _f()\n
settings.ini created.\nDirectory /tmp/tmpjort0ypv/mkdocs created.\nFile '/tmp/tmpjort0ypv/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpjort0ypv/mkdocs/summary_template.txt' generated.\n_docs/_proc/\n*.bak\n# Byte-compiled / optimized / DLL files\n__pycache__/\n\n# nbdev_mkdocs\nmkdocs/docs/\nmkdocs/site/\n{'site_name': 'repo', 'site_url': 'https://user.github.io/repo', 'site_author': 'author', 'site_description': 'description', 'repo_name': 'repo', 'repo_url': 'https://github.com/user/repo', 'edit_uri': '', 'copyright': '2023 onwards, author', 'docs_dir': 'docs', 'site_dir': 'site', 'plugins': [{'literate-nav': {'nav_file': 'SUMMARY.md'}}, 'search', {'mkdocstrings': {'handlers': {'python': {'import': ['https://docs.python.org/3/objects.inv'], 'options': {'heading_level': 2, 'show_category_heading': True, 'show_root_heading': True, 'show_root_toc_entry': True, 'show_signature_annotations': True, 'show_if_no_docstring': True}}}}}], 'markdown_extensions': ['md_in_html', {'pymdownx.arithmatex': {'generic': True}}, 'pymdownx.inlinehilite', 'pymdownx.details', 'pymdownx.emoji', 'pymdownx.magiclink', {'pymdownx.superfences': {'custom_fences': [{'name': 'mermaid', 'class': 'mermaid', 'format': <ruamel.yaml.comments.TaggedScalar object>}]}}, 'pymdownx.tasklist', {'pymdownx.highlight': {'linenums': False}}, {'pymdownx.snippets': {'check_paths': True}}, {'pymdownx.tabbed': {'alternate_style': True}}, 'admonition', {'toc': {'permalink': '\u00a4'}}], 'theme': {'name': 'material', 'custom_dir': 'site_overrides', 'features': ['navigation.instant', 'navigation.indexes', 'navigation.top', 'search.suggest', 'search.highlight', 'search.share'], 'palette': [{'scheme': 'slate', 'primary': 'black', 'accent': 'yellow', 'toggle': {'icon': 'material/toggle-switch', 'name': 'Switch to light mode'}}, {'scheme': 'default', 'primary': 'black', 'accent': 'red', 'toggle': {'icon': 'material/toggle-switch-off-outline', 'name': 'Switch to dark mode'}}], 'icon': {'repo': 'fontawesome/brands/github', 'logo': 'material/compass-outline'}, 'favicon': 'overrides/images/compass-outline.png'}, 'extra_css': ['overrides/css/extra.css'], 'extra_javascript': ['overrides/js/extra.js', 'overrides/js/mathjax.js', 'https://polyfill.io/v3/polyfill.min.js?features=es6', 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'], 'extra': {'version': {'provider': 'mike'}, 'social_image': 'https://opengraph.githubassets.com/1688963843.640516/user/repo'}}\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
"},{"location":"Mkdocs/#build","title":"Build","text":""},{"location":"Mkdocs/#build-markdown-files","title":"Build markdown files","text":"
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    (Path(d) / \"_proc\" / \"guides\").mkdir(exist_ok=True)\n    (Path(d) / \"_proc\" / \"blogs\").mkdir(exist_ok=True)\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    _nbs_path = _root_path / \"nbs\" / \"Mkdocs.ipynb\"\n    shutil.copyfile(_nbs_path, Path(d) / \"_proc\" / \"Mkdocs.ipynb\")\n\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n\n    for i in [\"guides\", \"blogs\"]:\n        (Path(d) / \"_proc\" / f\"{i}\" / \".ipynb_checkpoints\").mkdir(exist_ok=True)\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"index.ipynb\",\n            Path(d) / \"_proc\" / f\"{i}\" / f\"{i}_index.ipynb\",\n        )\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"sample.qmd\",\n            Path(d) / \"_proc\" / f\"{i}\" / f\"qmd_{i}.qmd\",\n        )\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"index.ipynb\",\n            Path(d) / \"_proc\" / f\"{i}\" / \".ipynb_checkpoints\" / f\"{i}_index.ipynb\",\n        )\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"index.ipynb\",\n            Path(d) / \"_proc\" / f\"{i}\" / f\"_{i}_index.ipynb\",\n        )\n\n    new(d)\n\n    with set_cwd(d):\n        nbs = _get_files_to_convert_to_markdown(Path(d))\n\n    nbs = [str(nb) for nb in nbs]\n    print(nbs)\n\n    assert f\"{d}/_proc/index.ipynb\" in nbs\n    assert f\"{d}/_proc/guides/guides_index.ipynb\" in nbs\n    assert f\"{d}/_proc/blogs/qmd_blogs.qmd\" in nbs\n    assert f\"{d}/_proc/Mkdocs.ipynb\" in nbs\n\n    assert f\"{d}/_proc/_quarto.yml\" not in nbs\n    assert f\"{d}/_proc/guides/.ipynb_checkpoints/guides_index.ipynb\" not in nbs\n    assert f\"{d}/_proc/blogs/.ipynb_checkpoints/blogs_index.ipynb\" not in nbs\n
settings.ini created.\nDirectory /tmp/tmpos6fs4vt/mkdocs created.\nFile '/tmp/tmpos6fs4vt/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpos6fs4vt/mkdocs/summary_template.txt' generated.\n['/tmp/tmpos6fs4vt/_proc/Mkdocs.ipynb', '/tmp/tmpos6fs4vt/_proc/index.ipynb', '/tmp/tmpos6fs4vt/_proc/guides/_guides_index.ipynb', '/tmp/tmpos6fs4vt/_proc/guides/guides_index.ipynb', '/tmp/tmpos6fs4vt/_proc/guides/qmd_guides.qmd', '/tmp/tmpos6fs4vt/_proc/blogs/qmd_blogs.qmd', '/tmp/tmpos6fs4vt/_proc/blogs/_blogs_index.ipynb', '/tmp/tmpos6fs4vt/_proc/blogs/blogs_index.ipynb', '/tmp/tmpos6fs4vt/nbs/sample.qmd', '/tmp/tmpos6fs4vt/nbs/index.ipynb']\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    (Path(d) / \"nbs\" / \"guides\").mkdir(exist_ok=True)\n    (Path(d) / \"nbs\" / \"blogs\").mkdir(exist_ok=True)\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    _nbs_path = _root_path / \"nbs\" / \"Mkdocs.ipynb\"\n    shutil.copyfile(_nbs_path, Path(d) / \"nbs\" / \"Mkdocs.ipynb\")\n\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n\n    for i in [\"guides\", \"blogs\"]:\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"index.ipynb\",\n            Path(d) / \"nbs\" / f\"{i}\" / f\"{i}_index.ipynb\",\n        )\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"sample.qmd\",\n            Path(d) / \"nbs\" / f\"{i}\" / f\"qmd_{i}.qmd\",\n        )\n\n    test_nbs = Path(d) / \"nbs\" / \"test.ipynb\"\n    shutil.copyfile(\n        _root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\",\n        test_nbs\n    )\n\n    new(d)\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    _generate_markdown_from_files(d, cache_path)\n\n    # check markdown files\n    print(\"Checks:\")\n    mds = list((Path(d) / \"mkdocs\" / \"docs\").glob(\"**/*.md\"))\n    mds = [str(md) for md in mds]\n    print(\"\\n\".join(mds))\n    assert len(mds) > 0, len(mds)\n\n    for i in [\n        \"index.md\",\n        \"sample.md\",\n        \"guides/guides_index.md\",\n        \"guides/qmd_guides.md\",\n        \"blogs/blogs_index.md\",\n        \"blogs/qmd_blogs.md\",\n        \"Mkdocs.md\",\n    ]:\n        assert f\"{d}/mkdocs/docs/{i}\" in mds, f\"{d}/mkdocs/docs/{i}\"\n\n    with open(Path(d) / \"_proc\" / \"test.ipynb\", \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n\ndisplay(contents)\nassert '{markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}' in contents\nassert not '{markdown=1 .content-visible when-format=\"\\\\markdown\\\\\"}' in contents\n\nassert \"mermaid\" in contents\nassert not \"{mermaid}\" in contents\n\nassert '{markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}' in contents\nassert not '{markdown=1 .content-visible when-format=\\\\\"html\\\\\"}' in contents\n\nassert \".callout-note\" not in contents\nassert \".callout-tip\"  not in contents\nassert 'title=\"Tip with Title\"' not in contents\nassert 'collapse=\"true\"' not in contents\nassert 'collapse=\"false\"' not in contents\nassert 'icon=false' not in contents\nassert 'appearance=\"minimal' not in contents\n
settings.ini created.\nDirectory /tmp/tmpnqzgey9d/mkdocs created.\nFile '/tmp/tmpnqzgey9d/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpnqzgey9d/mkdocs/summary_template.txt' generated.\nChecks:\n/tmp/tmpnqzgey9d/mkdocs/docs/sample.md\n/tmp/tmpnqzgey9d/mkdocs/docs/index.md\n/tmp/tmpnqzgey9d/mkdocs/docs/test.md\n/tmp/tmpnqzgey9d/mkdocs/docs/Mkdocs.md\n/tmp/tmpnqzgey9d/mkdocs/docs/guides/qmd_guides.md\n/tmp/tmpnqzgey9d/mkdocs/docs/guides/guides_index.md\n/tmp/tmpnqzgey9d/mkdocs/docs/blogs/qmd_blogs.md\n/tmp/tmpnqzgey9d/mkdocs/docs/blogs/blogs_index.md\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Mkdocs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Create new\n\nOutput created: _docs/Mkdocs.md\n\npandoc -o sample.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Sample\n  author: Sample\n\nOutput created: _docs/sample.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o test.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: test.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Callouts\n\nOutput created: _docs/test.md\n\npandoc -o ../guides_index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: guides_index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/guides_index.md\n\npandoc -o ../qmd_guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Sample\n  author: Sample\n\nOutput created: ../_docs/qmd_guides.md\n\npandoc -o ../qmd_blogs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Sample\n  author: Sample\n\nOutput created: ../_docs/qmd_blogs.md\n\npandoc -o ../blogs_index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: blogs_index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/blogs_index.md\n\n'{\\n \"cells\": [\\n  {\\n   \"cell_type\": \"raw\",\\n   \"id\": \"6fc63aee\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"---\\\\n\",\\n    \"output-file: test.html\\\\n\",\\n    \"title: Callouts\\\\n\",\\n    \"\\\\n\",\\n    \"---\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"bd6c141d\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8ee6e33a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"This notebook is used to test the conversion of Quarto to Material for MkDocs syntax. It serves as a fixture to verify the syntax, including callouts, Mermaid charts, and making a section hidden, which differ between Quarto and Material for MkDocs.\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"d0a10ffc\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note\\\\n\",\\n    \"\\\\n\",\\n    \"    Note that there are five types of callouts, including:\\\\n\",\\n    \"    `note`, `warning`, `important`, `tip`, and `caution`.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"22014eb3\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"870e17d7\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"87f34d1a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"??? caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"4a8ac79c\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"???+ caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"034f6dbb\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8f79c54d\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ec9209a4\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"## Mermaid Charts and visibility\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"0a820438\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in markdown.\\\\n\",\\n    \"\\\\n\",\\n    \":::\\\\n\",\\n    \"\\\\n\",\\n    \"``` mermaid\\\\n\",\\n    \"flowchart LR\\\\n\",\\n    \"    A[Hard edge] --> B(Round edge)\\\\n\",\\n    \"    B --> C{Decision}\\\\n\",\\n    \"    C --> D[Result one]\\\\n\",\\n    \"    C --> E[Result two]\\\\n\",\\n    \"```\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ebd24225\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in html.\\\\n\",\\n    \"\\\\n\",\\n    \":::\"\\n   ]\\n  }\\n ],\\n \"metadata\": {\\n  \"kernelspec\": {\\n   \"display_name\": \"Python 3 (ipykernel)\",\\n   \"language\": \"python\",\\n   \"name\": \"python3\"\\n  },\\n  \"language_info\": {\\n   \"codemirror_mode\": {\\n    \"name\": \"ipython\",\\n    \"version\": 3\\n   },\\n   \"file_extension\": \".py\",\\n   \"mimetype\": \"text/x-python\",\\n   \"name\": \"python\",\\n   \"nbconvert_exporter\": \"python\",\\n   \"pygments_lexer\": \"ipython3\",\\n   \"version\": \"3.11.2\"\\n  },\\n  \"widgets\": {\\n   \"application/vnd.jupyter.widget-state+json\": {\\n    \"state\": {},\\n    \"version_major\": 2,\\n    \"version_minor\": 0\\n   }\\n  }\\n },\\n \"nbformat\": 4,\\n \"nbformat_minor\": 5\\n}'\n
text = \"\"\"![Git Repo_Clone_Page](images/nbs/../images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/../images/circles.svg\" />\n<img src=\"https://documentation.divio.com/_images/overview.png\" />\n\"\"\"\n\nexpected = \"\"\"![Git Repo_Clone_Page](images/nbs/../images/nbs/images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](../images/nbs/guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/../../images/nbs/images/circles.svg\" />\n<img src=\"https://documentation.divio.com/_images/overview.png\" />\n\"\"\"\n\ndir_prefix = \"guides\"\nactual = _replace_all(text, dir_prefix)\nprint(actual)\nassert actual == expected, actual\n\ntext = \"\"\"![Git Repo_Clone_Page](images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/images/nbs/images/marie-curie-notebook.jpg\" class=\"rounded preview-image\"\nalt=\"Photo of an opened research notebook with diagrams and writing in French\" />\n\"\"\"\n\nexpected = \"\"\"![Git Repo_Clone_Page](images/nbs/images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](images/nbs/guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/images/nbs/images/nbs/images/marie-curie-notebook.jpg\" class=\"rounded preview-image\"\nalt=\"Photo of an opened research notebook with diagrams and writing in French\" />\n\"\"\"\n\ndir_prefix = \"\"\nactual = _replace_all(text, dir_prefix)\nprint(actual)\nassert actual == expected, actual\n
![Git Repo_Clone_Page](images/nbs/../images/nbs/images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](../images/nbs/guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/../../images/nbs/images/circles.svg\" />\n<img src=\"https://documentation.divio.com/_images/overview.png\" />\n\n![Git Repo_Clone_Page](images/nbs/images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](images/nbs/guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/images/nbs/images/nbs/images/marie-curie-notebook.jpg\" class=\"rounded preview-image\"\nalt=\"Photo of an opened research notebook with diagrams and writing in French\" />\n
def copy_guides(src, dst):\n    \"\"\"Copy guides from one directory to another.\n\n    Args:\n        src: Source directory\n        dst: Destination directory\n\n    Raises:\n        AssertionError: If src does not exist\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    src = Path(src)\n    dst = Path(dst)\n    assert src.exists()\n    src_guides = src / \"nbs\" / \"guides\"\n    src_guides_len = len(src_guides.parts)\n\n    dst_guides = dst / \"nbs\" / \"guides\"\n\n    for ext in [\".ipynb\", \".png\", \".jpeg\", \".jpg\"]:\n        for src_f in src_guides.glob(f\"**/*{ext}\"):\n            dst_parts = dst_guides.parts + src_f.parts[src_guides_len:]\n            dst_f = Path(*dst_parts)\n            dst_f.parent.mkdir(exist_ok=True, parents=True)\n\n            print(f\"{src_f}, {dst_f}\")\n            shutil.copyfile(src_f, dst_f)\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    copy_guides(_root_path, d)\n    shutil.copytree((Path(d) / \"nbs\" / \"guides\"), (Path(d) / \"nbs\" / \"blogs\"))\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    new(d)\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    _generate_markdown_from_files(root_path=d, cache_path=cache_path)\n    _copy_images_to_docs_dir(d, cache_path)\n\n    # check image files\n    print(\"Checks for images:\")\n    imgs = list((Path(d) / \"mkdocs\" / \"docs\" / \"images\" / \"nbs\").glob(\"**/*.*\"))\n    print(\"\\n\".join([str(img) for img in imgs]))\n    assert len(imgs) > 0, len(imgs)\n\n    # check markdown files\n    print(\"Checks for markdown:\")\n    mds = list((Path(d) / \"mkdocs\" / \"docs\").glob(\"**/*.md\"))\n    print(\"\\n\".join([str(md) for md in mds]))\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"index.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"Mkdocs.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"Social_Image_Generator.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"guides\" / \"Basic_User_Guide.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"blogs\" / \"Basic_User_Guide.md\").exists()\n\n    with open(\n        (Path(d) / \"mkdocs\" / \"docs\" / \"blogs\" / \"Basic_User_Guide.md\"),\n        \"r\", encoding=\"utf-8\"\n    ) as f:\n        contents = f.read()\n        assert (\n            \"![Empty Git Repo](images/nbs/../images/nbs/blogs/images/empty_git_repo.png)\"\n            in contents\n        )\n        assert (\n            \"![Git Repo_Clone_Page](../images/nbs/blogs/images/nbs/images/git_repo_clone_page.png)\"\n            in contents\n        )\n        assert \"![](images/nbs/../images/nbs/blogs/images/jupyter_home.png)\" in contents\n\n    (\n        Path(d)\n        / \"mkdocs\"\n        / \"docs\"\n        / \"images\"\n        / \"nbs\"\n        / \"blogs\"\n        / \"images\"\n        / \"jupyter_home.png\"\n    ).exists()\n    (\n        Path(d)\n        / \"mkdocs\"\n        / \"docs\"\n        / \"images\"\n        / \"nbs\"\n        / \"guides\"\n        / \"images\"\n        / \"empty_git_repo.png\"\n    ).exists()\n\n    print(\"OK.\")\n
settings.ini created.\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmp2uwgyvn_/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmp2uwgyvn_/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmp2uwgyvn_/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmp2uwgyvn_/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmp2uwgyvn_/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmp2uwgyvn_/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmp2uwgyvn_/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmp2uwgyvn_/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmp2uwgyvn_/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmp2uwgyvn_/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmp2uwgyvn_/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmp2uwgyvn_/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmp2uwgyvn_/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmp2uwgyvn_/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmp2uwgyvn_/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmp2uwgyvn_/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmp2uwgyvn_/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmp2uwgyvn_/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_1.png\nDirectory /tmp/tmp2uwgyvn_/mkdocs created.\nFile '/tmp/tmp2uwgyvn_/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp2uwgyvn_/mkdocs/summary_template.txt' generated.\nChecks for images:\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/enable_gh_pages.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_notebook.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/jupyter_home.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/releases_default.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/doc_versioning.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/foo_doc_string.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/docstring-gen-extension-btn.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/releases.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/cli_not_found.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/empty_git_repo.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/nbs/images/git_repo_clone_page.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/set_github_token_permission.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/hello_class.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/say_hello.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_2.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_4.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/sidebar_2.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_3.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/CLI_command.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/sidebar_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/enable_gh_pages.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_notebook.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/jupyter_home.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/releases_default.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/doc_versioning.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/foo_doc_string.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/docstring-gen-extension-btn.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/releases.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/cli_not_found.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/empty_git_repo.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/nbdev_mkdocs_preview_light_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/nbs/images/git_repo_clone_page.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/set_github_token_permission.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/hello_class.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/say_hello.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_2.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_4.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/sidebar_2.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_3.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/CLI_command.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/sidebar_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/nbdev_mkdocs_preview_dark_1.png\nChecks for markdown:\n/tmp/tmp2uwgyvn_/mkdocs/docs/index.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/Mkdocs.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/Social_Image_Generator.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Setting_Up_Document_Versioning.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Auto_Generating_Docstrings.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Handling_Pandas_In_The_Output.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Advanced_Customization_Options.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Adding_Guides.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Basic_User_Guide.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Customizing_The_Sidebar.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Adding_Release_Notes.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Setting_up_social_cards.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Setting_Up_Document_Versioning.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Auto_Generating_Docstrings.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Handling_Pandas_In_The_Output.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Advanced_Customization_Options.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Adding_Guides.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Basic_User_Guide.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Customizing_The_Sidebar.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Adding_Release_Notes.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Setting_up_social_cards.md\nOK.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Social_Image_Generator.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nOutput created: _docs/Social_Image_Generator.md\n\npandoc -o Mkdocs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Create new\n\nOutput created: _docs/Mkdocs.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n
"},{"location":"Mkdocs/#build-summary-for-guides","title":"Build summary for guides","text":"
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    copy_guides(_root_path, d)\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n\n    new(d)\n\n    cmd = f'cd \"{d}\" && nbdev_docs'\n    _sprun(cmd)\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    _generate_markdown_from_files(d, cache_path)\n\n    nb_paths = [\n        Path(\"index.ipynb\"),\n        Path(\"sample.qmd\"),\n        Path(\"Mkdocs.ipynb\"),\n        Path(\"Social_Image_Generator.ipynb\"),\n        Path(\"guides/Basic_User_Guide.ipynb\"),\n    ]\n\n    expected = [\n        \"Material for nbdev\",\n        \"Sample\",\n        \"Create new\",\n        \"Social_Image_Generator.html\",\n        \"Basic User Guide\",\n    ]\n    actual = []\n    for nb_path in nb_paths:\n        actual.append(_get_title_from_notebook(cache_path, nb_path))\n\n    print(actual)\n\n    assert actual == expected\n
settings.ini created.\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmplo_f4akn/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmplo_f4akn/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmplo_f4akn/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmplo_f4akn/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmplo_f4akn/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmplo_f4akn/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmplo_f4akn/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmplo_f4akn/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmplo_f4akn/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmplo_f4akn/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmplo_f4akn/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmplo_f4akn/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmplo_f4akn/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmplo_f4akn/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmplo_f4akn/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmplo_f4akn/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmplo_f4akn/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmplo_f4akn/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmplo_f4akn/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmplo_f4akn/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmplo_f4akn/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmplo_f4akn/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmplo_f4akn/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmplo_f4akn/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmplo_f4akn/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmplo_f4akn/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmplo_f4akn/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_1.png\nDirectory /tmp/tmplo_f4akn/mkdocs created.\nFile '/tmp/tmplo_f4akn/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmplo_f4akn/mkdocs/summary_template.txt' generated.\n['Material for nbdev', 'Sample', 'Create new', 'Social_Image_Generator.html', 'Basic User Guide']\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[ 1/13] guides/Setting_Up_Document_Versioning.ipynb\n[ 2/13] guides/Auto_Generating_Docstrings.ipynb\n[ 3/13] guides/Advanced_Customization_Options.ipynb\n[ 4/13] guides/Adding_Guides.ipynb\n[ 5/13] guides/Basic_User_Guide.ipynb\n[ 6/13] guides/Setting_up_social_cards.ipynb\n[ 7/13] guides/Adding_Release_Notes.ipynb\n[ 8/13] guides/Handling_Pandas_In_The_Output.ipynb\n[ 9/13] guides/Customizing_The_Sidebar.ipynb\n[10/13] Social_Image_Generator.ipynb\n[11/13] Mkdocs.ipynb\n[12/13] sample.qmd\n[13/13] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Social_Image_Generator.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nOutput created: _docs/Social_Image_Generator.md\n\npandoc -o Mkdocs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Create new\n\nOutput created: _docs/Mkdocs.md\n\npandoc -o sample.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Sample\n  author: Sample\n\nOutput created: _docs/sample.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n    new(d)\n\n    with set_cwd(d):\n        sidebar = _read_sidebar_from_yml(d)\n    print(sidebar)\n    assert sidebar == [\"index.ipynb\", \"sample.qmd\"]\n
settings.ini created.\nDirectory /tmp/tmp2u2qwr0m/mkdocs created.\nFile '/tmp/tmp2u2qwr0m/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp2u2qwr0m/mkdocs/summary_template.txt' generated.\n['index.ipynb', 'sample.qmd']\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with pytest.raises(typer.Exit) as e:\n    with TemporaryDirectory() as d:\n        run_nbdev_new(d)\n\n        new(d)\n\n        updater = ConfigUpdater()\n        updater.read(Path(d) / \"settings.ini\")\n        updater[\"DEFAULT\"][\"custom_sidebar\"] = True\n        updater.update_file()\n        with set_cwd(d):\n            _read_sidebar_from_yml(d)\n\nprint(\"OK\")\n
settings.ini created.\nDirectory /tmp/tmp3ks9qy2p/mkdocs created.\nFile '/tmp/tmp3ks9qy2p/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp3ks9qy2p/mkdocs/summary_template.txt' generated.\nOK\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\nKey Error: Contents of the sidebar are not defined in the files sidebar.yml or _quarto.yml.\n
_sidebar = \"\"\"- auto: \\\"/*.ipynb\\\"\n- section: Blogs\n  contents: blogs/*\n- section: Guides\n  contents: guides/*\n- section: Explanations\n  contents:\n  - explanations/explanation_1.ipynb\n  - explanations/explanation_2.ipynb\n\"\"\"\n\nexpected = [\n    \"getting_started.ipynb\",\n    \"index.ipynb\",\n    {\"section\": \"Blogs\", \"contents\": [\"blogs/blogs_1.ipynb\", \"blogs/blogs_2.ipynb\"]},\n    {\n        \"section\": \"Guides\",\n        \"contents\": [\"guides/guides_1.ipynb\", \"guides/guides_2.ipynb\"],\n    },\n    {\n        \"section\": \"Explanations\",\n        \"contents\": [\n            \"explanations/explanation_1.ipynb\",\n            \"explanations/explanation_2.ipynb\",\n        ],\n    },\n]\n\n\nwith TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    shutil.copyfile(\n        Path(d) / \"nbs\" / \"index.ipynb\", Path(d) / \"nbs\" / \"getting_started.ipynb\"\n    )\n\n    for dir_name in [\"guides\", \"blogs\", \"explanations\"]:\n        (Path(d) / \"nbs\" / dir_name).mkdir(parents=True)\n        for i in [f\"{dir_name}_1\", f\"{dir_name}_2\"]:\n            shutil.copyfile(\n                Path(d) / \"nbs\" / \"index.ipynb\",\n                (Path(d) / \"nbs\" / f\"{dir_name}\" / f\"{i}.ipynb\"),\n            )\n\n    new(d)\n\n    # update _quarto.yml file\n    _quarto_yml_path = Path(d) / \"nbs\" / \"_quarto.yml\"\n    _yaml = YAML()\n    config = _yaml.load(_quarto_yml_path)\n    config[\"website\"][\"sidebar\"][\"contents\"] = _yaml.load(_sidebar)\n    _yaml.dump(config, _quarto_yml_path)\n\n    # Set the custom_sidebar flag to True\n    updater = ConfigUpdater()\n    updater.read(Path(d) / \"settings.ini\")\n    updater[\"DEFAULT\"][\"custom_sidebar\"] = True\n    updater.update_file()\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    _generate_markdown_from_files(d, cache_path)\n    _copy_images_to_docs_dir(d, cache_path)\n\n    sidebar = _read_sidebar_from_yml(d)\n\n    actual = _expand_sidebar_if_needed(d, sidebar)\n\n    print(actual)\n    assert actual == expected, actual\n
settings.ini created.\nDirectory /tmp/tmp9i22pms5/mkdocs created.\nFile '/tmp/tmp9i22pms5/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp9i22pms5/mkdocs/summary_template.txt' generated.\n['getting_started.ipynb', 'index.ipynb', {'section': 'Blogs', 'contents': ['blogs/blogs_1.ipynb', 'blogs/blogs_2.ipynb']}, {'section': 'Guides', 'contents': ['guides/guides_1.ipynb', 'guides/guides_2.ipynb']}, {'section': 'Explanations', 'contents': ['explanations/explanation_1.ipynb', 'explanations/explanation_2.ipynb']}]\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\npandoc -o getting_started.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: getting_started.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/getting_started.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../explanations_2.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: explanations_2.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/explanations_2.md\n\npandoc -o ../explanations_1.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: explanations_1.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/explanations_1.md\n\npandoc -o ../guides_1.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: guides_1.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/guides_1.md\n\npandoc -o ../guides_2.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: guides_2.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/guides_2.md\n\npandoc -o ../blogs_1.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: blogs_1.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/blogs_1.md\n\npandoc -o ../blogs_2.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: blogs_2.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/blogs_2.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    (Path(d) / \"nbs\" / \"api\").mkdir(parents=True)\n    shutil.copyfile(\n        Path(d) / \"nbs\" / \"Mkdocs.ipynb\", (Path(d) / \"nbs\" / \"api\" / \"Mkdocs.ipynb\")\n    )\n\n    for dir_name in [\"guides\", \"blogs\"]:\n        (Path(d) / \"nbs\" / dir_name).mkdir(parents=True)\n        for i in [f\"{dir_name}_1\", f\"{dir_name}_2\"]:\n            shutil.copyfile(\n                Path(d) / \"nbs\" / \"index.ipynb\",\n                (Path(d) / \"nbs\" / f\"{dir_name}\" / f\"{i}.ipynb\"),\n            )\n\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n\n    new(d)\n    with set_cwd(d):\n        cache_path = proc_nbs()\n        sidebar = _read_sidebar_from_yml(d)\n        expanded_sidebar = _expand_sidebar_if_needed(d, sidebar)\n        assert expanded_sidebar == [\n            \"index.ipynb\",\n            \"Mkdocs.ipynb\",\n            \"Social_Image_Generator.ipynb\",\n            \"sample.qmd\",\n            {\"section\": \"api\", \"contents\": [\"api/Mkdocs.ipynb\"]},\n            {\n                \"section\": \"blogs\",\n                \"contents\": [\"blogs/blogs_1.ipynb\", \"blogs/blogs_2.ipynb\"],\n            },\n            {\n                \"section\": \"guides\",\n                \"contents\": [\"guides/guides_1.ipynb\", \"guides/guides_2.ipynb\"],\n            },\n        ]\n\n        actual = _generate_nav_from_sidebar(expanded_sidebar, cache_path)\n        print(actual)\n\n        expected = \"\"\"- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- [Sample](sample.md)\n- api\n    - [Create new](api/Mkdocs.md)\n- blogs\n    - [Material for nbdev](blogs/blogs_1.md)\n    - [Material for nbdev](blogs/blogs_2.md)\n- guides\n    - [Material for nbdev](guides/guides_1.md)\n    - [Material for nbdev](guides/guides_2.md)\n\"\"\"\n\n        assert actual == expected, actual\n
settings.ini created.\nDirectory /tmp/tmpysresvr1/mkdocs created.\nFile '/tmp/tmpysresvr1/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpysresvr1/mkdocs/summary_template.txt' generated.\n- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- [Sample](sample.md)\n- api\n    - [Create new](api/Mkdocs.md)\n- blogs\n    - [Material for nbdev](blogs/blogs_1.md)\n    - [Material for nbdev](blogs/blogs_2.md)\n- guides\n    - [Material for nbdev](guides/guides_1.md)\n    - [Material for nbdev](guides/guides_2.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    (Path(d) / \"nbs\" / \"api\").mkdir(parents=True)\n    shutil.copyfile(\n        Path(d) / \"nbs\" / \"Mkdocs.ipynb\", (Path(d) / \"nbs\" / \"api\" / \"Mkdocs.ipynb\")\n    )\n\n    for dir_name in [\"guides\", \"blogs\"]:\n        (Path(d) / \"nbs\" / dir_name).mkdir(parents=True)\n        for i in [f\"{dir_name}_1\", f\"{dir_name}_2\"]:\n            shutil.copyfile(\n                Path(d) / \"nbs\" / \"index.ipynb\",\n                (Path(d) / \"nbs\" / f\"{dir_name}\" / f\"{i}.ipynb\"),\n            )\n\n    cmd = f'cd \"{d}\" && nbdev_sidebar'\n    print(f\"executing the command: {cmd}\")\n    _sprun(cmd)\n\n    new(d)\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    actual = _generate_summary_for_sidebar(d, cache_path)\n\n    print(actual)\n\n    expected = \"\"\"- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- api\n    - [Create new](api/Mkdocs.md)\n- blogs\n    - [Material for nbdev](blogs/blogs_1.md)\n    - [Material for nbdev](blogs/blogs_2.md)\n- guides\n    - [Material for nbdev](guides/guides_1.md)\n    - [Material for nbdev](guides/guides_2.md)\n\"\"\"\n    assert actual == expected, actual\n
settings.ini created.\nexecuting the command: cd \"/tmp/tmpeuyda8ic\" && nbdev_sidebar\nDirectory /tmp/tmpeuyda8ic/mkdocs created.\nFile '/tmp/tmpeuyda8ic/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpeuyda8ic/mkdocs/summary_template.txt' generated.\n- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- api\n    - [Create new](api/Mkdocs.md)\n- blogs\n    - [Material for nbdev](blogs/blogs_1.md)\n    - [Material for nbdev](blogs/blogs_2.md)\n- guides\n    - [Material for nbdev](guides/guides_1.md)\n    - [Material for nbdev](guides/guides_2.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n    new(d)\n\n    cli_summary = _copy_not_found_file_and_get_path(d, \"cli_commands\")\n    print(cli_summary)\n\n    _dst_path = Path(d) / \"mkdocs\" / \"docs\"\n    assert cli_summary == \" \" * 4 + \"- [Not found](cli_commands_not_found.md)\"\n    assert (_dst_path / \"cli_commands_not_found.md\").exists()\n
settings.ini created.\nDirectory /tmp/tmpwg2o4jh3/mkdocs created.\nFile '/tmp/tmpwg2o4jh3/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpwg2o4jh3/mkdocs/summary_template.txt' generated.\n    - [Not found](cli_commands_not_found.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
"},{"location":"Mkdocs/#build-api","title":"Build API","text":"
# os.environ[\"NBDEV_MKDOCS_PATCH_IMPORTLIB\"] = \"true\"\n\n# submodules = _get_submodules(\"repo\")\n# submodules\n
@contextmanager\ndef add_tmp_path_to_sys_path(dir_):\n    \"\"\"Add a temporary path to sys.path\n\n    Args:\n        dir_ : the path to add to sys.path\n\n    Returns:\n        None\n\n    Raises:\n        ValueError: If dir_ is None\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    dir_ = Path(dir_).absolute().resolve(strict=True)\n    original_path = sys.path[:]\n    sys.path.insert(0, str(dir_))\n    try:\n        yield\n    finally:\n        sys.path = original_path\n\n\nwith TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n    new(d)\n\n    _module = f\"repo_{random_string}\"\n    with set_cwd(d):\n        with unset_env_var(\"IN_TEST\"):\n            nbdev_export.__wrapped__()\n\n    !ls {d}/repo\n\n    with add_tmp_path_to_sys_path(d):\n        api_summary = _get_submodules(_module)\n\n    print(api_summary)\n\n    assert api_summary == [f\"repo_{random_string}\"] + [\n        f\"repo_{random_string}.mkdocs\",\n        f\"repo_{random_string}.social_image_generator\",\n    ]\n
settings.ini created.\nDirectory /tmp/tmpvc_b5bcf/mkdocs created.\nFile '/tmp/tmpvc_b5bcf/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpvc_b5bcf/mkdocs/summary_template.txt' generated.\nls: cannot access '/tmp/tmpvc_b5bcf/repo': No such file or directory\n['repo_jxajlswxkq', 'repo_jxajlswxkq.mkdocs', 'repo_jxajlswxkq.social_image_generator']\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
@contextmanager\ndef set_numpy_experimental_dtype_env_var():\n    if sys.version_info >= (3,9):\n        original_value = os.environ.get(\"NUMPY_EXPERIMENTAL_DTYPE_API\", None)\n        os.environ[\"NUMPY_EXPERIMENTAL_DTYPE_API\"] = \"1\"\n        try:\n            yield\n        finally:\n            if original_value == None:\n                del os.environ[\"NUMPY_EXPERIMENTAL_DTYPE_API\"]\n            else:\n                os.environ[\"NUMPY_EXPERIMENTAL_DTYPE_API\"] = original_value\n    else:\n        yield\n\n\nwith set_numpy_experimental_dtype_env_var():\n    numpy_submodels = _import_submodules(\"numpy\")\n
WARN: Could not locate executable icc\nWARN: Could not locate executable ecc\n\n/usr/lib/python3.8/pkgutil.py:92: UserWarning: The numpy.array_api submodule is still experimental. See NEP 47.\n  __import__(info.name)\n
actual = _import_submodules(\"nbdev_mkdocs\")\nactual = [x.__name__ for x in actual]\n\nexpected = [\n    \"nbdev_mkdocs\",\n    \"nbdev_mkdocs.docstring\",\n    \"nbdev_mkdocs.mkdocs\",\n    \"nbdev_mkdocs.social_image_generator\",\n]\ndisplay(actual)\nassert all([i in actual for i in expected])\n
['nbdev_mkdocs',\n 'nbdev_mkdocs.docstring',\n 'nbdev_mkdocs.mkdocs',\n 'nbdev_mkdocs.social_image_generator']\n
xys = _import_functions_and_classes(asyncio)\ndisplay(xys[:5])\n\nactual = [x for x, _ in xys]\n\nassert set([\"run\", \"sleep\", \"BaseEventLoop\"]).issubset(set(actual))\n
[('AbstractChildWatcher', asyncio.unix_events.AbstractChildWatcher),\n ('AbstractEventLoop', asyncio.events.AbstractEventLoop),\n ('AbstractEventLoopPolicy', asyncio.events.AbstractEventLoopPolicy),\n ('AbstractServer', asyncio.events.AbstractServer),\n ('BaseEventLoop', asyncio.base_events.BaseEventLoop)]\n
assert _is_private(\"asyncio.base_events._SendfileFallbackProtocol\")\nassert not _is_private(\"asyncio.base_events.SendfileFallbackProtocol\")\n
members = _import_all_members(\"numpy\")\nmembers[:5], members[-5:]\n
(['numpy.AxisError',\n  'numpy.ComplexWarning',\n  'numpy.DataSource',\n  'numpy.ModuleDeprecationWarning',\n  'numpy.RankWarning'],\n ['numpy.typing.tests.test_typing.test_code_runs',\n  'numpy.typing.tests.test_typing.test_extended_precision',\n  'numpy.typing.tests.test_typing.test_fail',\n  'numpy.typing.tests.test_typing.test_reveal',\n  'numpy.typing.tests.test_typing.test_success'])\n
members = [\n    \"module.B\",\n    \"module.EventMetadata\",\n    \"module.KafkaEvent\",\n    \"module.a\",\n    \"module.x\",\n    \"module.encoder.AvroBase\",\n    \"module.encoder.avro_decoder\",\n    \"module.encoder.json_encoder\",\n    \"module.executors.DynamicTaskExecutor\",\n    \"module.executors.SequentialExecutor\",\n    \"module.testing.ApacheKafkaBroker\",\n    \"module.testing.LocalRedpandaBroker\",\n]\n\nexpected = [\n    \"module.\",\n    \"module.B\",\n    \"module.EventMetadata\",\n    \"module.KafkaEvent\",\n    \"module.a\",\n    \"module.x\",\n    \"module.encoder.\",\n    \"module.encoder.AvroBase\",\n    \"module.encoder.avro_decoder\",\n    \"module.encoder.json_encoder\",\n    \"module.executors.\",\n    \"module.executors.DynamicTaskExecutor\",\n    \"module.executors.SequentialExecutor\",\n    \"module.testing.\",\n    \"module.testing.ApacheKafkaBroker\",\n    \"module.testing.LocalRedpandaBroker\",\n]\nactual = _add_all_submodules(members)\nprint(actual)\nassert actual == expected, actual\n
['module.', 'module.B', 'module.EventMetadata', 'module.KafkaEvent', 'module.a', 'module.x', 'module.encoder.', 'module.encoder.AvroBase', 'module.encoder.avro_decoder', 'module.encoder.json_encoder', 'module.executors.', 'module.executors.DynamicTaskExecutor', 'module.executors.SequentialExecutor', 'module.testing.', 'module.testing.ApacheKafkaBroker', 'module.testing.LocalRedpandaBroker']\n
members = [\"a.b\", \"a.x\", \"a.c.d\", \"a.e.d\"]\nexpected = [\"a.\", \"a.b\", \"a.x\", \"a.c.\", \"a.c.d\", \"a.e.\", \"a.e.d\"]\nactual = _add_all_submodules(members)\nprint(actual)\nassert actual == expected, actual\n
['a.', 'a.b', 'a.x', 'a.c.', 'a.c.d', 'a.e.', 'a.e.d']\n
members = [\"a.b\", \"a.c\", \"a.e.d\", \"a.e.f\", \"a.e.f\"]\nexpected = [\"a.\", \"a.b\", \"a.c\", \"a.e.\", \"a.e.d\", \"a.e.f\"]\nactual = _add_all_submodules(members)\nprint(actual)\nassert actual == expected, actual\n
['a.', 'a.b', 'a.c', 'a.e.', 'a.e.d', 'a.e.f']\n
assert _get_api_summary_item(\"a.b.\") == \" \" * 8 + \"- b\"\nassert _get_api_summary_item(\"a.b\") == \" \" * 8 + \"- [b](api/a/b.md)\"\n
members = [\"a.\", \"a.b\", \"a.c.\", \"a.c.d\", \"a.e.\", \"a.e.f\"]\nactual = _get_api_summary(members)\nexpected = \"\"\"    - a\n        - [b](api/a/b.md)\n        - c\n            - [d](api/a/c/d.md)\n        - e\n            - [f](api/a/e/f.md)\n\"\"\"\nprint(\"*\" * 100)\nprint(\"- API\")\nprint(actual, end=\"\")\nprint(\"*\" * 100)\nassert actual == expected\n
****************************************************************************************************\n- API\n    - a\n        - [b](api/a/b.md)\n        - c\n            - [d](api/a/c/d.md)\n        - e\n            - [f](api/a/e/f.md)\n****************************************************************************************************\n
module_name = \"nbdev_mkdocs\"\nmembers_with_submodules = _get_submodule_members(module_name)\nmembers_with_submodules\n
['nbdev_mkdocs',\n 'nbdev_mkdocs.docstring',\n 'nbdev_mkdocs.docstring.run_examples_from_docstring',\n 'nbdev_mkdocs.mkdocs',\n 'nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs',\n 'nbdev_mkdocs.mkdocs.new',\n 'nbdev_mkdocs.mkdocs.prepare',\n 'nbdev_mkdocs.mkdocs.preview',\n 'nbdev_mkdocs.social_image_generator',\n 'nbdev_mkdocs.social_image_generator.generate_social_image']\n
module_name = \"nbdev_mkdocs\"\nmembers_with_submodules = _get_submodule_members(module_name)\nsymbols = _load_submodules(module_name, members_with_submodules)\nsymbols\n
[<function nbdev_mkdocs.docstring.run_examples_from_docstring(o: Any, *, supress_stdout: bool = False, supress_stderr: bool = False, sub_dict: Union[Dict[str, str], NoneType] = None, width: Union[int, NoneType] = 80, **kwargs: str) -> None>,\n <function nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs(root_path: str, refresh_quarto_settings: bool = False, use_relative_doc_links: bool = False, no_mkdocs_build: bool = False) -> None>,\n <function nbdev_mkdocs.mkdocs.new(root_path: str) -> None>,\n <function nbdev_mkdocs.mkdocs.prepare(root_path: str, use_relative_doc_links: bool = False, no_test: bool = False, no_mkdocs_build: bool = False) -> None>,\n <function nbdev_mkdocs.mkdocs.preview(root_path: str, use_relative_doc_links: bool, port: Union[int, NoneType] = None) -> None>,\n <function nbdev_mkdocs.social_image_generator.generate_social_image(root_path: str, generator: str = 'file', prompt: str = 'Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render', image_path: Union[str, NoneType] = None) -> None>]\n
with TemporaryDirectory() as d:\n    docs_path = Path(d)\n    path = _generate_api_doc(\"a.b\", docs_path)\n\n    assert path == docs_path / \"a\" / \"b.md\"\n\n    with open(path, \"r\", encoding=\"utf-8\") as f:\n        actual = f.read()\n\n    expected = \"::: a.b\\n\"\n\n    assert actual == expected\n
members = [\"a.\", \"a.b\", \"a.c.\", \"a.c.d\", \"a.e.\", \"a.e.d\"]\n\nwith TemporaryDirectory() as d:\n    docs_path = Path(d)\n    generated_paths = _generate_api_docs(members, docs_path)\n\n    expected = [docs_path / \"a/b.md\", docs_path / \"a/c/d.md\", docs_path / \"a/e/d.md\"]\n    assert generated_paths == expected\n
_get_annotated_symbol_definition_mock_value = f'::: test_lib.test_module.test_symbol'\n\n@contextmanager\ndef mock_get_annotated_symbol_definition():\n    with unittest.mock.patch('__main__.get_formatted_docstring_for_symbol') as mock_get_annotated_symbol_definition:\n        mock_get_annotated_symbol_definition.return_value = _get_annotated_symbol_definition_mock_value\n        yield\n
with TemporaryDirectory() as d:\n    module_name = \"nbdev_mkdocs\"\n\n    docs_path = Path(d) / \"mkdocs\" / \"docs\"\n    docs_path.mkdir(parents=True)\n\n    api_path = docs_path / \"api\"\n    api_path.mkdir(parents=True)\n\n    members_with_submodules = _get_submodule_members(module_name)\n    symbols = _load_submodules(module_name, members_with_submodules)\n\n    for symbol in symbols:\n        target_file_path = (\n            \"/\".join(f\"{symbol.__module__}.{symbol.__name__}\".split(\".\")) + \".md\"\n        )\n        (api_path / \"/\".join(f\"{symbol.__module__}\".split(\".\"))).mkdir(\n            parents=True, exist_ok=True\n        )\n\n        with open((api_path / target_file_path), \"w\", encoding=\"utf-8\") as f:\n            f.write(f\"Initial content in '{target_file_path}'\")\n\n        with open((api_path / target_file_path), \"r\", encoding=\"utf-8\") as f:\n            contents = f.read()\n            print(contents)\n            assert f\"Initial content in '{target_file_path}'\" == contents, contents\n\n    with mock_get_annotated_symbol_definition():\n        _update_api_docs(symbols, docs_path)\n\n    print(\"*\" * 100)\n    for symbol in symbols:\n        target_file_path = (\n            \"/\".join(f\"{symbol.__module__}.{symbol.__name__}\".split(\".\")) + \".md\"\n        )\n        (api_path / \"/\".join(f\"{symbol.__module__}\".split(\".\"))).mkdir(\n            parents=True, exist_ok=True\n        )\n\n        with open((api_path / target_file_path), \"r\", encoding=\"utf-8\") as f:\n            contents = f.read()\n            print(contents)\n            assert f\"Initial content in '{target_file_path}'\" != contents, contents\n
Initial content in 'nbdev_mkdocs/docstring/run_examples_from_docstring.md'\nInitial content in 'nbdev_mkdocs/mkdocs/nbdev_mkdocs_docs.md'\nInitial content in 'nbdev_mkdocs/mkdocs/new.md'\nInitial content in 'nbdev_mkdocs/mkdocs/prepare.md'\nInitial content in 'nbdev_mkdocs/mkdocs/preview.md'\nInitial content in 'nbdev_mkdocs/social_image_generator/generate_social_image.md'\n****************************************************************************************************\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n
with TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    shutil.copyfile(\n        _root_path / \"nbs\" / \"Social_Image_Generator.ipynb\",\n        Path(d) / \"nbs\" / \"Social_Image_Generator.ipynb\",\n    )\n    new(d)\n\n    with set_cwd(d):\n        with unset_env_var(\"IN_TEST\"):\n            nbdev_export.__wrapped__()\n\n    module_name = f\"repo_{random_string}\"\n\n    expected = f\"\"\"    - repo_{random_string}\n        - social_image_generator\n            - [generate_social_image](api/repo_{random_string}/social_image_generator/generate_social_image.md)\n\"\"\"\n    with add_tmp_path_to_sys_path(d):\n        with mock_get_annotated_symbol_definition():\n            api_summary = _generate_api_docs_for_module(d, module_name)\n\n    print(\"*\" * 100)\n    print(\"- API\")\n    print(api_summary)\n    print(\"*\" * 100)\n\n    assert api_summary == expected\n\n    files = sorted(\n        [x for x in (Path(d) / \"mkdocs\" / \"docs\" / \"api\").glob(\"**/*\") if x.is_file()]\n    )\n\n    display(files)\n\n    for file in files:\n        with open(file, \"r\", encoding=\"utf-8\") as f:\n            print(f.read())\n\nfilenames_1 = re.findall(r\"[a-z|A-Z|_]*\\.md\", api_summary)\nfilenames_2 = [f.name for f in files]\nassert set(filenames_1) == set(\n    filenames_2\n), f\"set(filenames_1) = {set(filenames_1)}, set(filenames_2) = {set(filenames_2)}\"\n
settings.ini created.\nDirectory /tmp/tmp9dhld1sd/mkdocs created.\nFile '/tmp/tmp9dhld1sd/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp9dhld1sd/mkdocs/summary_template.txt' generated.\n****************************************************************************************************\n- API\n    - repo_efqwbqdopp\n        - social_image_generator\n            - [generate_social_image](api/repo_efqwbqdopp/social_image_generator/generate_social_image.md)\n\n****************************************************************************************************\n::: test_lib.test_module.test_symbol\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[Path('/tmp/tmp9dhld1sd/mkdocs/docs/api/repo_efqwbqdopp/social_image_generator/generate_social_image.md')]\n
s = \"\"\"usage: nbdev_mkdocs_new [-h] root_path\n\nInitialize mkdocs project files Creates **mkdocs** directory in the **root_path** directory and populates it with\ninitial values. You should edit mkdocs.yml file to customize it if needed.\n\npositional arguments:\n  root_path\n\noptional arguments:\n  -h, --help  show this help message and exit show this help message and exit show this help message and exit\n  -h, --help  show this help message and exit\n  --port PORT\n  --domain DOMAIN\n\"\"\"\n\nwidth = 60\ndoc = _restrict_line_length(s, width)\n\nprint(doc)\nassert all([len(line) <= width for line in doc.splitlines() if line.strip() != \"\"])\n
usage: nbdev_mkdocs_new [-h] root_path\n\nInitialize mkdocs project files Creates **mkdocs** directory\nin the **root_path** directory and populates it with initial\nvalues. You should edit mkdocs.yml file to customize it if\nneeded.\n\n\npositional arguments:\n root_path\n\noptional arguments:\n -h, --help  show this help message and exit show this help\nmessage and exit show this help message and exit\n -h, --help  show this help message and exit\n --port PORT\n --domain DOMAIN\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    # update settings.ini file add invalid console script\n    updater = ConfigUpdater()\n    updater.read(settings_path)\n    updater[\"DEFAULT\"][\"console_scripts\"] = \"nbdev_mkdocs=nbdev_mkdocs._cli:_app\"\n    updater[\"DEFAULT\"][\"console_scripts\"].append(\n        \"invalid_cmd=nbdev_mkdocs._cli:_invalid_app\"\n    )\n    updater.update_file()\n\n    new(d)\n\n    _module = \"repo\"\n    cli_summary = _generate_cli_docs_for_module(d, _module)\n    print(cli_summary)\n    expected = \"\"\"    - [nbdev_mkdocs](cli/nbdev_mkdocs.md)\n    - [invalid_cmd](cli/invalid_cmd.md)\"\"\"\n\n    assert cli_summary == expected, cli_summary\n\n    _dst_path = Path(d) / \"mkdocs\" / \"docs\"\n    assert (_dst_path / \"cli\" / \"nbdev_mkdocs.md\").exists()\n    assert (_dst_path / \"cli\" / \"invalid_cmd.md\").exists()\n\n    with (_dst_path / \"cli\" / \"invalid_cmd.md\").open(\"r\") as f:\n        contents = f.read()\n\n    print(contents)\n    assert (\n        contents\n        == \"Unable to generate documentation for command. Execution of `invalid_cmd --help` command failed.\"\n    )\n
settings.ini created.\nDirectory /tmp/tmpf3hl19sv/mkdocs created.\nFile '/tmp/tmpf3hl19sv/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpf3hl19sv/mkdocs/summary_template.txt' generated.\n    - [nbdev_mkdocs](cli/nbdev_mkdocs.md)\n    - [invalid_cmd](cli/invalid_cmd.md)\nUnable to generate documentation for command. Execution of `invalid_cmd --help` command failed.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n    settings_path = Path(d) / \"settings.ini\"\n    new(d)\n\n    _module = \"invalid_module\"\n    cli_summary = _generate_cli_docs_for_module(d, _module)\n    print(cli_summary)\n\n    _dst_path = Path(d) / \"mkdocs\" / \"docs\"\n\n    for path in _dst_path.iterdir():\n        print(path)\n\n    assert cli_summary == \" \" * 4 + \"- [Not found](cli_commands_not_found.md)\"\n\n    assert (_dst_path / \"cli_commands_not_found.md\").exists()\n
settings.ini created.\nDirectory /tmp/tmplqwtdefu/mkdocs created.\nFile '/tmp/tmplqwtdefu/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmplqwtdefu/mkdocs/summary_template.txt' generated.\n    - [Not found](cli_commands_not_found.md)\n/tmp/tmplqwtdefu/mkdocs/docs/images\n/tmp/tmplqwtdefu/mkdocs/docs/cli_commands_not_found.md\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    new(d)\n\n    _module = \"nbdev_mkdocs\"\n    cli_summary = _generate_cli_docs_for_module(d, _module)\n    print(cli_summary)\n\n    # make sure all paths and content exist\n    paths = re.findall(\"\\(.*?\\)\", cli_summary)\n    paths = [Path(d) / \"mkdocs/docs\" / x[1:-1] for x in paths]\n    for path in paths:\n        assert path.exists(), path\n        assert \"cli\" in str(path)\n
settings.ini created.\nDirectory /tmp/tmp4gfi9sq6/mkdocs created.\nFile '/tmp/tmp4gfi9sq6/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp4gfi9sq6/mkdocs/summary_template.txt' generated.\n    - [nbdev_mkdocs](cli/nbdev_mkdocs.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    new(d)\n\n    change_log = _copy_change_log_if_exists(d, f\"{d}/mkdocs/docs\")\n\n    print(f\"change_log={change_log}\")\n    assert change_log == \"(changelog_not_found.md)\"\n\n    change_log_path = Path(d) / \"CHANGELOG.md\"\n    with open(change_log_path, \"w\", encoding=\"utf-8\") as f:\n        f.write(\"CHANGELOG\")\n\n    (Path(d) / \"mkdocs\" / \"docs\").mkdir(exist_ok=True, parents=True)\n    change_log = _copy_change_log_if_exists(d, f\"{d}/mkdocs/docs\")\n\n    print(f\"change_log={change_log}\")\n    assert change_log == \"(CHANGELOG.md)\"\n
settings.ini created.\nDirectory /tmp/tmp_fiu1l6b/mkdocs created.\nFile '/tmp/tmp_fiu1l6b/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp_fiu1l6b/mkdocs/summary_template.txt' generated.\nchange_log=(changelog_not_found.md)\nchange_log=(CHANGELOG.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
"},{"location":"Mkdocs/#bringing-it-all-together_1","title":"Bringing it all together","text":"
_test_summary_template = \"\"\"{sidebar}\n- Reference\n{api}\n- Command line\n{cli}\n- [Change log]{changelog}\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    for fname in [\"README.md\", \"CHANGELOG.md\"]:\n        shutil.copyfile(Path(\"..\") / fname, Path(d) / fname)\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    copy_guides(_root_path, d)\n    shutil.copytree((Path(d) / \"nbs\" / \"guides\"), (Path(d) / \"nbs\" / \"blogs\"))\n\n    updater = ConfigUpdater()\n    updater.read(Path(d) / \"settings.ini\")\n    updater[\"DEFAULT\"][\"custom_sidebar\"] = False\n    updater.update_file()\n\n    new(d)\n\n    _summary_template_path = Path(d) / \"mkdocs\" / \"summary_template.txt\"\n    _summary_template_path.unlink()\n    with _summary_template_path.open(\"w\", encoding=\"utf-8\") as f:\n        f.write(_test_summary_template)\n\n    with set_cwd(d):\n        with unset_env_var(\"IN_TEST\"):\n            nbdev_export.__wrapped__()\n\n        cache_path = proc_nbs()\n\n    with add_tmp_path_to_sys_path(d):\n        with mock_get_annotated_symbol_definition():\n            _build_summary(d, f\"repo_{random_string}\", cache_path)\n\n    with open(Path(d) / \"mkdocs/docs/SUMMARY.md\", \"r\", encoding=\"utf-8\") as f:\n        summary = f.read()\n\n    print(summary)\n    assert \"- [Material for nbdev](index.md)\" in summary\n    assert \"- [Change log](CHANGELOG.md)\" in summary\n    assert \"- Reference\\n\" in summary\n    assert \"- Command line\\n\" in summary\n    assert (\n        f\"- [nbdev_mkdocs_docs](api/repo_{random_string}/mkdocs/nbdev_mkdocs_docs.md)\"\n        in summary\n    )\n    assert (\n        f\"- [generate_social_image](api/repo_{random_string}/social_image_generator/generate_social_image.md)\"\n        in summary\n    )\n
settings.ini created.\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmph73bybi6/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmph73bybi6/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmph73bybi6/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmph73bybi6/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmph73bybi6/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmph73bybi6/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmph73bybi6/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmph73bybi6/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmph73bybi6/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmph73bybi6/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmph73bybi6/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmph73bybi6/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmph73bybi6/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmph73bybi6/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmph73bybi6/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmph73bybi6/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmph73bybi6/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmph73bybi6/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmph73bybi6/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmph73bybi6/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmph73bybi6/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmph73bybi6/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmph73bybi6/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmph73bybi6/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmph73bybi6/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmph73bybi6/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmph73bybi6/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmph73bybi6/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmph73bybi6/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmph73bybi6/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmph73bybi6/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmph73bybi6/nbs/guides/images/guide_1.png\nDirectory /tmp/tmph73bybi6/mkdocs created.\nFile '/tmp/tmph73bybi6/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmph73bybi6/mkdocs/summary_template.txt' generated.\n- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- blogs\n    - [Adding guides](blogs/Adding_Guides.md)\n    - [Adding release notes](blogs/Adding_Release_Notes.md)\n    - [Advanced customization options](blogs/Advanced_Customization_Options.md)\n    - [Auto-generating docstrings](blogs/Auto_Generating_Docstrings.md)\n    - [Basic User Guide](blogs/Basic_User_Guide.md)\n    - [Customizing the sidebar](blogs/Customizing_The_Sidebar.md)\n    - [Handling pandas in the output](blogs/Handling_Pandas_In_The_Output.md)\n    - [Setting up document versioning](blogs/Setting_Up_Document_Versioning.md)\n    - [Setting up social cards](blogs/Setting_up_social_cards.md)\n- guides\n    - [Adding guides](guides/Adding_Guides.md)\n    - [Adding release notes](guides/Adding_Release_Notes.md)\n    - [Advanced customization options](guides/Advanced_Customization_Options.md)\n    - [Auto-generating docstrings](guides/Auto_Generating_Docstrings.md)\n    - [Basic User Guide](guides/Basic_User_Guide.md)\n    - [Customizing the sidebar](guides/Customizing_The_Sidebar.md)\n    - [Handling pandas in the output](guides/Handling_Pandas_In_The_Output.md)\n    - [Setting up document versioning](guides/Setting_Up_Document_Versioning.md)\n    - [Setting up social cards](guides/Setting_up_social_cards.md)\n- Reference\n    - repo_yruqmqiwmu\n        - mkdocs\n            - [nbdev_mkdocs_docs](api/repo_yruqmqiwmu/mkdocs/nbdev_mkdocs_docs.md)\n            - [new](api/repo_yruqmqiwmu/mkdocs/new.md)\n            - [prepare](api/repo_yruqmqiwmu/mkdocs/prepare.md)\n            - [preview](api/repo_yruqmqiwmu/mkdocs/preview.md)\n        - social_image_generator\n            - [generate_social_image](api/repo_yruqmqiwmu/social_image_generator/generate_social_image.md)\n- Command line\n    - [Not found](cli_commands_not_found.md)\n- [Change log](CHANGELOG.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Social_Image_Generator.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nOutput created: _docs/Social_Image_Generator.md\n\npandoc -o Mkdocs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Create new\n\nOutput created: _docs/Mkdocs.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n
"},{"location":"Mkdocs/#copy-cname-if-needed","title":"Copy CNAME if needed","text":"
for has_cname in [True, False]:\n    with TemporaryDirectory() as d:\n        settings_path = Path(d) / \"settings.ini\"\n        for fname in [\"settings.ini\", \"README.md\"] + [\"CNAME\"] if has_cname else []:\n            shutil.copyfile(Path(\"..\") / fname, Path(d) / fname)\n\n        _copy_cname_if_needed(d)\n        if has_cname:\n            assert (Path(d) / \"mkdocs\" / \"docs\" / \"CNAME\").exists()\n        else:\n            assert not (Path(d) / \"mkdocs\" / \"docs\" / \"CNAME\").exists()\n
File '/tmp/tmpayy2vh64/CNAME' copied to '/tmp/tmpayy2vh64/mkdocs/docs/CNAME'.\nFile '/tmp/tmp8n1__l9o/CNAME' not found, skipping copying..\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    new(d)\n\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"css\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"js\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"css\" / \"extra.css\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"js\" / \"extra.js\").exists()\n\n    _copy_docs_overrides(d)\n\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"css\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"js\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"images\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"css\" / \"extra.css\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"js\" / \"extra.js\").exists()\n
settings.ini created.\nDirectory /tmp/tmpy999o2ev/mkdocs created.\nFile '/tmp/tmpy999o2ev/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpy999o2ev/mkdocs/summary_template.txt' generated.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
use_relative_doc_links = False\nexpected_dict = {\n    \"0.1.1\": [\n        \"https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"https://airtai.github.io/nbdev-mkdocs/0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"https://airtai.github.io/nbdev-mkdocs/0.1.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n    ],\n    \"0.1.1dev\": [\n        \"https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"https://airtai.github.io/nbdev-mkdocs/0.1.1dev/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"https://airtai.github.io/nbdev-mkdocs/0.1.1dev/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n    ],\n}\nfor version, expected in expected_dict.items():\n    for i, docs_versioning in enumerate([None, \"minor\", \"patch\"]):\n        with TemporaryDirectory() as d:\n            run_nbdev_new(d)\n            updater = ConfigUpdater()\n            updater.read(Path(d) / \"settings.ini\")\n            updater[\"DEFAULT\"][\"version\"].add_after.option(\n                \"docs_versioning\", docs_versioning\n            )\n            updater[\"DEFAULT\"][\"version\"] = version\n            updater.update_file()\n\n            _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n            shutil.copyfile(\n                _root_path / \"fixtures/Test_Sym_Links_In_Docs.ipynb\",\n                Path(d) / \"nbs/Test_Sym_Links_In_Docs.ipynb\",\n            )\n\n            with set_cwd(d):\n                with unset_env_var(\"IN_TEST\"):\n                    nbdev_export.__wrapped__()\n                cache_path = proc_nbs()\n\n            cmd = f'cd \"{d}\" && nbdev_docs'\n            _sprun(cmd)\n\n            nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\n            docs_versioning = get_value_from_config(d, \"docs_versioning\")\n            lib_version = get_value_from_config(d, \"version\")\n\n            _fix_sym_links_in_nbs(\n                d,\n                cache_path,\n                nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                use_relative_doc_links,\n            )\n\n            with open(f\"{d}/_proc/Test_Sym_Links_In_Docs.ipynb\", \"r\", encoding=\"utf-8\") as f:\n                file_contents = f.read()\n\n            assert (\n                \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n                not in file_contents\n            )\n            assert (\n                \"[`nbdev.doclinks.NbdevLookup.linkify`](https://nbdev.fast.ai/api/doclinks.html#nbdevlookup.linkify)\"\n                in file_contents\n            )\n            assert expected[i] in file_contents, f\"{expected[i]}, {file_contents}\"\n\n            print(\"OK.\")\n
settings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/home/harish/.local/lib/python3.8/site-packages/configupdater/option.py:115: NoneValueDisallowed: Cannot represent <docs_versioning = None>, it will be converted to <docs_versioning = ''>.\n    Please use ``allow_no_value=True`` with ``ConfigUpdater``.\n\n  NoneValueDisallowed.warn(self._key)\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/home/harish/.local/lib/python3.8/site-packages/configupdater/option.py:115: NoneValueDisallowed: Cannot represent <docs_versioning = None>, it will be converted to <docs_versioning = ''>.\n    Please use ``allow_no_value=True`` with ``ConfigUpdater``.\n\n  NoneValueDisallowed.warn(self._key)\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\n
use_relative_doc_links = True\nexpected_dict = {\n    \"0.1.1\": [\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n    ],\n    \"0.1.1dev\": [\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n    ],\n}\nfor version, expected in expected_dict.items():\n    for i, docs_versioning in enumerate([None, \"minor\", \"patch\"]):\n        with TemporaryDirectory() as d:\n            run_nbdev_new(d)\n            updater = ConfigUpdater()\n            updater.read(Path(d) / \"settings.ini\")\n            updater[\"DEFAULT\"][\"version\"].add_after.option(\n                \"docs_versioning\", docs_versioning\n            )\n            updater[\"DEFAULT\"][\"version\"] = version\n            updater.update_file()\n\n            _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n            shutil.copyfile(\n                _root_path / \"fixtures/Test_Sym_Links_In_Docs.ipynb\",\n                Path(d) / \"nbs/Test_Sym_Links_In_Docs.ipynb\",\n            )\n\n            with set_cwd(d):\n                with unset_env_var(\"IN_TEST\"):\n                    nbdev_export.__wrapped__()\n                cache_path = proc_nbs()\n\n            cmd = f'cd \"{d}\" && nbdev_docs'\n            _sprun(cmd)\n\n            nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\n            docs_versioning = get_value_from_config(d, \"docs_versioning\")\n            lib_version = get_value_from_config(d, \"version\")\n\n            _fix_sym_links_in_nbs(\n                d,\n                cache_path,\n                nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                use_relative_doc_links,\n            )\n\n            with open(f\"{d}/_proc/Test_Sym_Links_In_Docs.ipynb\", \"r\", encoding=\"utf-8\") as f:\n                file_contents = f.read()\n\n            assert (\n                \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n                not in file_contents\n            )\n            assert (\n                \"[`nbdev.doclinks.NbdevLookup.linkify`](https://nbdev.fast.ai/api/doclinks.html#nbdevlookup.linkify)\"\n                in file_contents\n            )\n            assert expected[i] in file_contents, f\"{expected[i]}, {file_contents}\"\n\n            print(\"OK.\")\n
settings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/home/harish/.local/lib/python3.8/site-packages/configupdater/option.py:115: NoneValueDisallowed: Cannot represent <docs_versioning = None>, it will be converted to <docs_versioning = ''>.\n    Please use ``allow_no_value=True`` with ``ConfigUpdater``.\n\n  NoneValueDisallowed.warn(self._key)\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/home/harish/.local/lib/python3.8/site-packages/configupdater/option.py:115: NoneValueDisallowed: Cannot represent <docs_versioning = None>, it will be converted to <docs_versioning = ''>.\n    Please use ``allow_no_value=True`` with ``ConfigUpdater``.\n\n  NoneValueDisallowed.warn(self._key)\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\n

source

"},{"location":"Mkdocs/#prepare","title":"prepare","text":"
 prepare (root_path:str, use_relative_doc_links:bool=False,\n          no_test:bool=False, no_mkdocs_build:bool=False)\n

Prepare mkdocs for serving

Args: root_path: The root path of the project use_relative_doc_links: If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview. no_test: If set to False, the unit tests will be run, else they will be skipped no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

source

"},{"location":"Mkdocs/#nbdev_mkdocs_docs","title":"nbdev_mkdocs_docs","text":"
 nbdev_mkdocs_docs (root_path:str, refresh_quarto_settings:bool=False,\n                    use_relative_doc_links:bool=False,\n                    no_mkdocs_build:bool=False)\n

Prepare mkdocs documentation

Args: root_path: The root path of the project refresh_quarto_settings: Flag to refresh quarto yml file. This flag should be set to True if this function is called directly without calling prepare. use_relative_doc_links: If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview. no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    updater = ConfigUpdater()\n    updater.read(settings_path)\n    updater[\"DEFAULT\"][\"version\"] = \"5.0.1\"\n    updater.update_file()\n\n    #     !cat {settings_path}\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    copy_guides(_root_path, d)\n\n    for f in [\"CNAME\", \"nbs/Docstring.ipynb\"]:\n        shutil.copyfile(_root_path / f, Path(d) / f)\n\n    new(d)\n    #     !cat {d}/mkdocs/mkdocs.yml\n\n    with add_tmp_path_to_sys_path(d):\n        with unset_env_var(\"IN_TEST\"):\n            prepare(d)\n\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"CNAME\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"SUMMARY.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"index.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"guides\").exists()\n    assert (\n        Path(d)\n        / \"mkdocs\"\n        / \"docs\"\n        / \"api\"\n        / f\"repo_{random_string}\"\n        / \"docstring\"\n        / \"run_examples_from_docstring.md\"\n    ).exists()\n
settings.ini created.\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmpf8j672p2/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmpf8j672p2/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmpf8j672p2/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmpf8j672p2/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmpf8j672p2/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmpf8j672p2/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmpf8j672p2/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmpf8j672p2/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmpf8j672p2/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmpf8j672p2/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmpf8j672p2/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmpf8j672p2/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmpf8j672p2/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmpf8j672p2/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmpf8j672p2/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmpf8j672p2/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmpf8j672p2/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmpf8j672p2/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmpf8j672p2/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmpf8j672p2/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmpf8j672p2/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmpf8j672p2/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmpf8j672p2/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmpf8j672p2/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmpf8j672p2/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmpf8j672p2/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmpf8j672p2/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_1.png\nDirectory /tmp/tmpf8j672p2/mkdocs created.\nFile '/tmp/tmpf8j672p2/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpf8j672p2/mkdocs/summary_template.txt' generated.\nSuccess.\nFile '/tmp/tmpf8j672p2/CNAME' copied to '/tmp/tmpf8j672p2/mkdocs/docs/CNAME'.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Docstring.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: docstring.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Docstring helpers\n\nOutput created: _docs/Docstring.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\nINFO     -  Cleaning site directory\nINFO     -  Building documentation to directory: /tmp/tmpf8j672p2/mkdocs/site\nINFO     -  DeprecationWarning: invalid escape sequence \\s\n  File \"/home/harish/.local/lib/python3.8/site-packages/griffe/agents/visitor.py\", line 180, in get_module\n    top_node = compile(self.code, mode=\"exec\", filename=str(self.filepath), flags=ast.PyCF_ONLY_AST, optimize=1)\n  File \"repo_zjsgwfnvop/docstring.py\", line 94, in \n    code = [x[0] for x in re.findall(\"```\\s*python((\\n|.|\\\\n])+)```\", s)]\n\nINFO     -  DeprecationWarning: invalid escape sequence \\w\n  File \"/home/harish/.local/lib/python3.8/site-packages/griffe/agents/visitor.py\", line 180, in get_module\n    top_node = compile(self.code, mode=\"exec\", filename=str(self.filepath), flags=ast.PyCF_ONLY_AST, optimize=1)\n  File \"repo_zjsgwfnvop/docstring.py\", line 124, in \n    [x[9:-1] for x in re.findall(\"{fill in \\w+}\", example)]\n\nINFO     -  Documentation built in 0.99 seconds\n
"},{"location":"Mkdocs/#preview","title":"Preview","text":"

source

"},{"location":"Mkdocs/#preview_1","title":"preview","text":"
 preview (root_path:str, use_relative_doc_links:bool,\n          port:Optional[int]=None)\n

Preview the mkdocs documentation.

Args: root_path: The root path of the documentation. use_relative_doc_links: If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. port: The port to serve the documentation on.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

_test_summary_template = \"\"\"{sidebar}\n- Reference\n{api}\n- Command line\n{cli}\n- [Change log]{changelog}\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n    print(f\"Docs will be server at: http://0.0.0.0:4000/repo_{random_string}/\")\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    updater = ConfigUpdater()\n    updater.read(settings_path)\n    updater[\"DEFAULT\"][\"version\"] = \"1.0.1\"\n    updater.update_file()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    copy_guides(_root_path, d)\n    shutil.copytree((Path(d) / \"nbs\" / \"guides\"), (Path(d) / \"nbs\" / \"blogs\"))\n\n    for f in [\"CNAME\", \"nbs/Docstring.ipynb\"]:\n        shutil.copyfile(_root_path / f, Path(d) / f)\n\n    for f in [\"Fixture.ipynb\"]:\n        shutil.copyfile(_root_path / \"fixtures\" / f, Path(d) / \"nbs\" / f)\n\n    new(d)\n\n    _summary_template_path = Path(d) / \"mkdocs\" / \"summary_template.txt\"\n    _summary_template_path.unlink()\n    with _summary_template_path.open(\"w\", encoding=\"utf-8\") as f:\n        f.write(_test_summary_template)\n\n    preview(d, use_relative_doc_links=True, port=4000)\n
settings.ini created.\nDocs will be server at: http://0.0.0.0:4000/repo_jdjxstjafm/\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmpvfcku8sc/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmpvfcku8sc/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmpvfcku8sc/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmpvfcku8sc/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmpvfcku8sc/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmpvfcku8sc/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmpvfcku8sc/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmpvfcku8sc/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmpvfcku8sc/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmpvfcku8sc/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmpvfcku8sc/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmpvfcku8sc/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmpvfcku8sc/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmpvfcku8sc/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmpvfcku8sc/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmpvfcku8sc/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmpvfcku8sc/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmpvfcku8sc/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_1.png\nDirectory /tmp/tmpvfcku8sc/mkdocs created.\nFile '/tmp/tmpvfcku8sc/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpvfcku8sc/mkdocs/summary_template.txt' generated.\nFile '/tmp/tmpvfcku8sc/CNAME' copied to '/tmp/tmpvfcku8sc/mkdocs/docs/CNAME'.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Fixture.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nOutput created: _docs/Fixture.md\n\npandoc -o Docstring.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: docstring.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Docstring helpers\n\nOutput created: _docs/Docstring.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\nWARNING  -  Config value 'dev_addr': The use of the IP address '0.0.0.0' suggests a production environment or the use of a proxy to connect to the MkDocs server. However, the MkDocs' server is intended for local development purposes only. Please use a third party production-ready server instead.\nINFO     -  Building documentation...\nINFO     -  Cleaning site directory\nINFO     -  DeprecationWarning: invalid escape sequence \\s\n  File \"/home/harish/.local/lib/python3.8/site-packages/griffe/agents/visitor.py\", line 180, in get_module\n    top_node = compile(self.code, mode=\"exec\", filename=str(self.filepath), flags=ast.PyCF_ONLY_AST, optimize=1)\n  File \"repo_jdjxstjafm/docstring.py\", line 94, in \n    code = [x[0] for x in re.findall(\"```\\s*python((\\n|.|\\\\n])+)```\", s)]\n\nINFO     -  DeprecationWarning: invalid escape sequence \\w\n  File \"/home/harish/.local/lib/python3.8/site-packages/griffe/agents/visitor.py\", line 180, in get_module\n    top_node = compile(self.code, mode=\"exec\", filename=str(self.filepath), flags=ast.PyCF_ONLY_AST, optimize=1)\n  File \"repo_jdjxstjafm/docstring.py\", line 124, in \n    [x[9:-1] for x in re.findall(\"{fill in \\w+}\", example)]\n\nINFO     -  Documentation built in 1.21 seconds\nINFO     -  [04:41:41] Watching paths for changes: 'mkdocs/docs', 'mkdocs/mkdocs.yml'\nINFO     -  [04:41:41] Serving on http://0.0.0.0:4000/repo_jdjxstjafm/\nWARNING  -  [04:41:48] \"GET /versions.json HTTP/1.1\" code 404\nINFO     -  [04:41:48] Browser connected: http://0.0.0.0:4000/repo_jdjxstjafm/\nINFO     -  Shutting down...\n\nKeyboardInterrupt:\n
"},{"location":"PackageData/","title":"PackageData","text":""},{"location":"PackageData/#get_root_data_path","title":"get_root_data_path","text":"
 get_root_data_path ()\n

Returns path to package_data in lib

Example: ``` python from nbdev_mkdocs._package_data import get_root_data_path

mkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\nprint(f\"Path is: {mkdocs_template_path.resolve()}\")\nassert mkdocs_template_path.exists()\n\n```\n

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

get_root_data_path.__doc__\n
'Returns path to package_data in lib\\n\\n    Example:\\n        ``` python\\n        from nbdev_mkdocs._package_data import get_root_data_path\\n\\n        mkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\\n        print(f\"Path is: {mkdocs_template_path.resolve()}\")\\n        assert mkdocs_template_path.exists()\\n\\n        ```\\n\\n    !!! note\\n\\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\\n    '\n
from nbdev_mkdocs.docstring import run_examples_from_docstring\n
run_examples_from_docstring(get_root_data_path)\n
Example:\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n    from nbdev_mkdocs._package_data import get_root_data_path\n\n    mkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\n    print(f\"Path is: {mkdocs_template_path.resolve()}\")\n    assert mkdocs_template_path.exists()\n\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stdout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nPath is: \n/Users/harishm/Dev/airt-git/nbdev-mkdocs/nbdev_mkdocs/package_data/mkdocs_templa\nte.yml\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stderr \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n
"},{"location":"Quarto_To_MkDocs_Syntax_Convertor/","title":"Quarto To MkDocs Syntax Convertor","text":"
from tempfile import TemporaryDirectory\nimport shutil\n
_input = \"\"\"\nmay have some text before ::: {markdown=1 .content-visible when-format=\\\\\"markdown\\\\\" style=\\\\\"text-align: center\\\\\"}\n\nsome random text \n\n::: {markdown=1 .content-visible when-format=\\\\\"markdown\\\\\"}\n\"\"\"\nexpected = \"\"\"\nmay have some text before ::: {markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\" style=\\\\\"text-align: center\\\\\"}\n\nsome random text \n\n::: {markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}\n\"\"\"\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-visible when-format=\\\\\"html\\\\\"}'\nexpected = '::: {markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-visible  unless-format=\\\\\"html\\\\\"}'\nexpected = '::: {markdown=1 .content-visible  when-format=\\\\\"html\\\\\"}'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = \"::: {markdown=1 .content-visible  unless-format=\\\\'markdown\\\\'}\"\nexpected = \"::: {markdown=1 .content-visible  when-format=\\\\'markdown\\\\'}\"\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n
may have some text before ::: {markdown=1 .content-visible unless-format=\\\"markdown\\\" style=\\\"text-align: center\\\"}\n\nsome random text\n\n::: {markdown=1 .content-visible unless-format=\\\"markdown\\\"}\n\n::: {markdown=1 .content-visible unless-format=\\\"html\\\"}\n::: {markdown=1 .content-visible  when-format=\\\"html\\\"}\n::: {markdown=1 .content-visible  when-format=\\'markdown\\'}\n
_input = \"::: {markdown=1 .content-hidden  when-format=\\\\'html\\\\'}\"\nexpected = \"::: {markdown=1 .content-hidden  unless-format=\\\\'html\\\\'}\"\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-hidden  when-format=\\\\\"markdown\\\\\" }'\nexpected = '::: {markdown=1 .content-hidden  unless-format=\\\\\"markdown\\\\\" }'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-hidden  unless-format=\\\\\"html\\\\\" }'\nexpected = '::: {markdown=1 .content-hidden  when-format=\\\\\"html\\\\\" }'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-hidden  unless-format=\\\\\"markdown\\\\\" }'\nexpected = '::: {markdown=1 .content-hidden  when-format=\\\\\"markdown\\\\\" }'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n
::: {markdown=1 .content-hidden  unless-format=\\'html\\'}\n::: {markdown=1 .content-hidden  unless-format=\\\"markdown\\\" }\n::: {markdown=1 .content-hidden  when-format=\\\"html\\\" }\n::: {markdown=1 .content-hidden  when-format=\\\"markdown\\\" }\n
valid_inputs = [\n    \"\\n``` mermaid\\nflowchart LR\\n \",\n    \"\\n\\n``` mermaid   \\nflowchart LR\\n \",\n]\nexpected = [\"\\n``` mermaid\\nflowchart LR\\n \", \"\\n\\n``` mermaid   \\nflowchart LR\\n \"]\n\nfor n, i in enumerate(valid_inputs):\n    actual = _update_mermaid_chart_tags(i)\n    print(actual)\n    assert actual == expected[n], actual\n\n\ninvalid_inputs = [\n    \"\\n```{ mermaid}\\nflowchart LR\\n \",\n    \"\\n\\n```  some text {mermaid}   \\nflowchart LR\\n \",\n]\nexpected = [\n    \"\\n```{ mermaid}\\nflowchart LR\\n \",\n    \"\\n\\n```  some text {mermaid}   \\nflowchart LR\\n \",\n]\n\nfor n, i in enumerate(invalid_inputs):\n    actual = _update_mermaid_chart_tags(i)\n    print(actual)\n    assert actual == expected[n], actual\n
``` mermaid\nflowchart LR\n\n\n\n``` mermaid   \nflowchart LR\n\n\n```{ mermaid}\nflowchart LR\n\n\n\n```  some text {mermaid}   \nflowchart LR\n

``` python _input = \"\"\" Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"}

This is a Markdown Paragraph.

::: Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"} This is a Markdown Paragraph.

::: \"\"\" expected = \"\"\" Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"}

This is a Markdown Paragraph.

::: Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"} This is a Markdown Paragraph.

::: \"\"\" actual = _add_markdown_attribute_to_enable_md_in_html(_input) print(actual)

assert actual == expected

    Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"}\n\n    This is a *Markdown* Paragraph.\n\n    :::\n    Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"}\n    This is a *Markdown* Paragraph.\n\n    :::\n\n``` python\nfixtures = [\n    \"\",\n    ' collapse=\"false\" title=\"Some title\"',\n    ' collapse=\"true\" icon=false appearance=\"minimal\"',\n    \" collapse='false' title='Some title'\",\n    \" collapse='true' title='Some title'\",\n]\nexpected = [\"!!!\", \"???+\", \"???\", \"???+\", \"???\"]\n\nfor i, fixture in enumerate(fixtures):\n    actual = _get_callout_identifier(fixture)\n    print(actual)\n    assert actual == expected[i]\n

!!!\n???+\n???\n???+\n???\n
callout_attributes = \".callout-note icon=false\"\ncallout_content = \"\"\"Using callouts is an effective way to highlight content that your reader give special consideration or attention.\"\"\"\n\nexpected_title = \"\"\nexpected_callout_content = \"\"\"Using callouts is an effective way to highlight content that your reader give special consideration or attention.\"\"\"\n\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n\ncallout_attributes = '.callout-note appearance=\"minimal\"'\ncallout_content = \"\"\"Using callouts is an effective way to highlight content that your reader give special consideration or attention.\"\"\"\n\nexpected_title = \"\"\nexpected_callout_content = \"\"\"Using callouts is an effective way to highlight content that your reader give special consideration or attention.\"\"\"\n\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n
Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n\nUsing callouts is an effective way to highlight content that your reader give special consideration or attention.\n
callout_attributes = \" title='Tip with Title' icon='false'\"\ncallout_content = \"\"\"## Tip with Title\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\"\"\"\n\nexpected_title = \"Tip with Title\"\nexpected_callout_content = \"\"\"## Tip with Title\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\"\"\"\n\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n
Tip with Title\n## Tip with Title\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n
callout_attributes = \" icon='false'\"\ncallout_content = \"\"\"## Tip with Title\n\nThis is an example of a callout with a title.\n\"\"\"\n\nexpected_title = \"Tip with Title\"\nexpected_callout_content = \"\"\"This is an example of a callout with a title.\n\"\"\"\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n
Tip with Title\nThis is an example of a callout with a title.\n
callout_attributes = \"\"\ncallout_content = \"\"\"\n\n    This is an example of a callout with a title.\n\"\"\"\n\nexpected_title = None\nexpected_callout_content = \"\"\"\n\n    This is an example of a callout with a title.\n\"\"\"\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n
None\n\n\n    This is an example of a callout with a title.\n
fixture = \"\"\"\n::: {markdown=1 .callout-note}\nNote that there are five types of callouts, including:\n`note`, `warning`, `important`, `tip`, and `caution`.\n:::\n\"\"\"\n\nexpected = \"\"\"\n!!! note\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\n\"\"\"\n\nactual = _fix_callout_syntax(fixture)\nprint(actual)\n\nassert actual == expected, actual\n
!!! note\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n
fixture = \"\"\"\n::: {markdown=1 .callout-tip}\n## Tip with Title\n\nNote that there are five types of callouts, including:\n`note`, `warning`, `important`, `tip`, and `caution`.\n:::\n\n::: {markdown=1 .callout-tip title=\"Tip with Title 2\"}\n\nThis is a callout with a title.\n:::\n\n\"\"\"\n\nexpected = \"\"\"\n!!! tip \\\\\"Tip with Title\\\\\"\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\n\n!!! tip \\\\\"Tip with Title 2\\\\\"\n\n    This is a callout with a title.\n\n\n\"\"\"\n\nactual = _fix_callout_syntax(fixture)\nprint(actual)\n\nassert actual == expected, actual\n
!!! tip \\\"Tip with Title\\\"\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\n\n!!! tip \\\"Tip with Title 2\\\"\n\n    This is a callout with a title.\n
fixture = \"\"\"\n::: {markdown=1 .callout-caution collapse=\"true\"}\n## Expand To Learn About Collapse\n\nThis is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n:::\n\n::: {markdown=1 .callout-caution collapse=\"false\"}\n## Expand To Learn About Collapse\n\nThis is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n:::\n\"\"\"\n\nexpected = \"\"\"\n??? caution \\\\\"Expand To Learn About Collapse\\\\\"\n\n    This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n\n\n???+ caution \\\\\"Expand To Learn About Collapse\\\\\"\n\n    This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n\n\"\"\"\n\nactual = _fix_callout_syntax(fixture)\nprint(actual)\n\nassert actual == expected, actual\n
??? caution \\\"Expand To Learn About Collapse\\\"\n\n    This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n\n\n???+ caution \\\"Expand To Learn About Collapse\\\"\n\n    This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n
fixture = \"\"\"\n::: {markdown=1 .callout-note icon=false}\n\nUsing callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n:::\n\n::: {markdown=1 .callout-note appearance=\"minimal\"}\n\nUsing callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n:::\n\"\"\"\n\nexpected = \"\"\"\n!!! note \\\\\"\\\\\"\n\n    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n\n\n!!! note \\\\\"\\\\\"\n\n    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n\n\"\"\"\n\nactual = _fix_callout_syntax(fixture)\nprint(actual)\n\nassert actual == expected, actual\n
!!! note \\\"\\\"\n\n    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n\n\n!!! note \\\"\\\"\n\n    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n
with TemporaryDirectory() as d:\n\n    nbs_path = Path(d) / \"nbs\"\n    nbs_path.mkdir()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    fname = Path(d) / \"nbs\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\"\n    shutil.copyfile(\n        _root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\",\n        fname,\n    )\n\n    with open(fname, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n\n    actual = _fix_callout_syntax_in_file(contents)\n\n    assert \".callout-note\" not in actual\n    print(actual)\n
---\ntitle: \"Sample\"\nauthor: Sample\n---\n\n## Introduction\n\n!!! note\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n
with TemporaryDirectory() as d:\n\n    nbs_path = Path(d) / \"nbs\"\n    nbs_path.mkdir()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    fname = Path(d) / \"nbs\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\"\n    shutil.copyfile(\n        _root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\",\n        fname,\n    )\n\n    with open(fname, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n\n    actual = _fix_callout_syntax_in_file(contents)\n    display(actual)\n\n    assert \".callout-note\" not in actual\n    assert \".callout-tip\"  not in actual\n    assert 'title=\"Tip with Title\"' not in actual\n    assert 'collapse=\"true\"' not in actual\n    assert 'collapse=\"false\"' not in actual\n    assert 'icon=false' not in actual\n    assert 'appearance=\"minimal' not in actual\n
'{\\n \"cells\": [\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8ee6e33a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"This notebook is used to test the conversion of Quarto to Material for MkDocs syntax. It serves as a fixture to verify the syntax, including callouts, Mermaid charts, and making a section hidden, which differ between Quarto and Material for MkDocs.\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"58c93178\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"# Callouts\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"d0a10ffc\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note\\\\n\",\\n    \"\\\\n\",\\n    \"    Note that there are five types of callouts, including:\\\\n\",\\n    \"    `note`, `warning`, `important`, `tip`, and `caution`.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"22014eb3\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"870e17d7\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"87f34d1a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"??? caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"4a8ac79c\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"???+ caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"034f6dbb\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8f79c54d\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ec9209a4\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"## Mermaid Charts and visibility\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"0a820438\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible when-format=\\\\\"markdown\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in markdown.\\\\n\",\\n    \"\\\\n\",\\n    \":::\\\\n\",\\n    \"\\\\n\",\\n    \"``` mermaid\\\\n\",\\n    \"flowchart LR\\\\n\",\\n    \"    A[Hard edge] --> B(Round edge)\\\\n\",\\n    \"    B --> C{Decision}\\\\n\",\\n    \"    C --> D[Result one]\\\\n\",\\n    \"    C --> E[Result two]\\\\n\",\\n    \"```\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ebd24225\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible when-format=\\\\\"html\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in html.\\\\n\",\\n    \"\\\\n\",\\n    \":::\"\\n   ]\\n  }\\n ],\\n \"metadata\": {\\n  \"kernelspec\": {\\n   \"display_name\": \"Python 3 (ipykernel)\",\\n   \"language\": \"python\",\\n   \"name\": \"python3\"\\n  },\\n  \"language_info\": {\\n   \"codemirror_mode\": {\\n    \"name\": \"ipython\",\\n    \"version\": 3\\n   },\\n   \"file_extension\": \".py\",\\n   \"mimetype\": \"text/x-python\",\\n   \"name\": \"python\",\\n   \"nbconvert_exporter\": \"python\",\\n   \"pygments_lexer\": \"ipython3\",\\n   \"version\": \"3.11.2\"\\n  }\\n },\\n \"nbformat\": 4,\\n \"nbformat_minor\": 5\\n}'\n
with TemporaryDirectory() as d:\n\n    nbs_path = Path(d) / \"nbs\"\n    nbs_path.mkdir()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    shutil.copyfile(\n        _root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\",\n        Path(d) / \"nbs\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\",\n    )\n    fname = Path(d) / \"nbs/Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\"\n    _update_quarto_tags_to_markdown_format(fname)\n\n    with open(fname, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n\ndisplay(contents)\n\nassert '{markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}' in contents\nassert not '{markdown=1 .content-visible when-format=\"\\\\markdown\\\\\"}' in contents\n\nassert \"mermaid\" in contents\nassert not \"{mermaid}\" in contents\n\nassert '{markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}' in contents\nassert not '{markdown=1 .content-visible when-format=\\\\\"html\\\\\"}' in contents\n\nassert \".callout-note\" not in contents\nassert \".callout-tip\"  not in contents\nassert 'title=\"Tip with Title\"' not in contents\nassert 'collapse=\"true\"' not in contents\nassert 'collapse=\"false\"' not in contents\nassert 'icon=false' not in contents\nassert 'appearance=\"minimal' not in contents\n
'{\\n \"cells\": [\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8ee6e33a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"This notebook is used to test the conversion of Quarto to Material for MkDocs syntax. It serves as a fixture to verify the syntax, including callouts, Mermaid charts, and making a section hidden, which differ between Quarto and Material for MkDocs.\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"58c93178\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"# Callouts\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"d0a10ffc\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note\\\\n\",\\n    \"\\\\n\",\\n    \"    Note that there are five types of callouts, including:\\\\n\",\\n    \"    `note`, `warning`, `important`, `tip`, and `caution`.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"22014eb3\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"870e17d7\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"87f34d1a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"??? caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"4a8ac79c\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"???+ caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"034f6dbb\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8f79c54d\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ec9209a4\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"## Mermaid Charts and visibility\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"0a820438\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in markdown.\\\\n\",\\n    \"\\\\n\",\\n    \":::\\\\n\",\\n    \"\\\\n\",\\n    \"``` mermaid\\\\n\",\\n    \"flowchart LR\\\\n\",\\n    \"    A[Hard edge] --> B(Round edge)\\\\n\",\\n    \"    B --> C{Decision}\\\\n\",\\n    \"    C --> D[Result one]\\\\n\",\\n    \"    C --> E[Result two]\\\\n\",\\n    \"```\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ebd24225\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in html.\\\\n\",\\n    \"\\\\n\",\\n    \":::\"\\n   ]\\n  }\\n ],\\n \"metadata\": {\\n  \"kernelspec\": {\\n   \"display_name\": \"Python 3 (ipykernel)\",\\n   \"language\": \"python\",\\n   \"name\": \"python3\"\\n  },\\n  \"language_info\": {\\n   \"codemirror_mode\": {\\n    \"name\": \"ipython\",\\n    \"version\": 3\\n   },\\n   \"file_extension\": \".py\",\\n   \"mimetype\": \"text/x-python\",\\n   \"name\": \"python\",\\n   \"nbconvert_exporter\": \"python\",\\n   \"pygments_lexer\": \"ipython3\",\\n   \"version\": \"3.11.2\"\\n  }\\n },\\n \"nbformat\": 4,\\n \"nbformat_minor\": 5\\n}'\n
"},{"location":"SUMMARY/","title":"SUMMARY","text":"
  • Material for nbdev
  • Guides
    • Basic User Guide
    • Advanced User Guide
      • Adding guides
      • Adding release notes
      • Customizing the sidebar
      • Auto-generating docstrings
      • Setting up social cards
      • Setting up document versioning
      • Handling pandas in the output
      • Advanced customization options
  • API
    • nbdev_mkdocs
      • docstring
        • run_examples_from_docstring
      • mkdocs
        • nbdev_mkdocs_docs
        • new
        • prepare
        • preview
      • social_image_generator
        • generate_social_image
  • CLI
    • nbdev_mkdocs
  • Releases
"},{"location":"Social_Image_Generator/","title":"Social Image Generator","text":"
import unittest.mock\n\nimport pytest\n\nfrom nbdev_mkdocs._testing import mock_openai_Image_create_for_notebook\n
# todo: please ask for openai account with no limit so I can actually test this function\n
mock_openai_Image_create_for_notebook()\n
with TemporaryDirectory() as d:\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", Path(d) / \"settings.ini\")\n\n    user_name = get_value_from_config(d, \"user\")\n    project_name = get_value_from_config(d, \"repo\")\n    project_description = get_value_from_config(d, \"description\")\n\n    image_url = \"https://sample-image.png\"\n    actual = _generate_html_str(d, image_url)\n    print(actual)\n\n    assert f\"{user_name}/\" in actual\n    assert project_name in actual\n    assert image_url in actual\n
<!DOCTYPE html>\n<html>\n    <head>\n        <link rel=\"preload\" href='https://fonts.googleapis.com/css?family=Source Sans Pro' rel='stylesheet'/>\n        <style>\n            body {\n                margin: 0px;\n                width: 1200px;\n                height: 630px;\n                font-family: 'Source Sans Pro', sans-serif;\n            }\n            #container {\n                display: flex;\n                height: 630px;\n                border-radius: 5px;\n                border:1px solid rgba(110, 118, 129, .1);\n            }\n            #container div:first-child{\n                flex-basis: 622px;\n                padding-top: 40px;\n                width: 622px;\n                word-wrap: break-word;\n            }\n            #container div:first-child h1{\n                font-size: 80px;\n                margin: 74px 0px 64px 55px;\n                color: #2E363D;\n                padding-right: 30px;\n            }\n            #container div:first-child h1 span{\n                font-weight: 100;\n            }\n            #container div:first-child p {\n                font-size: 25px;\n                color: #6E7681;\n                margin: 64px 0px 64px 59px;\n                padding-right: 30px;\n            }\n            #container div:last-child img{\n                margin: 60px 59px 59px 4px;\n                border-radius: 50px;\n                width: 512px;\n                height: auto;\n            }\n        </style>\n      </head>\n      <body>\n      <div id=\"container\">\n         <div>\n            <h1><span>airtai/</span>nbdev-mkdocs</h1>\n            <p>Extension of nbdev for generating documentation using Material for Mkdocs instead of Quarto</p>\n         </div>\n         <div>\n            <img src=\"https://sample-image.png\" />\n         </div>\n      </div>\n   </body>\n</html>\n
with TemporaryDirectory() as d:\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", Path(d) / \"settings.ini\")\n\n    user_name = get_value_from_config(d, \"user\")\n    project_name = get_value_from_config(d, \"repo\")\n    project_description = get_value_from_config(d, \"description\")\n\n    image_url = Path(d) / \"sample-image.png\"\n    actual = _generate_html_str(d, image_url)\n    print(actual)\n\n    assert f\"{user_name}/\" in actual\n    assert project_name in actual\n    assert str(image_url) not in actual\n    assert \"sample-image.png\" in actual\n
<!DOCTYPE html>\n<html>\n    <head>\n        <link rel=\"preload\" href='https://fonts.googleapis.com/css?family=Source Sans Pro' rel='stylesheet'/>\n        <style>\n            body {\n                margin: 0px;\n                width: 1200px;\n                height: 630px;\n                font-family: 'Source Sans Pro', sans-serif;\n            }\n            #container {\n                display: flex;\n                height: 630px;\n                border-radius: 5px;\n                border:1px solid rgba(110, 118, 129, .1);\n            }\n            #container div:first-child{\n                flex-basis: 622px;\n                padding-top: 40px;\n                width: 622px;\n                word-wrap: break-word;\n            }\n            #container div:first-child h1{\n                font-size: 80px;\n                margin: 74px 0px 64px 55px;\n                color: #2E363D;\n                padding-right: 30px;\n            }\n            #container div:first-child h1 span{\n                font-weight: 100;\n            }\n            #container div:first-child p {\n                font-size: 25px;\n                color: #6E7681;\n                margin: 64px 0px 64px 59px;\n                padding-right: 30px;\n            }\n            #container div:last-child img{\n                margin: 60px 59px 59px 4px;\n                border-radius: 50px;\n                width: 512px;\n                height: auto;\n            }\n        </style>\n      </head>\n      <body>\n      <div id=\"container\">\n         <div>\n            <h1><span>airtai/</span>nbdev-mkdocs</h1>\n            <p>Extension of nbdev for generating documentation using Material for Mkdocs instead of Quarto</p>\n         </div>\n         <div>\n            <img src=\"sample-image.png\" />\n         </div>\n      </div>\n   </body>\n</html>\n
with TemporaryDirectory() as d:\n    html_path = Path(d) / \"social_image.html\"\n    with open(html_path, \"w\", encoding=\"utf-8\") as f:\n        f.write(\n            \"<html><body><div id = 'container'><p>This is a sample text</p></div></body></html>\"\n        )\n\n    png_path = Path(d) / \"dst_path\" / \"mkdocs\" / \"docs_overrides\" / \"images\"\n    png_path.mkdir(parents=True)\n\n    dst_path = Path(d) / \"dst_path\"\n    await _capture_and_save_screenshot(d, dst_path)\n\n    assert (png_path / \"social_image.png\").exists()\n\n    await _capture_and_save_screenshot(d, dst_path)\n\n    assert (png_path / \"social_image.png\").exists()\n    assert (png_path / \"social_image.1.png\").exists()\n\n    await _capture_and_save_screenshot(d, dst_path)\n\n    assert (png_path / \"social_image.png\").exists()\n    assert (png_path / \"social_image.1.png\").exists()\n    assert (png_path / \"social_image.2.png\").exists()\n\n    (png_path / \"social_image.1.png\").unlink()\n    await _capture_and_save_screenshot(d, dst_path)\n\n    assert (png_path / \"social_image.png\").exists()\n    assert (png_path / \"social_image.2.png\").exists()\n    assert (png_path / \"social_image.3.png\").exists()\n
Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp6uqfce6e/dst_path/mkdocs/docs_overrides/images/social_image.png'\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp6uqfce6e/dst_path/mkdocs/docs_overrides/images/social_image.png'\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp6uqfce6e/dst_path/mkdocs/docs_overrides/images/social_image.png'\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp6uqfce6e/dst_path/mkdocs/docs_overrides/images/social_image.png'\n
with TemporaryDirectory() as d:\n    mkdocs_dir_path = Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\"\n    mkdocs_dir_path.mkdir(parents=True)\n\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"default_social_logo.png\",\n        Path(d) / \"default_social_logo.png\",\n    )\n\n    image_url = (Path(d) / \"default_social_logo.png\").resolve()\n    await _create_social_image(root_path=d, image_url=image_url)\n\n    png_path = mkdocs_dir_path / \"social_image.png\"\n    assert png_path.exists()\n
Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpj_4m6w6w/mkdocs/docs_overrides/images/social_image.png'\n
test_mkdocs_yml = \"\"\"\nsite_name: Test site\ntheme:\n  name: material\nnav:\n- Home:\n  - Home: index.md\nmarkdown_extensions:\n- markdown.extensions.toc:\n    slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}\n    permalink: ''\n- markdown.extensions.admonition:\n- markdown.extensions.smarty:\n    smart_quotes: false\n- pymdownx.betterem:\n- pymdownx.superfences:\n    preserve_tabs: true\n    custom_fences:\n        # Mermaid diagrams\n    - name: diagram\n      class: diagram\n      format:      !%21python/name:pymdownx.superfences.fence_code_format\n    - name: math\n      class: arithmatex\n      format: !%21python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {\n        kwds: {mode: generic, tag: pre}}\n    - name: md-render\n      class: md-render\n      format: !%21python/name:tools.pymdownx_md_render.md_sub_render\n- pymdownx.inlinehilite:\n    custom_inline:\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_inline_format {\n        kwds: {mode: generic}}\n- pymdownx.emoji:\n    emoji_index: !%21python/name:materialx.emoji.twemoji\n    emoji_generator: !%21python/name:materialx.emoji.to_svg\nextra:\n  social_image: \"\"\n\"\"\"\n\nexpected = \"\"\"\nsite_name: Test site\ntheme:\n  name: material\nnav:\n- Home:\n  - Home: index.md\nmarkdown_extensions:\n- markdown.extensions.toc:\n    slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}\n    permalink: ''\n- markdown.extensions.admonition:\n- markdown.extensions.smarty:\n    smart_quotes: false\n- pymdownx.betterem:\n- pymdownx.superfences:\n    preserve_tabs: true\n    custom_fences:\n        # Mermaid diagrams\n    - name: diagram\n      class: diagram\n      format: !!python/name:pymdownx.superfences.fence_code_format\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {\n        kwds: {mode: generic, tag: pre}}\n    - name: md-render\n      class: md-render\n      format: !!python/name:tools.pymdownx_md_render.md_sub_render\n- pymdownx.inlinehilite:\n    custom_inline:\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_inline_format {\n        kwds: {mode: generic}}\n- pymdownx.emoji:\n    emoji_index: !!python/name:materialx.emoji.twemoji\n    emoji_generator: !!python/name:materialx.emoji.to_svg\nextra:\n  social_image: \"\"\n\"\"\"\n\nactual = _unescape_exclamation_mark(test_mkdocs_yml)\n\nprint(actual)\nassert actual == expected\n
site_name: Test site\ntheme:\n  name: material\nnav:\n- Home:\n  - Home: index.md\nmarkdown_extensions:\n- markdown.extensions.toc:\n    slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}\n    permalink: ''\n- markdown.extensions.admonition:\n- markdown.extensions.smarty:\n    smart_quotes: false\n- pymdownx.betterem:\n- pymdownx.superfences:\n    preserve_tabs: true\n    custom_fences:\n        # Mermaid diagrams\n    - name: diagram\n      class: diagram\n      format: !!python/name:pymdownx.superfences.fence_code_format\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {\n        kwds: {mode: generic, tag: pre}}\n    - name: md-render\n      class: md-render\n      format: !!python/name:tools.pymdownx_md_render.md_sub_render\n- pymdownx.inlinehilite:\n    custom_inline:\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_inline_format {\n        kwds: {mode: generic}}\n- pymdownx.emoji:\n    emoji_index: !!python/name:materialx.emoji.twemoji\n    emoji_generator: !!python/name:materialx.emoji.to_svg\nextra:\n  social_image: \"\"\n
with TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True, exist_ok=True)\n\n    mkdocs_yml_path = mkdocs_path / \"mkdocs.yml\"\n    with mkdocs_yml_path.open(\"w\") as f:\n        f.write(test_mkdocs_yml)\n\n    def _f():\n        with _read_yaml_file(mkdocs_yml_path) as (yaml, config):\n            assert type(yaml) == YAML\n\n    _f()\n\nwith pytest.raises(NameError) as e:\n    print(yaml)\nprint(e.value)\n
name 'yaml' is not defined\n
with TemporaryDirectory() as d:\n    mkdocs_dir_path = Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\"\n    mkdocs_dir_path.mkdir(parents=True)\n\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"default_social_logo.png\",\n        Path(d) / \"default_social_logo.png\",\n    )\n\n    image_url = (Path(d) / \"default_social_logo.png\").resolve()\n    await _create_social_image(root_path=d, image_url=image_url)\n\n    png_path = mkdocs_dir_path / \"social_image.png\"\n    assert png_path.exists()\n\n    mkdocs_yml_path = Path(d) / \"mkdocs\" / \"mkdocs.yml\"\n    with mkdocs_yml_path.open(\"w\") as f:\n        f.write(test_mkdocs_yml)\n\n    for image_url in [\"https://my-random-domain/sample.png\", str(Path(d) / \"sample-image.png\")]:\n        _update_social_image_in_mkdocs_yml(d, image_url)\n        yaml = YAML()\n        config = yaml.load((Path(d) / \"mkdocs/mkdocs.yml\"))\n        print(config[\"extra\"][\"social_image\"])\n        assert (\n        config[\"extra\"][\"social_image\"] == \"overrides/images/social_image.png\"\n    ), config[\"extra\"][\"social_image\"]\n\n    image_url = \"https://opengraph.githubassets.com/13123.123/user/repo/sample.png\"\n    _update_social_image_in_mkdocs_yml(d, image_url)\n\n    yaml = YAML()\n    config = yaml.load((Path(d) / \"mkdocs/mkdocs.yml\"))\n    print(config[\"extra\"][\"social_image\"])\n    assert (\n        config[\"extra\"][\"social_image\"] == image_url\n    ), config[\"extra\"][\"social_image\"]\n\n    with mkdocs_yml_path.open(\"r\") as f:\n        contents = f.read()\n\n    print(contents)\n    assert \"!%21\" not in contents\n
Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpc1i3ujc1/mkdocs/docs_overrides/images/social_image.png'\noverrides/images/social_image.png\noverrides/images/social_image.png\nhttps://opengraph.githubassets.com/13123.123/user/repo/sample.png\nsite_name: Test site\ntheme:\n  name: material\nnav:\n- Home:\n  - Home: index.md\nmarkdown_extensions:\n- markdown.extensions.toc:\n    slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}\n    permalink: ''\n- markdown.extensions.admonition:\n- markdown.extensions.smarty:\n    smart_quotes: false\n- pymdownx.betterem:\n- pymdownx.superfences:\n    preserve_tabs: true\n    custom_fences:\n        # Mermaid diagrams\n    - name: diagram\n      class: diagram\n      format: !!python/name:pymdownx.superfences.fence_code_format\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {\n        kwds: {mode: generic, tag: pre}}\n    - name: md-render\n      class: md-render\n      format: !!python/name:tools.pymdownx_md_render.md_sub_render\n- pymdownx.inlinehilite:\n    custom_inline:\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_inline_format {\n        kwds: {mode: generic}}\n- pymdownx.emoji:\n    emoji_index: !!python/name:materialx.emoji.twemoji\n    emoji_generator: !!python/name:materialx.emoji.to_svg\nextra:\n  social_image: \"https://opengraph.githubassets.com/13123.123/user/repo/sample.png\"\n
with TemporaryDirectory() as d:\n    site_overrides_path = Path(d) / \"mkdocs\" / \"site_overrides\"\n    site_overrides_path.mkdir(exist_ok=True, parents=True)\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"site_overrides\" / \"main.html\",\n        (site_overrides_path / \"main.html\"),\n    )\n\n    _update_social_image_in_site_overrides(d)\n    with open((site_overrides_path / \"main.html\"), \"r\", encoding=\"utf-8\") as f:\n        actual = f.read()\n\n    print(actual)\n\n    assert (\n        '{% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}'\n        in actual\n    ), actual\n
{% extends \"base.html\" %}\n\n{% block extrahead %}\n  {% set title = config.site_name %}\n  {% if page and page.meta and page.meta.title %}\n    {% set title = title ~ \" - \" ~ page.meta.title %}\n  {% elif page and page.title and not page.is_homepage %}\n    {% set title = title ~ \" - \" ~ page.title | striptags %}\n  {% endif %}\n  {% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}\n  <meta property=\"og:type\" content=\"website\" />\n  <meta property=\"og:title\" content=\"{{ title }}\" />\n  <meta property=\"og:description\" content=\"{{ config.site_description }}\" />\n  <meta property=\"og:url\" content=\"{{ page.canonical_url }}\" />\n  <meta property=\"og:image\" content=\"{{ image_url }}\" />\n  <meta property=\"og:image:type\" content=\"image/png\" />\n  <meta property=\"og:image:width\" content=\"1200\" />\n  <meta property=\"og:image:height\" content=\"630\" />\n\n  <meta name=\"twitter:card\" content=\"summary_large_image\" />\n  <meta name=\"twitter:title\" content=\"{{ title }}\" />\n  <meta name=\"twitter:description\" content=\"{{ config.site_description }}\" />\n  <meta name=\"twitter:image\" content=\"{{ image_url }}\" />\n{% endblock %}\n\n{% block outdated %}\n  You're not viewing the latest version.\n  <a href=\"{{ '../' ~ base_url }}\">\n    <strong>Click here to go to latest.</strong>\n  </a>\n{% endblock %}\n
with TemporaryDirectory() as d:\n    with pytest.raises(ValueError) as e:\n        generator = \"random_name\"\n        image_path = None\n        prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n        _generate_image_url(d, generator, prompt)\n\n    print(e.value)\n
Invalid Option for generator. Valid options are: 'file' and 'dall_e'\n
with TemporaryDirectory() as d:\n    prompt = \"The quick brown fox jumps over a lazy dog\"\n    generator = \"dall_e\"\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n\n    _generate_image_url(root_path=d, generator=generator, prompt=prompt)\n\n#     with pytest.raises(Exception) as e:\n#     print(e.value)\n
with TemporaryDirectory() as d:\n    generator = \"file\"\n    image_path = \"invalid_image_path.png\"\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n    with pytest.raises(typer.Exit) as e:\n        _generate_image_url(\n            root_path=d, generator=generator, prompt=prompt, image_path=image_path\n        )\n\n    print(e.value)\n
Unexpected error: path /private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpy1rehpkv/invalid_image_path.png does not exists!\n
with TemporaryDirectory() as d:\n    prompt = \"The quick brown fox jumps over a lazy dog\"\n    generator = \"file\"\n    image_path = \"./valid_image_path.png\"\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"airt_icon_blue.svg\",\n        Path(d) / \"valid_image_path.png\",\n    )\n\n    image_url = _generate_image_url(\n        root_path=d, generator=generator, prompt=prompt, image_path=image_path\n    )\n\n    print(image_url)\n\n    assert image_url == str(Path(d).resolve() / image_path), str(\n        Path(d).resolve() / image_path\n    )\n
/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpyey8qlcd/valid_image_path.png\n
with TemporaryDirectory() as d:\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"airt_icon_blue.svg\",\n        Path(d) / \"valid_image_path.png\",\n    )\n\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n    generator = \"file\"\n\n    d_tmp = Path(d) / \"tmp\"\n    d_tmp.mkdir(parents=True)\n\n    image_path = \"../valid_image_path.png\"\n\n    image_url = _generate_image_url(\n        root_path=d_tmp, generator=generator, prompt=prompt, image_path=image_path\n    )\n\n    print(image_url)\n\n    assert image_url == str(Path(d).resolve() / \"valid_image_path.png\"), str(\n        Path(d).resolve() / \"valid_image_path.png\"\n    )\n
/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmppxyhbfkx/valid_image_path.png\n
with TemporaryDirectory() as d:\n    generator = \"file\"\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n    image_url = _generate_image_url(root_path=d, generator=generator, prompt=prompt)\n    print(image_url)\n    assert image_url == str(\n        (\n            Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"default_social_logo.png\"\n        ).resolve()\n    ), image_url\n
/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpghmlcy1v/mkdocs/docs_overrides/images/default_social_logo.png\n

source

"},{"location":"Social_Image_Generator/#generate_social_image","title":"generate_social_image","text":"
 generate_social_image (root_path:str, generator:str='file',\n                        prompt:str='Cute animal wearing hoodie sitting in\n                        high chair in purple room, browsing computer, 3d\n                        render', image_path:Optional[str]=None)\n

Generate a custom image for social card using the OpenAI Image API.

Args: root_path: The root path of the project. generator: Generator to use to create the social image. Valid options are: \u2018file\u2019 and \u2018dall_e\u2019. prompt: The prompt to use for generating the image. image_path: Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

for generator in [\"file\", \"dall_e\"]:\n    print(\"*\" * 120)\n    with TemporaryDirectory() as d:\n        mkdocs_dir_path = Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\"\n        mkdocs_dir_path.mkdir(exist_ok=True, parents=True)\n\n        mkdocs_yml_path = Path(d) / \"mkdocs\"\n        shutil.copyfile(\n            Path(\"..\") / \"mkdocs\" / \"mkdocs.yml\", (mkdocs_yml_path / \"mkdocs.yml\")\n        )\n\n        site_overrides_path = Path(d) / \"mkdocs\" / \"site_overrides\"\n        site_overrides_path.mkdir(exist_ok=True, parents=True)\n        shutil.copyfile(\n            Path(\"..\") / \"mkdocs\" / \"site_overrides\" / \"main.html\",\n            (site_overrides_path / \"main.html\"),\n        )\n\n        shutil.copyfile(\n            Path(\"..\")\n            / \"mkdocs\"\n            / \"docs_overrides\"\n            / \"images\"\n            / \"default_social_logo.png\",\n            mkdocs_dir_path / \"default_social_logo.png\",\n        )\n\n        prompt = \"The quick brown fox jumps over a lazy dog\"\n        await generate_social_image(root_path=d, prompt=prompt, generator=generator)\n\n        png_path = mkdocs_dir_path / \"social_image.png\"\n\n        assert png_path.exists()\n\n        yaml = YAML()\n        config = yaml.load((Path(d) / \"mkdocs/mkdocs.yml\"))\n        print(config[\"extra\"][\"social_image\"])\n        assert (\n            config[\"extra\"][\"social_image\"] == \"overrides/images/social_image.png\"\n        ), config[\"extra\"][\"social_image\"]\n\n        with open((site_overrides_path / \"main.html\"), \"r\", encoding=\"utf-8\") as f:\n            actual = f.read()\n        print(actual)\n        assert (\n            '{% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}'\n            in actual\n        ), actual\n
************************************************************************************************************************\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpviw_z2gw/mkdocs/docs_overrides/images/social_image.png'\noverrides/images/social_image.png\n{% extends \"base.html\" %}\n\n{% block extrahead %}\n  {% set title = config.site_name %}\n  {% if page and page.meta and page.meta.title %}\n    {% set title = title ~ \" - \" ~ page.meta.title %}\n  {% elif page and page.title and not page.is_homepage %}\n    {% set title = title ~ \" - \" ~ page.title | striptags %}\n  {% endif %}\n  {% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}\n  <meta property=\"og:type\" content=\"website\" />\n  <meta property=\"og:title\" content=\"{{ title }}\" />\n  <meta property=\"og:description\" content=\"{{ config.site_description }}\" />\n  <meta property=\"og:url\" content=\"{{ page.canonical_url }}\" />\n  <meta property=\"og:image\" content=\"{{ image_url }}\" />\n  <meta property=\"og:image:type\" content=\"image/png\" />\n  <meta property=\"og:image:width\" content=\"1200\" />\n  <meta property=\"og:image:height\" content=\"630\" />\n\n  <meta name=\"twitter:card\" content=\"summary_large_image\" />\n  <meta name=\"twitter:title\" content=\"{{ title }}\" />\n  <meta name=\"twitter:description\" content=\"{{ config.site_description }}\" />\n  <meta name=\"twitter:image\" content=\"{{ image_url }}\" />\n{% endblock %}\n\n{% block outdated %}\n  You're not viewing the latest version.\n  <a href=\"{{ '../' ~ base_url }}\">\n    <strong>Click here to go to latest.</strong>\n  </a>\n{% endblock %}\n\n\n\n************************************************************************************************************************\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp3j5_bo6n/mkdocs/docs_overrides/images/social_image.png'\noverrides/images/social_image.png\n{% extends \"base.html\" %}\n\n{% block extrahead %}\n  {% set title = config.site_name %}\n  {% if page and page.meta and page.meta.title %}\n    {% set title = title ~ \" - \" ~ page.meta.title %}\n  {% elif page and page.title and not page.is_homepage %}\n    {% set title = title ~ \" - \" ~ page.title | striptags %}\n  {% endif %}\n  {% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}\n  <meta property=\"og:type\" content=\"website\" />\n  <meta property=\"og:title\" content=\"{{ title }}\" />\n  <meta property=\"og:description\" content=\"{{ config.site_description }}\" />\n  <meta property=\"og:url\" content=\"{{ page.canonical_url }}\" />\n  <meta property=\"og:image\" content=\"{{ image_url }}\" />\n  <meta property=\"og:image:type\" content=\"image/png\" />\n  <meta property=\"og:image:width\" content=\"1200\" />\n  <meta property=\"og:image:height\" content=\"630\" />\n\n  <meta name=\"twitter:card\" content=\"summary_large_image\" />\n  <meta name=\"twitter:title\" content=\"{{ title }}\" />\n  <meta name=\"twitter:description\" content=\"{{ config.site_description }}\" />\n  <meta name=\"twitter:image\" content=\"{{ image_url }}\" />\n{% endblock %}\n\n{% block outdated %}\n  You're not viewing the latest version.\n  <a href=\"{{ '../' ~ base_url }}\">\n    <strong>Click here to go to latest.</strong>\n  </a>\n{% endblock %}\n
"},{"location":"Testing/","title":"Testing","text":"
import openai\n
"},{"location":"Testing/#mock_openai_image_create_for_notebook","title":"mock_openai_Image_create_for_notebook","text":"
 mock_openai_Image_create_for_notebook ()\n
"},{"location":"Testing/#mock_openai_image_create","title":"mock_openai_Image_create","text":"
 mock_openai_Image_create ()\n
with mock_openai_Image_create():\n    url = openai.Image.create(prompt=\"whatever\", n=1, size=\"512x512\")[\"data\"][0][\"url\"]\n\nassert (\n    url\n    == \"https://github.com/airtai/nbdev-mkdocs/raw/main/mkdocs/docs_overrides/images/default_social_logo.png\"\n)\n
mock_openai_Image_create_for_notebook()\n
url = openai.Image.create(prompt=\"whatever\", n=1, size=\"512x512\")[\"data\"][0][\"url\"]\n\nassert (\n    url\n    == \"https://github.com/airtai/nbdev-mkdocs/raw/main/mkdocs/docs_overrides/images/default_social_logo.png\"\n)\n
"},{"location":"Utils/","title":"Utils","text":"
import shutil\nfrom tempfile import TemporaryDirectory\n\nimport numpy as np\nimport pytest\n

source

"},{"location":"Utils/#set_cwd","title":"set_cwd","text":"
 set_cwd (cwd_path:Union[pathlib.Path,str])\n

Set the current working directory for the duration of the context manager.

Args: cwd_path: The path to the new working directory.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    with set_cwd(d):\n        assert (\n            Path(os.getcwd()) == Path(d).resolve()\n        ), f\"{os.getcwd()}, {Path(d).resolve()}\"\n

source

"},{"location":"Utils/#get_value_from_config","title":"get_value_from_config","text":"
 get_value_from_config (root_path:str, config_name:str)\n

Get a value from the configuration file.

Args: root_path: The root path of the configuration file. config_name: The name of the configuration to get.

Returns: The value of the configuration.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n    ret_val = get_value_from_config(d, \"lib_path\")\n    print(ret_val)\n    assert ret_val == \"nbdev_mkdocs\", ret_val\n\n    ret_val = get_value_from_config(d, \"repo\")\n    print(ret_val)\n    assert ret_val == \"nbdev-mkdocs\", ret_val\n\n    ret_val = get_value_from_config(d, \"user\")\n    print(ret_val)\n    assert ret_val == \"airtai\", ret_val\n
nbdev_mkdocs\nnbdev-mkdocs\nairtai\n

source

"},{"location":"Utils/#is_local_path","title":"is_local_path","text":"
 is_local_path (path:str)\n

Check if a path is a local path.

Args: path: The path to check.

Returns: True if the path is a local path, False otherwise.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

assert is_local_path(\"/tmp/abc/file.txt\")\nassert not is_local_path(\"http://www.example.com\")\n

source

"},{"location":"Utils/#add_counter_suffix_to_filename","title":"add_counter_suffix_to_filename","text":"
 add_counter_suffix_to_filename (src_path:pathlib.Path)\n

Add a counter suffix to the given file

Args: src_path: Path to the file to be renamed

Returns: None

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    file_path = Path(d) / \"social_image.txt\"\n    with open(file_path, \"w\", encoding=\"utf-8\") as f:\n        f.write(\"sample_text\")\n\n    add_counter_suffix_to_filename(file_path)\n\n    actual = [f.name for f in Path(d).glob(f\"{file_path.stem}*.*\")]\n    print(actual)\n\n    expected = [\"social_image.1.txt\"]\n    np.testing.assert_array_equal(actual, expected)\n\n    assert not file_path.exists()\n    assert (Path(d) / \"social_image.1.txt\").exists()\n
['social_image.1.txt']\n
with TemporaryDirectory() as d:\n    for i in [\n        \"social_image.txt\",\n        \"social_image.1.txt\",\n        \"social_image.2.txt\",\n        \"social_image.11.txt\",\n    ]:\n        file_path = Path(d) / i\n        with open(file_path, \"w\", encoding=\"utf-8\") as f:\n            f.write(\"sample_text\")\n\n    file_path = Path(d) / \"social_image.txt\"\n    add_counter_suffix_to_filename(file_path)\n\n    actual = sorted([f.name for f in Path(d).glob(f\"{file_path.stem}*.*\")])\n    print(actual)\n    expected = sorted(\n        [\n            \"social_image.1.txt\",\n            \"social_image.2.txt\",\n            \"social_image.11.txt\",\n            \"social_image.12.txt\",\n        ]\n    )\n    np.testing.assert_array_equal(actual, expected)\n\n    assert not file_path.exists()\n    assert (Path(d) / \"social_image.12.txt\").exists()\n
['social_image.1.txt', 'social_image.11.txt', 'social_image.12.txt', 'social_image.2.txt']\n

source

"},{"location":"Utils/#raise_error_and_exit","title":"raise_error_and_exit","text":"
 raise_error_and_exit (message:str)\n

Raise an error and exit

Args: message: The error message to display

Returns: None

Raises: typer.Exit: If the error message is not provided

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

with pytest.raises(typer.Exit) as e:\n    raise_error_and_exit(\"testing!!!\")\n
testing!!!\n
"},{"location":"api/nbdev_mkdocs/docstring/run_examples_from_docstring/","title":"run_examples_from_docstring","text":""},{"location":"api/nbdev_mkdocs/docstring/run_examples_from_docstring/#nbdev_mkdocs.docstring.run_examples_from_docstring","title":"nbdev_mkdocs.docstring.run_examples_from_docstring(o: Any, *, supress_stdout: bool = False, supress_stderr: bool = False, sub_dict: Optional[Dict[str, str]] = None, width: Optional[int] = 80, **kwargs: str) -> None","text":"

Runs example from a docstring

Parses docstring of an objects looking for examples. The examples are then saved into files and executed in a separate process.

Note

Execution context is not the same as the one in the notebook because we want examples to work from user code. Make sure you compiled the library prior to executing the examples, otherwise you might be running them agains an old version of the library.

Parameters:

Name Type Description Default o Any

an object, typically a function or a class, for which docstring is being parsed for examples

required supress_stdout bool

omit stdout from output, typically due to security considerations

False supress_stderr bool

omit stderr from output, typically due to security considerations

False sub_dict Optional[Dict[str, str]]

a dictionary mapping regexp patterns into replacement strings used to mask stdout and stderr, typically used to mask sensitive information such as passwords

None **kwargs str

arguments use to replace \"{fill in param}\" in docstring with the actual values when running examples

{}

Raises:

Type Description ValueError

if some params are missing from the kwargs

RuntimeException

if example fails

Example
from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\ndef f():\n    ```python\n    Example:\n        print(\"Hello {fill in name}!\")\n        print(\"Goodbye {fill in other_name}!\")\n    ```\n    pass\n\n\nrun_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")\n

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/docstring.py
def run_examples_from_docstring(\n    o: Any,\n    *,\n    supress_stdout: bool = False,\n    supress_stderr: bool = False,\n    sub_dict: Optional[Dict[str, str]] = None,\n    width: Optional[int] = 80,\n    **kwargs: str,\n) -> None:\n    \"\"\"Runs example from a docstring\n\n    Parses docstring of an objects looking for examples. The examples are then saved into files and executed\n    in a separate process.\n\n    Note:\n        Execution context is not the same as the one in the notebook because we want examples to work from\n        user code. Make sure you compiled the library prior to executing the examples, otherwise you might\n        be running them agains an old version of the library.\n\n    Args:\n        o: an object, typically a function or a class, for which docstring is being parsed for examples\n        supress_stdout: omit stdout from output, typically due to security considerations\n        supress_stderr: omit stderr from output, typically due to security considerations\n        sub_dict: a dictionary mapping regexp patterns into replacement strings used to mask stdout and\n            stderr, typically used to mask sensitive information such as passwords\n\n        **kwargs: arguments use to replace \"{fill in **param**}\" in docstring with the actual values when running examples\n\n    Raises:\n        ValueError: if some params are missing from the **kwargs**\n        RuntimeException: if example fails\n\n    Example:\n        ```python\n        from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n        def f():\n            ```python\n            Example:\n                print(\"Hello {fill in name}!\")\n                print(\"Goodbye {fill in other_name}!\")\n            ```\n            pass\n\n\n        run_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")\n        ```\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    console = Console(width=width)\n\n    examples = _extract_examples_from_docstring(o)\n    if len(examples) == 0:\n        raise ValueError(f\"No examples found in:\\n{o.__doc__}\")\n\n    executable_examples = _replace_keywords(examples, **kwargs)\n    for example, executable_example in zip(examples, executable_examples):\n        with TemporaryDirectory() as d:\n            cmd_path = (Path(d) / \"example.py\").absolute()\n            with open(cmd_path, \"w\", encoding=\"utf-8\") as f:\n                f.write(executable_example)\n            process = run(  # nosec: B603\n                [sys.executable, str(cmd_path)], capture_output=True, text=True\n            )\n            group = Group(\n                \"Example:\",\n                Rule(\"code\"),\n                textwrap.indent(example, \" \" * 4),\n                _format_output(\n                    process.stdout,\n                    title=\"stdout\",\n                    supress=supress_stdout,\n                    sub_dict=sub_dict,\n                    width=width,\n                ),\n                _format_output(\n                    process.stderr,\n                    title=\"stderr\",\n                    supress=supress_stderr,\n                    sub_dict=sub_dict,\n                    width=width,\n                ),\n            )\n            #             print(Panel(panel_group, width=width))\n            console.print(group)\n            if process.returncode != 0:\n                raise RuntimeError(process.stderr)\n
"},{"location":"api/nbdev_mkdocs/mkdocs/nbdev_mkdocs_docs/","title":"nbdev_mkdocs_docs","text":""},{"location":"api/nbdev_mkdocs/mkdocs/nbdev_mkdocs_docs/#nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs","title":"nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs(root_path: str, refresh_quarto_settings: bool = False, use_relative_doc_links: bool = False, no_mkdocs_build: bool = False) -> None","text":"

Prepare mkdocs documentation

Parameters:

Name Type Description Default root_path str

The root path of the project

required refresh_quarto_settings bool

Flag to refresh quarto yml file. This flag should be set to True if this function is called directly without calling prepare.

False use_relative_doc_links bool

If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview.

False no_mkdocs_build bool

If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview.

False

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
def nbdev_mkdocs_docs(\n    root_path: str,\n    refresh_quarto_settings: bool = False,\n    use_relative_doc_links: bool = False,\n    no_mkdocs_build: bool = False,\n) -> None:\n    \"\"\"Prepare mkdocs documentation\n\n    Args:\n        root_path: The root path of the project\n        refresh_quarto_settings: Flag to refresh quarto yml file. This flag should be set to `True`\n            if this function is called directly without calling prepare.\n        use_relative_doc_links: If set to True, relative links are added to symbol references in generated\n            documentation. Else, the value set in doc_host in settings.ini is added to symbol references in\n            generated documentation. This flag should be set to `False` if this function is called directly\n            without calling preview.\n        no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag should be set to\n            `False` if this function is called directly without calling preview.\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    with set_cwd(root_path):\n        if refresh_quarto_settings:\n            refresh_quarto_yml()\n\n        _copy_cname_if_needed(root_path)\n\n        _copy_docs_overrides(root_path)\n\n        lib_name = get_value_from_config(root_path, \"lib_name\")\n        lib_path = get_value_from_config(root_path, \"lib_path\")\n\n        cache_path = proc_nbs(force=True)\n        nbdev_lookup = NbdevLookup(incl_libs=lib_name.replace(\"_\", \"-\"))\n        docs_versioning = get_value_from_config(root_path, \"docs_versioning\")\n        lib_version = get_value_from_config(root_path, \"version\")\n        _fix_sym_links_in_nbs(\n            root_path,\n            cache_path,\n            nbdev_lookup,\n            docs_versioning,\n            lib_version,\n            use_relative_doc_links,\n        )\n\n        _build_summary(root_path, lib_path, cache_path)\n\n        if not no_mkdocs_build:\n            cmd = f\"mkdocs build -f \\\"{(Path(root_path) / 'mkdocs' / 'mkdocs.yml').resolve()}\\\"\"\n            _sprun(cmd)\n
"},{"location":"api/nbdev_mkdocs/mkdocs/new/","title":"new","text":""},{"location":"api/nbdev_mkdocs/mkdocs/new/#nbdev_mkdocs.mkdocs.new","title":"nbdev_mkdocs.mkdocs.new(root_path: str) -> None","text":"

Initialize mkdocs project files

Creates mkdocs directory in the root_path directory and populates it with initial values. You should edit mkdocs.yml file to customize it if needed.

Parameters:

Name Type Description Default root_path str

The path to the root of the project

required

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
def new(root_path: str) -> None:\n    \"\"\"Initialize mkdocs project files\n\n    Creates **mkdocs** directory in the **root_path** directory and populates\n    it with initial values. You should edit mkdocs.yml file to customize it if\n    needed.\n\n    Args:\n        root_path: The path to the root of the project\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    _create_mkdocs_dir(root_path)\n    _create_mkdocs_yaml(root_path)\n    _create_summary_template(root_path)\n    _replace_ghp_deploy_action(root_path)\n    _update_gitignore_file(root_path)\n    _generate_default_social_image_link(root_path)\n
"},{"location":"api/nbdev_mkdocs/mkdocs/prepare/","title":"prepare","text":""},{"location":"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare","title":"nbdev_mkdocs.mkdocs.prepare(root_path: str, use_relative_doc_links: bool = False, no_test: bool = False, no_mkdocs_build: bool = False) -> None","text":"

Prepare mkdocs for serving

Parameters:

Name Type Description Default root_path str

The root path of the project

required use_relative_doc_links bool

If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview.

False no_test bool

If set to False, the unit tests will be run, else they will be skipped

False no_mkdocs_build bool

If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview

False

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
def prepare(\n    root_path: str,\n    use_relative_doc_links: bool = False,\n    no_test: bool = False,\n    no_mkdocs_build: bool = False,\n) -> None:\n    \"\"\"Prepare mkdocs for serving\n\n    Args:\n        root_path: The root path of the project\n        use_relative_doc_links: If set to True, relative links are added to symbol references in generated\n            documentation. Else, the value set in doc_host in settings.ini is added to symbol references in\n            generated documentation. This flag should be set to `False` if this function is called directly\n            without calling preview.\n        no_test: If set to False, the unit tests will be run, else they will be skipped\n        no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag\n            should be set to `False` if this function is called directly without calling preview\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    with set_cwd(root_path):\n        if no_test:\n            nbdev_export.__wrapped__()\n            refresh_quarto_yml()\n        else:\n            nbdev_export.__wrapped__()\n            nbdev_test.__wrapped__()\n            nbdev_clean.__wrapped__()\n            refresh_quarto_yml()\n\n    nbdev_mkdocs_docs(\n        root_path=root_path,\n        use_relative_doc_links=use_relative_doc_links,\n        no_mkdocs_build=no_mkdocs_build,\n    )\n
"},{"location":"api/nbdev_mkdocs/mkdocs/preview/","title":"preview","text":""},{"location":"api/nbdev_mkdocs/mkdocs/preview/#nbdev_mkdocs.mkdocs.preview","title":"nbdev_mkdocs.mkdocs.preview(root_path: str, use_relative_doc_links: bool, port: Optional[int] = None) -> None","text":"

Preview the mkdocs documentation.

Parameters:

Name Type Description Default root_path str

The root path of the documentation.

required use_relative_doc_links bool

If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation.

required port Optional[int]

The port to serve the documentation on.

None

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
def preview(\n    root_path: str, use_relative_doc_links: bool, port: Optional[int] = None\n) -> None:\n    \"\"\"Preview the mkdocs documentation.\n\n    Args:\n        root_path: The root path of the documentation.\n        use_relative_doc_links: If set to True, relative links are added to symbol references in generated\n            documentation. Else, the value set in doc_host in settings.ini is added to symbol references in\n            generated documentation.\n        port: The port to serve the documentation on.\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    with set_cwd(root_path):\n        prepare(\n            root_path=root_path,\n            use_relative_doc_links=use_relative_doc_links,\n            no_test=True,\n            no_mkdocs_build=True,\n        )\n\n        cmd = f\"mkdocs serve -f {root_path}/mkdocs/mkdocs.yml -a 0.0.0.0\"\n        if port:\n            cmd = cmd + f\":{port}\"\n\n        with subprocess.Popen(  # nosec B603:subprocess_without_shell_equals_true\n            shlex.split(cmd),\n            stdout=subprocess.PIPE,\n            bufsize=1,\n            text=True,\n            universal_newlines=True,\n        ) as p:\n            for line in p.stdout:  # type: ignore\n                print(line, end=\"\")\n\n        if p.returncode != 0:\n            typer.secho(\n                f\"Command cmd='{cmd}' failed!\",\n                err=True,\n                fg=typer.colors.RED,\n            )\n            raise typer.Exit(6)\n
"},{"location":"api/nbdev_mkdocs/social_image_generator/generate_social_image/","title":"generate_social_image","text":""},{"location":"api/nbdev_mkdocs/social_image_generator/generate_social_image/#nbdev_mkdocs.social_image_generator.generate_social_image","title":"nbdev_mkdocs.social_image_generator.generate_social_image(root_path: str, generator: str = 'file', prompt: str = 'Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render', image_path: Optional[str] = None) -> None async","text":"

Generate a custom image for social card using the OpenAI Image API.

Parameters:

Name Type Description Default root_path str

The root path of the project.

required generator str

Generator to use to create the social image. Valid options are: 'file' and 'dall_e'.

'file' prompt str

The prompt to use for generating the image.

'Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render' image_path Optional[str]

Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used.

None

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/social_image_generator.py
async def generate_social_image(\n    root_path: str,\n    generator: str = \"file\",\n    prompt: str = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\",\n    image_path: Optional[str] = None,\n) -> None:\n    \"\"\"Generate a custom image for social card using the OpenAI Image API.\n\n    Args:\n        root_path: The root path of the project.\n        generator: Generator to use to create the social image. Valid options are: 'file' and 'dall_e'.\n        prompt: The prompt to use for generating the image.\n        image_path: Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used.\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    image_url = _generate_image_url(root_path, generator, prompt, image_path)\n\n    await _create_social_image(root_path, image_url)\n\n    _update_social_image_in_mkdocs_yml(root_path, image_url)\n\n    _update_social_image_in_site_overrides(root_path)\n
"},{"location":"cli/nbdev_mkdocs/","title":"nbdev_mkdocs","text":"

Usage:

$ nbdev_mkdocs [OPTIONS] COMMAND [ARGS]...\n

Options:

  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

Commands:

  • delete-pre-release-docs: Deletes deployed pre-release documentation...
  • docs: Prepares files in 'mkdocs/docs' and then...
  • docstring: Command for adding docstrings to classes...
  • new: Creates files in 'mkdocs' subdirectory...
  • prepare: Runs tests and prepares files in...
  • preview: Prepares files in 'mkdocs/docs' and then...
  • readme: Updates the README.md file from the...
  • social-image: Command for generating a custom social...
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-delete-pre-release-docs","title":"nbdev_mkdocs delete-pre-release-docs","text":"

Deletes deployed pre-release documentation versions.

Usage:

$ nbdev_mkdocs delete-pre-release-docs [OPTIONS]\n

Options:

  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-docs","title":"nbdev_mkdocs docs","text":"

Prepares files in 'mkdocs/docs' and then runs 'mkdocs build' command on them.

Usage:

$ nbdev_mkdocs docs [OPTIONS]\n

Options:

  • --root-path TEXT: Project's root path. [default: .]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-docstring","title":"nbdev_mkdocs docstring","text":"

Command for adding docstrings to classes and methods that don't have one using docstring-gen library.

Usage:

$ nbdev_mkdocs docstring [OPTIONS] COMMAND [ARGS]...\n

Options:

  • --help: Show this message and exit.

Commands:

  • generate: Add docstring to classes and methods that...
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-docstring-generate","title":"nbdev_mkdocs docstring generate","text":"

Add docstring to classes and methods that don't have one using docstring-gen library.

Usage:

$ nbdev_mkdocs docstring generate [OPTIONS]\n

Options:

  • -p, --path TEXT: The path to the directory containing Jupyter notebooks. If None, then the \"nbs_path\" from the settings.ini will be used.
  • --include-auto-gen-txt / --no-include-auto-gen-txt: If set to True, a note indicating that the docstring was autogenerated by docstring-gen library will be added to the end. [default: include-auto-gen-txt]
  • -f, --force-recreate-auto-generated: If set to True, the autogenerated docstrings from the previous runs will be replaced with the new one.
  • --model TEXT: The name of the OpenAI model that will be used to generate docstrings. [default: gpt-3.5-turbo]
  • --temperature FLOAT RANGE: Setting the temperature close to zero produces better results, whereas higher temperatures produce more complex, and sometimes irrelevant docstrings. [default: 0.2; 0.0<=x<=2.0]
  • --max-tokens INTEGER: The maximum number of tokens to be used when generating a docstring for a function or class. Please note that a higher number will deplete your token quota faster. [default: 250]
  • --top-p FLOAT RANGE: You can also specify a top-P value from 0-1 to achieve similar results to changing the temperature. According to the Open AI documentation, it is generally recommended to change either this or the temperature but not both. [default: 1.0; 0.0<=x<=1.0]
  • --n INTEGER: The number of docstrings to be generated for each function or class, with the best one being added to the source code. Please note that a higher number will deplete your token quota faster. [default: 3]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-new","title":"nbdev_mkdocs new","text":"

Creates files in 'mkdocs' subdirectory needed for other 'nbdev_mkdocs' subcommands.

Usage:

$ nbdev_mkdocs new [OPTIONS]\n

Options:

  • --root-path TEXT: [default: .]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-prepare","title":"nbdev_mkdocs prepare","text":"

Runs tests and prepares files in 'mkdocs/docs' and then runs 'mkdocs build' command on them.

Usage:

$ nbdev_mkdocs prepare [OPTIONS]\n

Options:

  • --root-path TEXT: [default: .]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-preview","title":"nbdev_mkdocs preview","text":"

Prepares files in 'mkdocs/docs' and then runs 'mkdocs serve' command on them.

Usage:

$ nbdev_mkdocs preview [OPTIONS]\n

Options:

  • --root-path TEXT: path under which mkdocs directory will be created [default: .]
  • --use-relative-doc-links / --use-host-doc-links: If set to --use-relative-doc-links, relative links are added to symbol references in generated documentation. If set to --use-host-doc-links, the value set in doc_host in settings.ini is added to symbol references in generated documentation. [default: use-relative-doc-links]
  • --port INTEGER: port to use [default: 4000]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-readme","title":"nbdev_mkdocs readme","text":"

Updates the README.md file from the 'readme_nb' notebook. Unless explicitly changed in the settings.ini file, the 'readme_nb' points to the 'index.ipynb' notebook in the 'nbs_path' directory.

Usage:

$ nbdev_mkdocs readme [OPTIONS]\n

Options:

  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-social-image","title":"nbdev_mkdocs social-image","text":"

Command for generating a custom social share image.

Usage:

$ nbdev_mkdocs social-image [OPTIONS] COMMAND [ARGS]...\n

Options:

  • --help: Show this message and exit.

Commands:

  • generate: Generate a custom social share image.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-social-image-generate","title":"nbdev_mkdocs social-image generate","text":"

Generate a custom social share image.

Usage:

$ nbdev_mkdocs social-image generate [OPTIONS]\n

Options:

  • --root-path TEXT: Project's root path. [default: .]
  • --generator [file|dall_e]: Generator to use to create the social image. Valid options are: 'file' and 'dall_e'. Choose 'file' if you want to use an existing image from your local machine in the social share image. [default: file]
  • --prompt TEXT: The prompt to use for generating the image. Please pass this option only when using 'dall_e' as the generator. [default: Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render]
  • --image-path TEXT: Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used. Please pass this option only when using 'file' as the generator.
  • --help: Show this message and exit.
"},{"location":"guides/Adding_Guides/","title":"Adding guides","text":"

With Material for nbdev, you can easily add a step-by-step tutorial or comprehensive how-to guide in your documentation.

All you need to do is add the new notebooks to your notebook directory (The directory set in nbs_path in your project\u2019s settings.ini file) and run nbdev_mkdocs preview to preview the documentation. The information from the newly added notebooks will automatically populate in the navigation, making it easily accessible to your audience.

Note

If you have set the custom_sidebar=True your project's settings.ini file, the newly added guide or tutorial will not appear in navigation automatically. To make it appear, manually edit the project's sidebar.yml or _quarto.yml file and include the sections and contents.

"},{"location":"guides/Adding_Guides/#adding-a-new-guide","title":"Adding a new guide","text":"

Now, let\u2019s add a new guide to our nbdev_mkdocs_tutorial project. Run the following command from the project\u2019s root directory to create a new guides directory:

mkdir nbs/guides\n

From the Jupyter home tab, navigate to the guides directory and create a new notebook by clicking on the New dropdown menu. Rename the notebook as Guide_01_Hello_World and create a new markdown cell with the following contents. This will be the title of the guide:

# Hello World\n

If everything is done correctly, the guides directory will look like this:

Now, run the following command in the terminal to preview the changes in the browser:

nbdev_mkdocs preview\n

The sidebar will now have a new menu called Guides, and when you click on it, the documentation should look like this:

Now, add another markdown cell just below the title cell and paste the following content:

This is an example of a guide.\n

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview the changes.

Click on Guides menu in the sidebar, and the documentation should look like this:

"},{"location":"guides/Adding_Guides/#adding-images-to-the-guide","title":"Adding images to the guide","text":"

In the guides, you can include images from your computer as well as images from the internet.

"},{"location":"guides/Adding_Guides/#adding-an-external-image","title":"Adding an external image","text":"

Let\u2019s add an image from the internet to our guide. To keep things simple, we\u2019ll add the nbdev_mkdocs_tutorial repo\u2019s GitHub CI badge to our guide.

Copy and paste the below URL in your preferred browser to view the CI status badge for the nbdev_mkdocs_tutorial repo:

Note

In the following URL:

  • Replace {user} with your github username
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
https://github.com/{user}/nbdev_mkdocs_tutorial/actions/workflows/test.yaml/badge.svg\n

Make a new markdown cell at the bottom of the Guide_01_Hello_World.ipynb notebook and paste the below content

Note

In the following URL:

  • Replace {user} with your github username
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
From internet:\n![](https://github.com/{user}/nbdev_mkdocs_tutorial/actions/workflows/test.yaml/badge.svg)\n

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Click on Guides menu in the sidebar, and the documentation should look like this:

"},{"location":"guides/Adding_Guides/#adding-a-local-image","title":"Adding a local image","text":"

For adding images from your computer, the images must be saved within your notebook directory (The directory set in nbs_path in your project\u2019s settings.ini file). Let\u2019s make a directory called images within the guides directory and save the CI status badge image as badge.svg.

Note

The directory name images is used as an example. You can refer to images located in any directory as long as they are inside your project's notebook directory (The directory set in nbs_path in your project's settings.ini file).

Duplicate the above cell and replace From internet: text with From local: and http url with images/badge.svg

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Click on Guides menu in the sidebar, and the documentation should look like this:

"},{"location":"guides/Adding_Release_Notes/","title":"Adding release notes","text":"

Material for nbdev uses CHANGELOG.md as release notes in the documentation. If the CHANGELOG.md file is not found in the project root directory, a default page under the Releases tab will be displayed, explaining how to generate the CHANGELOG.md, as shown below:

Let\u2019s follow the above steps and create a CHANGELOG.md file for our nbdev_mkdocs_tutorial project.

Note

You'll need a GitHub personal access token to generate the changelog. Please see the nbdev documentation for more information on how to create and configure a new token.

Now, copy your GitHub personal access token and paste it into a file called token in the root of your repository. To do so, run the following command from the project root directory:

Note

  • In the following command replace {XXX} with your GitHub personal access token.
echo {XXX} > token\n

Also, ensure that the token file isn\u2019t added to git, by running this in your terminal

echo token >> .gitignore\n

Now, run the following command from the project root directory to generate the changelog:

nbdev_changelog\n

The above command will generate the files CHANGELOG.md and CHANGELOG.bak in the project root directory. Run the following commands in the terminal to preview the changes in the browser:

nbdev_mkdocs preview\n

Now, please click on the Releases menu and the documentation should look like this:

"},{"location":"guides/Advanced_Customization_Options/","title":"Advanced customization options","text":"

Material for nbdev uses mkdocs.yml configuration file for generating documentation. This file is located in mkdocs/mkdocs.yml and is pre-configured with reasonable default settings. You can easily customize the documentation by modifying the mkdocs.yml file, such as changing the theme, adding new markdown extensions, and adjusting other settings.

"},{"location":"guides/Advanced_Customization_Options/#editing-pre-configured-css-file","title":"Editing pre-configured CSS file","text":"

In addition to changing the settings, you can make minor changes to the documentation by writing your own CSS and JavaScript.The easiest way is by editing the pre-configured CSS and JavaScript files inside mkdocs/docs_overrides directory:

.\n\u2514\u2500\u2500 mkdocs/\n    \u2514\u2500\u2500 docs_overrides/\n        \u251c\u2500\u2500 css/\n        \u2502   \u2514\u2500\u2500 extra.css\n        \u251c\u2500\u2500 js/\n        \u2502   \u2514\u2500\u2500 extra.js\n        \u2514\u2500\u2500 images/\n            \u2514\u2500\u2500 compass-outline.png\n

Note

The docs_overrides directory will be created only once when you run the nbdev_mkdocs new command; please ensure that you add this folder to git to preserve your changes.

"},{"location":"guides/Advanced_Customization_Options/#changing-the-favicon","title":"Changing the favicon","text":"

You can easily change the default favicon by adding the new image to the mkdocs/docs_overrides/images directory and referencing it in the mkdocs.yml file.

In mkdocs.yml, replace the default image name compass-outline.png with the new favicon image name:

favicon: images/{new_fav_icon_name}\n
"},{"location":"guides/Advanced_Customization_Options/#adding-a-new-css-file","title":"Adding a new CSS file","text":"

If you want to change the colours or spacing of certain elements, edit the extra.css file in the mkdocs/docs_overrides/css directory. The file is already configured in the mkdocs.yml file, and after making the changes, save the file, stop the server and re-run the nbdev_mkdocs preview command to preview your changes in the browser.

"},{"location":"guides/Advanced_Customization_Options/#adding-a-new-javascript-file","title":"Adding a new JavaScript file","text":"

If you want to integrate another syntax highlighter or add some custom logic to your theme, edit the extra.js file in the mkdocs/docs_overrides/js directory. The file is already configured in the mkdocs.yml file, and after making the changes, save the file, stop the server and re-run the nbdev_mkdocs preview command to preview your changes in the browser.

Please refer to the Material for Mkdocs documentation for more customization options.

"},{"location":"guides/Advanced_Customization_Options/#using-mathematical-formulas","title":"Using Mathematical formulas","text":"

MathJax is being already set up as described here.

"},{"location":"guides/Advanced_Customization_Options/#using-the-block-syntax","title":"Using the block syntax","text":"

Blocks must be enclosed in $$...$$ or \\[...\\] on separate lines:

$$\n\\operatorname{ker} f=\\{g\\in G:f(g)=e_{H}\\}{\\mbox{.}}\n$$\n
\\[ \\operatorname{ker} f=\\{g\\in G:f(g)=e_{H}\\}{\\mbox{.}} \\]"},{"location":"guides/Advanced_Customization_Options/#using-the-inline-block-syntax","title":"Using the inline block syntax","text":"

Inline blocks must be enclosed in $...$ or \\(...\\):

The homomorphism $f$ is injective if and only if its kernel is only the \nsingleton set $e_G$, because otherwise $\\exists a,b\\in G$ with $a\\neq b$ such \nthat $f(a)=f(b)$.\n

The homomorphism \\(f\\) is injective if and only if its kernel is only the singleton set \\(e_G\\), because otherwise \\(\\exists a,b\\in G\\) with \\(a\\neq b\\) such that \\(f(a)=f(b)\\).

"},{"location":"guides/Auto_Generating_Docstrings/","title":"Auto-generating docstrings","text":"

Documenting existing code can be difficult and time-consuming because it requires understanding the code\u2019s intent and purpose, which may not always be clear or immediately obvious.

Material for nbdev simplifies the task of documenting existing code by automatically creating Google-style docstrings for classes and methods which don\u2019t have one. Material for nbdev internally uses the docstring-gen library and OpenAI\u2019s Codex AI model for generating clear and informative docstrings.

"},{"location":"guides/Auto_Generating_Docstrings/#adding-docstring","title":"Adding docstring","text":"

By running the following CLI command, you can add docstrings to a single Python file, a Jupyter notebook, or a directory containing these files.

Note

The OpenAI API uses API keys for authentication. Please create one and set it in the OPENAI_API_KEY environment variable before running the below command.

nbdev_mkdocs docstring generate -p {source_file_or_directory}\n

For example, a function like below without the docstring:

def concatenate_strings(s1: str, s2: str) -> str:\n    if not isinstance(s1, str) or not isinstance(s2, str):\n        raise TypeError(\"Both arguments should be strings.\")\n    return s1 + s2\n

will become similar to:

def concatenate_strings(s1: str, s2: str) -> str:\n    \"\"\"Concatenate two strings.\n\n    Args:\n        s1: First string\n        s2: Second string\n\n    Returns:\n        The concatenated string\n\n    Raises:\n        TypeError: If s1 or s2 is not a string\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    if not isinstance(s1, str) or not isinstance(s2, str):\n        raise TypeError(\"Both arguments should be strings.\")\n    return s1 + s2\n
"},{"location":"guides/Auto_Generating_Docstrings/#regenerating-the-docstring","title":"Regenerating the docstring","text":"

If you wish to regenerate the docstrings, you can re-run the command with the -f flag, which will remove the previous auto-generated docstrings and replace them with new ones.

nbdev_mkdocs docstring generate -p {source_file_or_directory} -f\n

Note

By default, the command only adds docstrings to missing functions and classes. It won't overwrite previously generated docstrings if the -f flag is not provided during re-run.

"},{"location":"guides/Auto_Generating_Docstrings/#regenerating-the-docstring-without-note","title":"Regenerating the docstring without note","text":"

If you prefer not to include the text \u201cautogenerated by docstring-gen library\u201d in the generated docstrings, you can use the --no-include-auto-gen-txt flag when running the command.

nbdev_mkdocs docstring generate -p {source_file_or_directory} -f --no-include-auto-gen-txt\n

Now the docstring for the above function will look similar to:

def concatenate_strings(s1: str, s2: str) -> str:\n    \"\"\"Concatenate two strings.\n\n    Args:\n        s1: First string\n        s2: Second string\n\n    Returns:\n        The concatenated string\n\n    Raises:\n        TypeError: If s1 or s2 is not a string\n    \"\"\"\n    if not isinstance(s1, str) or not isinstance(s2, str):\n        raise TypeError(\"Both arguments should be strings.\")\n    return s1 + s2\n

Note

The text \u201cautogenerated by docstring-gen library\u201d is used to identify which docstrings were generated by the library. When the --no-include-auto-gen-txt flag is used, this text will not be included in the generated docstrings. As a result, when re-running the command with the -f flag, these docstrings will not be replaced.\u201d

Alternatively, you can manually delete the \u201cautogenerated by docstring-gen library\u201d (starting from the !!! note until the end) text from the classes and functions for which you think the auto-generated docstring is appropriate, and then re-run the command using the -f flag to update the remaining auto-generated docstrings.

"},{"location":"guides/Auto_Generating_Docstrings/#additional-settings","title":"Additional settings","text":"

In addition to the -f and --no-include-auto-gen-txt flags, you can also customize the behavior of the CLI command by adjusting other parameters such as --model, --temperature, etc., For more information on these options and how to use them, please refer to the OpenAI\u2019s documentation.

"},{"location":"guides/Auto_Generating_Docstrings/#jupyter-notebook-extension","title":"Jupyter notebook extension","text":"

We have created a user-friendly notebook extension for the docstring-gen library. This extension provides a convenient way to document your code cell-by-cell, rather than having to document the entire notebook all at once. To install the extension, simply run the following commands in your terminal:

Note

Please ensure jupyter-contrib-nbextensions is installed before installing the docstring-gen library extension

jupyter nbextension install https://github.com/airtai/jupyter-docstring-gen/archive/main.zip --user\njupyter nbextension enable jupyter-docstring-gen-main/jupyter-docstring-gen\n

After successful installation, you will see a new button on your jupyter notebook toolbar. This button allows you to easily generate docstrings for your Python code and improve your documentation.

For more detailed information, please refer to this link.

"},{"location":"guides/Basic_User_Guide/","title":"Basic User Guide","text":"

This guide will walk you through the process of creating documentation for nbdev projects using Material for nbdev.

"},{"location":"guides/Basic_User_Guide/#quick-summary","title":"Quick summary","text":"

Here\u2019s a quick comparison of Quarto and Material for nbdev development workflows:

Quarto workflow Material for nbdev workflow Install:
$ pip install notebook nbdev\n$ nbdev_install_quarto\n
Install:
$ pip install notebook nbdev\n$ nbdev_install_quarto\n$ pip install nbdev-mkdocs\n
Setup:
$ nbdev_new\n$ nbdev_install_hooks\n$ vi settings.ini\n$ pip install -e '.[dev]'\n
Setup:
$ nbdev_new\n$ nbdev_install_hooks\n$ vi settings.ini\n$ pip install -e '.[dev]'\n$ nbdev_mkdocs new\n$ vi mkdocs/mkdocs.yml\n
Development:
# Edit files\n$ nbdev_preview\n
Development:
# Edit files\n$ nbdev_mkdocs preview\n
Commit changes:
$ nbdev_prepare\n$ git commit -am \u201cCommit message\u201d\n$ git push\n
Commit changes:
$ nbdev_mkdocs prepare\n$ git commit -am \u201cCommit message\u201d\n$ git push\n
"},{"location":"guides/Basic_User_Guide/#installation","title":"Installation","text":"

To complete this tutorial, you will need the following software and Python library:

  1. Python
  2. pip Python package manager
  3. Jupyter Notebook
  4. nbdev
  5. Quarto
  6. nbdev-mkdocs

It is recommended to use a virtual environment for your Python projects. Virtual environments are a common and effective Python development technique that helps to keep dependencies required by different projects separate by creating isolated Python environments for them.

In this tutorial, we will be using Python\u2019s venv module to create a virtual environment.

Note

There are other great third-party tools for creating virtual environments, such as conda and virtualenv, For basic usage, venv is an excellent choice because it already comes packaged with your Python installation. Any of these tools can help you set up a Python virtual environment.

"},{"location":"guides/Basic_User_Guide/#creating-and-activating-a-new-python-virtual-environment","title":"Creating and activating a new Python virtual environment","text":"

To create a new virtual environment with venv, open a new terminal session in the root directory of your new project and run the command below:

python3 -m venv venv\n

The above command creates a new virtual environment called venv. Please feel free to change the name if necessary.

Now your project has its own virtual environment. Generally, before you start using it, you\u2019ll first need to activate the environment. Run the below command to activate your new virtual environment:

source venv/bin/activate\n
"},{"location":"guides/Basic_User_Guide/#installing-the-packages","title":"Installing the packages","text":"

Before we begin installing our project dependencies, let us first upgrade pip to ensure we are using the most recent packages by running the following command:

python3 -m pip install --upgrade pip\n

Now, install the Python packages required for our project by running the following command:

pip install notebook nbdev nbdev-mkdocs\n

Enter y (for yes) if prompted. Installation should take a few seconds, during which text will be printed in the terminal.

After installing the Python packages, run the following command in the terminal to install Quarto via nbdev\u2019s CLI command:

nbdev_install_quarto\n

If prompted, enter your password in the terminal to continue installing Quarto. You can read\u00a0the source code of the nbdev_install_quarto command for more information. Alternatively, you can follow the Quarto\u2019s official installation instructions.

"},{"location":"guides/Basic_User_Guide/#first-steps","title":"First steps","text":"

In this section, we will use the nbdev and nbdev-mkdocs commands to configure our new project with tests, continuous integration, and a documentation website built with Material for Mkdocs.

"},{"location":"guides/Basic_User_Guide/#creating-a-new-github-repo","title":"Creating a new GitHub repo","text":"

Create an empty GitHub repo using the convenient link github.com/new. If you get stuck, you might find GitHub\u2019s Create a repo page helpful.

For this example, let\u2019s name our repo nbdev_mkdocs_tutorial (feel free to change it) and add a nice description, as nbdev will use it later.

Note

Don\u2019t add a README file, .gitignore, or license file just yet. nbdev will create necessary files when we Initialise the repo with nbdev new command

If you\u2019re using the web interface, it should look something like this before you click Create Repository:

Now, click the Create Repository button to create a new repo.

You should then be redirected to your new repo:

Before we continue, there is one last step we need to do. Go to the Settings tab and click on Actions -> General on the left side. Scroll down to the bottom of the screen and find the Workflow Permissions section. Make sure the Read and Write permissions is selected. If it is not, change it and then click Save button.

Note

Please ensure that the Read and Write permissions is selected under the Workflow Permissions section or the deploy action will fail.

"},{"location":"guides/Basic_User_Guide/#initialising-your-repo-with-nbdev","title":"Initialising your repo with nbdev","text":"

Now clone your repo from the same terminal window. If you get stuck here, you might find GitHub\u2019s Cloning a repository page helpful.

Since we created a repo named nbdev_mkdocs_tutorial, we can clone it as follows:

Note

In the following command:

  • Replace {user} with your github username
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
git clone https://github.com/{user}/nbdev_mkdocs_tutorial.git\n

Then cd (change directory) to our repo:

Note

In the following command:

  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
cd nbdev_mkdocs_tutorial\n

nbdev provides the nbdev_new command to initialise an empty git repository. It\u2019ll infer information about your project from git and GitHub, and ask you to input anything remaining.

Let\u2019s initialise our repo with nbdev by entering the following command:

nbdev_new\n

It may ask you to enter information that it couldn\u2019t infer from git or GitHub.

Note

nbdev_new assumes that your package name is the same as your repo name (with - replaced by _). Use the --lib_name option if that isn\u2019t the case.

"},{"location":"guides/Basic_User_Guide/#initialising-your-repo-with-nbdev-mkdocs","title":"Initialising your repo with nbdev-mkdocs","text":"

After you\u2019ve installed nbdev-mkdocs, you can bootstrap your project documentation using the nbdev_mkdocs executable. From the project root directory and run the following command:

nbdev_mkdocs new\n

Using information from the project\u2019s settings.ini file, the above command creates files and directories required to build the documentation and saves it in the mkdocs subdirectory.

"},{"location":"guides/Basic_User_Guide/#previewing-the-docs-locally","title":"Previewing the docs locally","text":"

To preview the Mkdocs for Material documentation locally, we must first install our library. To do so, execute the following command from the project\u2019s root directory:

pip install -e '.[dev]'\n

Now, run the following command to preview your documentation:

nbdev_mkdocs preview\n

Note

If you encounter the error No module named nbdev_mkdocs_tutorial while executing the above command, please add your project root directory to the PYTHONPATH environment variable. One way to do this is by executing the following command from the project root directory.

    export PYTHONPATH=$PYTHONPATH:`pwd`\n

In our example, the documentation will be served at the following URL:

Note

  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it in the below command.
  • By default, the documentation will be served on port 4000. However, you can change the port by passing the --port argument to the nbdev_mkdocs preview command. For more information, please run the nbdev_mkdocs preview --help.
http://0.0.0.0:4000/nbdev_mkdocs_tutorial/\n

Now, copy and paste the above URL into your preferred browser, and the documentation should look something like this:

When you switch to the black theme, the page will look like this:

The website\u2019s navigation structure can be divided into two parts. The first section is built by reading the sidebar.yml or _quarto.yml file from the nbs directory. The second part of the navigation structure includes specific sections for the API, CLI, and Releases.

Now it\u2019s time to commit your changes to git and publish the documentation to GitHub Pages. We recommend running the nbdev_mkdocs prepare command in the terminal before committing to Git, which exports the library, tests and cleans notebooks, and generates the README file if necessary.

nbdev_mkdocs prepare\n

Finally, double-check your settings.ini file and push your changes to GitHub

Note

Before pushing to GitHub, please ensure that the latest version of nbdev-mkdocs is included in the dev_requirements section of the settings.ini file.

git add .\ngit commit -m'Initial commit'\ngit push\n
"},{"location":"guides/Basic_User_Guide/#checking-out-your-workflows-and-docs","title":"Checking out your workflows and docs","text":"

From the GitHub web interface, open GitHub Actions by clicking the Actions tab near the top of your repo page. You should see two workflow runs:

  1. CI - The CI workflow clears the unwanted metadata from notebook and runs the tests.
  2. Deploy to GitHub Pages \u2013 Builds your docs with Material for Mkdocs and deploys it to GitHub Pages.

Note that you\u2019ll need to enable GitHub Pages for your repo before you can access your docs website. We\u2019ll do that now.

Once the above two actions are completed successfully, you can enable it for your repo by clicking on the Settings tab near the top-right of your repo page, then Pages on the left, then setting the Branch to gh-pages, and finally clicking Save.

It should look similar to this after you click Save:

Head back to GitHub Actions and you should see a new workflow run: pages build and deployment. As the name says, this workflow deploys your website contents to GitHub Pages.

Wait for the workflow run to complete, then open your website. By default it should be available at:

Note

In the following URL:

  • Replace {user} with your github username.
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
https://{user}.github.io/nbdev_mkdocs_tutorial\n
"},{"location":"guides/Basic_User_Guide/#recap","title":"Recap","text":"

You now have a base nbdev repo with continuous integration and hosted documentation! Here\u2019s a recap of the steps you took:

  • Created a GitHub repo.
  • Initialised your repo with nbdev_new.
  • Initialised your repo with nbdev_mkdocs new.
  • Installed the package with pip install \u2018.[dev]\u2019.
  • Previewed the documentation with nbdev_mkdocs preview.
  • Exported the library, tested it, and cleaned the notebooks using nbdev_mkdocs prepare.
  • Pushed to GitHub.
"},{"location":"guides/Basic_User_Guide/#adding-documentation","title":"Adding documentation","text":"

In this section, you\u2019ll will learn how to add documentation for functions, classes, and CLI commands.

"},{"location":"guides/Basic_User_Guide/#installing-hooks-for-git-friendly-notebooks","title":"Installing hooks for git-friendly notebooks","text":"

When working with Jupyter notebooks in a new repo, the first step is to install nbdev\u2019s hooks. See Git-friendly Jupyter for more information.

Install the nbdev\u2019s hooks by running the following command into your terminal:

nbdev_install_hooks\n

Note

You can also add new requirements to your project by editing the settings.ini file. When you do so, please make sure to install the library locally by running pip install -e '.[dev]' command. Otherwise, you will not have the new requirements installed in your environment.

Now, let\u2019s start the Jupyter notebooks by executing the command below:

jupyter notebook\n

Note: Before continuing, please ensure that the jupyter notebook is running on the newly created virtual environment.

This should open the Jupyter home page in a new browser tab:

"},{"location":"guides/Basic_User_Guide/#documenting-a-function","title":"Documenting a function","text":"

Now, let\u2019s add a sample docstring to an existing function in 00_core.ipynb notebook. Please open the 00_core.ipynb notebook present inside the nbs directory and add the docstring Docstring for foo to the function foo, or copy and replace the cell contents with the below sample code:

#| export\ndef foo(): \n    \"\"\"Docstring for `foo`\"\"\"\n    pass\n

After adding the docstring, save the notebook and run the following command in the terminal to preview the changes in the browser:

nbdev_mkdocs preview\n

Click on the API menu in the sidebar, and the documentation should look like:

Now let\u2019s add a new function in the same notebook, create a new code cell below the foo function cell and paste the following code:

#| export\ndef say_hello(to: str) -> str:\n    \"\"\"Say hello to somebody\n\n    Args:\n        to: Name to say `hello`\n\n    Returns:\n        A string with `Hello` prepended to the `to`\n    \"\"\"\n    return f'Hello {to}'\n

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Click on the API menu in the sidebar, and the documentation should look like:

"},{"location":"guides/Basic_User_Guide/#documenting-a-class","title":"Documenting a class","text":"

Now, in the same notebook, create a new code cell below the say_hello function cell and paste the following code:

#| export\nclass HelloSayer:\n    \"\"\"Say hello to `to` using `say_hello`\"\"\"\n    def __init__(self, to): self.to = to\n\n    def say(self):\n        \"\"\"Do the saying\"\"\"\n        return say_hello(self.to)\n

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Click on the API menu in the sidebar, and the documentation should look like:

"},{"location":"guides/Basic_User_Guide/#documenting-a-cli-command","title":"Documenting a CLI command","text":"

Before we get started writing documentation for our first CLI command, let\u2019s take a look at what we already have in the CLI documentation. Just click on the CLI menu in the sidebar to view it. The documentation should look like:

This default page will be displayed when the console_scripts section of the settings.ini file does not include any command line executables.

Now let\u2019s move on to writing our first CLI command and adding it to the documentation.

Let\u2019s now convert our say_hello function into a command-line script and generate documentation for it by following the steps below:

Create a new code cell above the say_hello function cell and copy paste the below code to import the call_parse from fastcore:

#| export\nfrom fastcore.script import call_parse\n

Add the call_parse decorator to our say_hello function. After adding the decorator, the say_hello function should look like:

#| export\n@call_parse\ndef say_hello(to: str) -> str:\n    \"\"\"Say hello to somebody\n\n    Args:\n        to: Name to say `hello`\n\n    Returns:\n        A string with `Hello` prepended to the `to`\n    \"\"\"\n    return f'Hello {to}'\n

Save the notebook and run the following command from the project root directory to add the console script to the settings.ini file:

echo \"console_scripts = say_hello=nbdev_mkdocs_tutorial.core:say_hello\" >> settings.ini\n

Finally, run the following commands in the terminal to build the library and preview the changes in the browser:

pip install '.[dev]' && nbdev_mkdocs preview\n

Click on the CLI menu in the sidebar, and the documentation should look like:

nbdev-mkdocs will also generate documentation for CLI commands created using Typer and populates the same under the CLI tab.

"},{"location":"guides/Customizing_The_Sidebar/","title":"Customizing the sidebar","text":"

Material for nbdev makes it easy to customize the navigation in your project. You can modify the menu items by adding, deleting, or renaming them.

"},{"location":"guides/Customizing_The_Sidebar/#renaming-menu-items","title":"Renaming menu items","text":"

You can change the names of the API, CLI, and Releases menu items by editing the mkdocs/summary_template.txt file. This file is used to define the structure of your project\u2019s documentation.

Now, lets change navigation structure of our nbdev_mkdocs_tutorial project. We are going to rename the API menu to Reference in the sidebar. Please run the following command from the root directory of your project to open the file:

vi mkdocs/summary_template.txt\n

and replace the below line from - API to - Reference.

After making the change, the file will look like this:

{sidebar}\n- Reference\n{api}\n- CLI\n{cli}\n- [Releases]{changelog}\n

Save the file, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Now, the documentation should look like this:

"},{"location":"guides/Customizing_The_Sidebar/#removing-menu-items","title":"Removing menu items","text":"

You can also remove items from the side navigation in your project documentation. For example, let\u2019s say you want to remove the CLI menu. You can do this by modifying the same file.

Please run the following command from the root directory of your project to open the file:

vi mkdocs/summary_template.txt\n

and delete the below lines

- CLI\n{cli}\n

After making the change, the file will look like this:

{sidebar}\n- Reference\n{api}\n- [Releases]{changelog}\n

Save the file, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Now, the documentation should look like this:

"},{"location":"guides/Handling_Pandas_In_The_Output/","title":"Handling pandas in the output","text":"

Pandas is a widely used data manipulation library in the data science community. One common use case is to display the results of a data analysis in a Pandas DataFrame.

By default, the Pandas DataFrame output will appear unformatted in the documentation. For example, take a look at the sample below which displays the head of a dataframe.

import pandas as pd\n\ndf = pd.util.testing.makeDataFrame()\ndf.head()\n
| | A | B | C | D | |------------|-----------|-----------|-----------|----------| | vtQ4AqzUmR | -0.366719 | 0.728404 | 0.625120 | 2.480765 | | qiHhTHAHNH | -0.359968 | -0.599540 | 1.594778 | 0.921716 | | LOqytDK7SY | -0.627586 | 0.935781 | -1.592791 | 0.024485 | | WOG0u390DM | 0.105248 | -0.062309 | 0.878165 | 1.072234 | | eOrtbW98MM | -1.400879 | -0.260574 | -0.369980 | 1.760192 |"},{"location":"guides/Handling_Pandas_In_The_Output/#material-styled-table","title":"Material styled table","text":"

A simple solution to enhance the appearance of the Pandas DataFrame table is to use the DataFrame.style attribute while displaying the output.

df.head().style\n
| \u00a0 | A | B | C | D | |------------|-----------|-----------|-----------|----------| | vtQ4AqzUmR | -0.366719 | 0.728404 | 0.625120 | 2.480765 | | qiHhTHAHNH | -0.359968 | -0.599540 | 1.594778 | 0.921716 | | LOqytDK7SY | -0.627586 | 0.935781 | -1.592791 | 0.024485 | | WOG0u390DM | 0.105248 | -0.062309 | 0.878165 | 1.072234 | | eOrtbW98MM | -1.400879 | -0.260574 | -0.369980 | 1.760192 |"},{"location":"guides/Setting_Up_Document_Versioning/","title":"Setting up document versioning","text":"

Material for nbdev makes deploying multiple versions of your project documentation simple and convenient. It comes equipped with mike, a Python tool that helps deploy multiple versions of your MkDocs docs to a Git branch, ideal for hosting on Github Pages.

"},{"location":"guides/Setting_Up_Document_Versioning/#enabling-document-versioning","title":"Enabling document versioning","text":"

Enabling document versioning in Material for nbdev is easy. Just add the docs_versioning flag to your settings.ini file with one of the following values:

  1. docs_versioning=None disables versioning.
  2. docs_versioning=minor deploys document in <major>.<minor> format and reads the version from the settings.ini file. Newer patch versions will replace previous minor versions (e.g.\u00a01.0.1 replaces 1.0 and becomes the new 1.0 version).
  3. docs_versioning=patch deploys document in <major>.<minor>.<patch> format (e.g.\u00a01.0.0, 1.0.1) and reads the version from the settings.ini file.

We recommend setting docs_versioning=minor to limit the number of deployments while keeping all patch version changes. This also helps to keep your Git repository small.

Note

Regardless of whether docs_versioning is set to minor or patch, the documentation for the pre-release versions such as 1.0.0rc0 or 1.0.0dev will be deployed as-is.

Push the change to Git and wait for the pages build and deployment GitHub action to complete. After that, view the project documentation URL to see the latest changes. To access different versions, use the version selector in the header (a reference screenshot is provided below).

"},{"location":"guides/Setting_Up_Document_Versioning/#deleting-deployed-pre-release-documents","title":"Deleting deployed pre-release documents","text":"

To delete all the deployed pre-release document versions, run the following CLI command from the project root directory and follow the on-screen instructions:

nbdev_mkdocs delete-pre-release-docs\n

For additional configurations for managing the deployed document versions, please check mike\u2019s documentation.

"},{"location":"guides/Setting_up_social_cards/","title":"Setting up social cards","text":"

Social cards, also known as social sharing image, are images that are displayed when a link to your project documentation is shared on social media. Material for nbdev enables you to easily create attractive social media share images for your project.

By default, mkdocs.yml is configured to use the social sharing image generated by GitHub\u2019s Open Graph image service for your project.

For viewing the default social share image for our project nbdev_mkdocs_tutorial, navigate to the URL below in your preferred browser.

Note

In the following URL:

  • Replace {user} with your github username
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
https://opengraph.githubassets.com/some-random-stuff-to-refresh-or-timestamp/{user}/nbdev_mkdocs_tutorial\n
"},{"location":"guides/Setting_up_social_cards/#generating-new-social-cards","title":"Generating new social cards","text":"

For customizing and generating a new social share image for your project, you can use the nbdev_mkdocs social-image generate CLI command. For viewing the current configuration options, please run the following command in the terminal.

nbdev_mkdocs social-image generate --help\n
 Usage: nbdev_mkdocs social-image generate [OPTIONS]\n\n Generate a custom social share image\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --root-path         TEXT           Project's root path. [default: .]         \u2502\n\u2502 --generator         [file|dall_e]  Generator to use to create the social     \u2502\n\u2502                                    image. Valid options are: 'file' and      \u2502\n\u2502                                    'dall_e'. Choose 'file' if you want to    \u2502\n\u2502                                    use an existing image from your local     \u2502\n\u2502                                    machine in the social share image.        \u2502\n\u2502                                    [default: file]                           \u2502\n\u2502 --prompt            TEXT           The prompt to use for generating the      \u2502\n\u2502                                    image. Please pass this option only when  \u2502\n\u2502                                    using 'dall_e' as the generator.          \u2502\n\u2502                                    [default: Cute animal wearing hoodie      \u2502\n\u2502                                    sitting in high chair in purple room,     \u2502\n\u2502                                    browsing computer, 3d render]             \u2502\n\u2502 --image-path        TEXT           Image file path to use in the social      \u2502\n\u2502                                    share image. Use images with a 1:1 aspect \u2502\n\u2502                                    ratio and at least 512x512 pixels for the \u2502\n\u2502                                    best results. If None, then the default   \u2502\n\u2502                                    image will be used. Please pass this      \u2502\n\u2502                                    option only when using 'file' as the      \u2502\n\u2502                                    generator.                                \u2502\n\u2502                                    [default: None]                           \u2502\n\u2502 --help                             Show this message and exit.               \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n

The above command generates the custom social share image using the playwright library. Please run the following command to install the required browser for the playwright plugin before generating a custom social share image:

playwright install chromium\n
"},{"location":"guides/Setting_up_social_cards/#generating-using-ai","title":"Generating using AI","text":"

The nbdev_mkdocs social-image generate CLI command can be configured to use DALL-E, an OpenAI model to create stunning social share images for your project.

Here\u2019s an example of how to use DALL-E to create a custom social share image based on a description.

Note

The OpenAI API uses API keys for authentication. Please create one and set it in the OPENAI_API_KEY environment variable before running the below command.

nbdev_mkdocs social-image generate \\\n    --generator \"dall_e\" \\\n    --prompt \"Cute panda browsing computer in purple room. 3d render.\"\n

The generated image will be saved as social_image.png in the mkdocs/docs_overrides/images directory. You can make multiple versions of the image by experimenting with the text prompts. Each version will be saved to the same directory, with a version number added to the suffix. For example, the most recently generated image is saved as social_image.png, the first version will be saved as social_image_1.png, the second version will be saved as social_image_2.png, and so on. This allows you to easily experiment and compare different versions of the image to find the one that looks best.

"},{"location":"guides/Setting_up_social_cards/#generating-from-an-existing-image","title":"Generating from an existing image","text":"

You can also make a custom social share image from an existing image. This can be an excellent way to maintain your brand\u2019s visual style while also making it stand out on social media. Here\u2019s an example of how to do so:

Tip

Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results.

Note

Replace {path-to-image} in the following command with the image path you want to use in the social share image

nbdev_mkdocs social-image generate \\\n    --image-path {path-to-image}\n

You can also choose not to pass the --image-path parameter in the above command, in which case the default image will be used.

"}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Material for nbdev","text":"

Documentation: https://nbdev-mkdocs.airt.ai

Source Code: https://github.com/airtai/nbdev-mkdocs

"},{"location":"#getting-started","title":"Getting Started","text":"

Material for nbdev is a nbdev extension that allows you to use Material for MkDocs to generate documentation for nbdev projects.

The key features are:

  • Material style documentation: Effortlessly create material style documentation for your nbdev projects with Material for MkDocs, a theme that provides a sleek and modern design for your documentation.
  • Auto generate docstrings: Instantly generate docstrings for your Python code using docstring-gen library, a tool that automatically generates docstrings for your functions and classes using Codex.
  • Create stunning social media share images: Boost your project\u2019s visibility by creating striking social share images using DALL-E.
  • Customizability: Add guides, release notes, customise the navigation menu and configure the Material for MkDocs easily to suit your project needs. With this documentation tool, you have more control over the look and feel of your documentation, allowing you to create a unique and personalized experience for your users.
"},{"location":"#workflow","title":"Workflow","text":"

Here\u2019s a quick comparison of Quarto and Material for nbdev development workflows:

Quarto workflow Material for nbdev workflow Install:
$ pip install notebook nbdev\n$ nbdev_install_quarto\n
Install:
$ pip install notebook nbdev\n$ nbdev_install_quarto\n$ pip install nbdev-mkdocs\n
Setup:
$ nbdev_new\n$ nbdev_install_hooks\n$ vi settings.ini\n$ pip install -e '.[dev]'\n
Setup:
$ nbdev_new\n$ nbdev_install_hooks\n$ vi settings.ini\n$ pip install -e '.[dev]'\n$ nbdev_mkdocs new\n$ vi mkdocs/mkdocs.yml\n
Development:
# Edit files\n$ nbdev_preview\n
Development:
# Edit files\n$ nbdev_mkdocs preview\n
Commit changes:
$ nbdev_prepare\n$ git commit -am \u201cCommit message\u201d\n$ git push\n
Commit changes:
$ nbdev_mkdocs prepare\n$ git commit -am \u201cCommit message\u201d\n$ git push\n
"},{"location":"#quick-start","title":"Quick start","text":"

The following quick start guide will walk you through installing and configuring nbdev-mkdocs for an existing nbdev project. It also assumes you\u2019ve already initialized your project with nbdev and installed all of the required libraries.

For detailed installation instructions and configuration options, please see the User Guide.

"},{"location":"#install","title":"Install","text":"

nbdev-mkdocs is published as a Python package and can be installed with pip:

pip install nbdev-mkdocs\n

Note that nbdev-mkdocs must be installed in the same Python environment as nbdev.

If the installation was successful, you should now have the nbdev-mkdocs installed on your system. Run the below command from the terminal to see the full list of available commands:

nbdev_mkdocs --help\n
 Usage: nbdev_mkdocs [OPTIONS] COMMAND [ARGS]...\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --install-completion          Install completion for the current shell.      \u2502\n\u2502 --show-completion             Show completion for the current shell, to copy \u2502\n\u2502                               it or customize the installation.              \u2502\n\u2502 --help                        Show this message and exit.                    \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 delete-pre-release-docs  Deletes deployed pre-release documentation          \u2502\n\u2502                          versions.                                           \u2502\n\u2502 docs                     Prepares files in 'mkdocs/docs' and then runs       \u2502\n\u2502                          'mkdocs build' command on them.                     \u2502\n\u2502 docstring                Command for adding docstrings to classes and        \u2502\n\u2502                          methods that don't have one using docstring-gen     \u2502\n\u2502                          library.                                            \u2502\n\u2502 new                      Creates files in 'mkdocs' subdirectory needed for   \u2502\n\u2502                          other 'nbdev_mkdocs' subcommands.                   \u2502\n\u2502 prepare                  Runs tests and prepares files in 'mkdocs/docs' and  \u2502\n\u2502                          then runs 'mkdocs build' command on them.           \u2502\n\u2502 preview                  Prepares files in 'mkdocs/docs' and then runs       \u2502\n\u2502                          'mkdocs serve' command on them.                     \u2502\n\u2502 readme                   Updates the README.md file from the 'readme_nb'     \u2502\n\u2502                          notebook. Unless explicitly changed in the          \u2502\n\u2502                          settings.ini file, the 'readme_nb' points to the    \u2502\n\u2502                          'index.ipynb' notebook in the 'nbs_path' directory. \u2502\n\u2502 social-image             Command for generating a custom social share image. \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n
"},{"location":"#setup","title":"Setup","text":"

After installing nbdev-mkdocs, bootstrap your project documentation by executing the following command from the project\u2019s root directory:

nbdev_mkdocs new\n

Using information from the project\u2019s settings.ini file, the above command creates files and directories required to build the documentation and saves it in the mkdocs subdirectory.

Note: You should only run the nbdev_mkdocs new command once for the project to initialise the files required for building Material for MkDocs documentation.

"},{"location":"#preview-changes","title":"Preview changes","text":"

nbdev_mkdocs lets you preview your changes as you write your documentation. Execute the following command from the project root directory to start a local server, and preview your documentation:

Note: If you haven\u2019t already installed your library locally, run pip install -e '.[dev]' command before running the nbdev_mkdocs prepare command.

nbdev_mkdocs preview\n
"},{"location":"#prepare-changes","title":"Prepare changes","text":"

To prepare your changes for Git push, we recommend executing the following commands:

First, run the nbdev_mkdocs prepare command in the terminal. This command exports the library, runs tests, and cleans the notebooks.

nbdev_mkdocs prepare\n

Then, run the nbdev_mkdocs readme command to update the README.md file from the \u2018readme_nb\u2019 notebook. By default, \u2018readme_nb\u2019 points to \u2018index.ipynb\u2019 notebook in the \u2018nbs_path\u2019 unless modified in the settings.ini file.

This command does everything the \u2018nbdev_readme\u2019 command does, plus it generates symbol references that are compatible with \u2018Material for nbdev\u2019.

nbdev_mkdocs readme\n

Finally, double-check your settings.ini file to ensure that it has all of the correct information. Then commit and push your additions to GitHub:

git commit -am'Commit Message'\ngit push\n
"},{"location":"#copyright","title":"Copyright","text":"

Copyright \u00a9 2022 onwards airt technologies ltd, Inc.

"},{"location":"#license","title":"License","text":"

This project is licensed under the terms of the Apache License 2.0

"},{"location":"API_Docs_Helper/","title":"API Docs Helper","text":"
from subprocess import CalledProcessError\nimport shutil\nimport unittest.mock\nfrom contextlib import contextmanager\nfrom tempfile import TemporaryDirectory\n\nfrom nbdev.doclinks import NbdevLookup\n\nfrom nbdev_mkdocs.mkdocs import prepare\n
/Users/harishm/.pyenv/versions/3.10.4/lib/python3.10/site-packages/pandas/compat/__init__.py:124: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.\n  warnings.warn(msg)\n
def sample_test_function():\n    pass\n\nsample_test_function.__module__ = \"custom_name._components.Sample.sample\"\n\n@contextmanager\ndef mock_getsourcefile():\n    with unittest.mock.patch('__main__.getsourcefile') as mock_getsourcefile:\n        mock_getsourcefile.return_value = '/Users/username/Dev/nbdev-mkdocs/custom_name/_components/Sample.py'\n        yield\n\n@contextmanager\ndef mock_get_config():\n    with unittest.mock.patch('__main__.get_config') as mock_get_config:\n        mock_get_config.return_value = {\"lib_path\": Path('/Users/username/Dev/nbdev-mkdocs/custom_name')}\n        yield\n\nwith mock_getsourcefile():\n    with mock_get_config():\n        actual = _get_symbol_filepath(sample_test_function)\n        expected = Path(\"custom_name/_components/Sample.py\")\n        print(actual)\n        assert actual == expected\n
custom_name/_components/Sample.py\n
actual = _get_symbol_filepath(prepare)\nexpected = Path(\"nbdev_mkdocs/mkdocs.py\")\nprint(actual)\n\nassert actual == expected\n
nbdev_mkdocs/mkdocs.py\n
expected = \"\\n\\n::: custom_name._components.Sample.sample_test_function\\n\"\n\nactual = _generate_autodoc(symbol=sample_test_function, symbol_path=Path(\"custom_name/_components/Sample.py\"))\nprint(actual)\nassert actual == expected\n
::: custom_name._components.Sample.sample_test_function\n
autodoc = \"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n\"\nactual = _add_mkdocstring_header_config(autodoc=autodoc, heading_level=2, show_category_heading=True, is_root_object=True)\n\nexpected = \"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n\"\ndisplay(actual)\nassert actual == expected\n
'\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n'\n
autodoc = \"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n\"\nactual = _add_mkdocstring_header_config(autodoc=autodoc, heading_level=2, show_category_heading=True, is_root_object=False)\n\nexpected = \"\"\"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\n    options:\n      heading_level: 4\n      show_root_full_path: false\n\"\"\"\ndisplay(actual)\nassert actual == expected\n
'\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n    options:\\n      heading_level: 4\\n      show_root_full_path: false\\n'\n
autodoc = \"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n\"\nactual = _add_mkdocstring_header_config(autodoc=autodoc, heading_level=2, show_category_heading=False, is_root_object=False)\n\nexpected = \"\"\"\\n\\n::: nbdev_mkdocs.mkdocs.prepare\n    options:\n      heading_level: 3\n      show_root_full_path: false\n\"\"\"\ndisplay(actual)\nassert actual == expected\n
'\\n\\n::: nbdev_mkdocs.mkdocs.prepare\\n    options:\\n      heading_level: 3\\n      show_root_full_path: false\\n'\n
_generate_autodoc_string_mock_value = f'::: nbdev_mkdocs.mkdocs.prepare'\n\n@contextmanager\ndef mock_generate_autodoc_string():\n    with unittest.mock.patch('__main__._generate_autodoc_string') as mock_generate_autodoc_string:\n        mock_generate_autodoc_string.return_value = _generate_autodoc_string_mock_value\n        yield\n
with mock_generate_autodoc_string():\n    actual = _generate_autodoc_string(prepare)\n\nexpected = \"\"\"::: nbdev_mkdocs.mkdocs.prepare\"\"\"\ndisplay(actual)\nassert actual == expected\n
'::: nbdev_mkdocs.mkdocs.prepare'\n
class Car:\n    SOME_ATTRIBUTE = \"Some class attribute\"\n\n    def __init__(self, make: str, model: str, year: int, color: str):\n        self.make = make\n        self.model = model\n        self.year = year\n        self.color = color\n        self.is_running = False\n\n    def start(self):\n        self.is_running = True\n\n    def stop(self):\n        self.is_running = False\n\n    def drive(\n        self,\n        distance: float,\n        speed: Optional[float] = None,\n        passengers: Optional[int] = None,\n    ) -> float:\n        if not self.is_running:\n            raise ValueError(\"Cannot drive a stopped car.\")\n\n        if speed:\n            print(f\"Driving at {speed} km/h.\")\n\n        if passengers:\n            print(f\"Driving with {passengers} passengers.\")\n\n        return distance\n\n    def patched_method_in_same_file(self, s: str) -> str:\n        raise NotImplementedError()\n\n    @staticmethod\n    def i_am_a_static_method(name: str) -> str:\n        if not isinstance(name, str):\n            raise ValueError(\"I will accept only string\")\n        return f\"Hello, {name}\"\n\n    @classmethod\n    def i_am_a_class_method(cls):\n        return f\"Nothing\"\n\n\n\nactual = _filter_attributes_in_autodoc(Car)\nexpected = \"\"\"    options:\n      filters: [\"!^drive$\", \"!^i_am_a_class_method$\", \"!^i_am_a_static_method$\", \"!^patched_method_in_same_file$\", \"!^start$\", \"!^stop$\"]\"\"\"\ndisplay(actual)\nassert actual == expected\n
'    options:\\n      filters: [\"!^drive$\", \"!^i_am_a_class_method$\", \"!^i_am_a_static_method$\", \"!^patched_method_in_same_file$\", \"!^start$\", \"!^stop$\"]'\n
_mkdocs = \"\"\"\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n        - https://docs.python.org/3/objects.inv\n        options:\n          heading_level: 2\n          show_category_heading: true\n          show_root_heading: true\n          show_signature_annotations: true\n          show_if_no_docstring: true\n\nmarkdown_extensions:\n- md_in_html\n- pymdownx.arithmatex:\n    generic: true\n- pymdownx.superfences:\n        custom_fences:\n          - name: mermaid\n            class: mermaid\n            format: !!python/name:pymdownx.superfences.fence_code_format\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n    heading_level, show_category_heading = _get_mkdocstring_config(mkdocs_path=mkdocs_path)\n    actual = (heading_level, show_category_heading)\n    expected = (2, True)\n\n    display(actual)\n    assert actual == expected\n
(2, True)\n
_mkdocs = \"\"\"\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n        - https://docs.python.org/3/objects.inv\n        options:\n          show_root_heading: true\n          show_signature_annotations: true\n          show_if_no_docstring: true\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n    heading_level, show_category_heading = _get_mkdocstring_config(mkdocs_path=mkdocs_path)\n    actual = (heading_level, show_category_heading)\n    expected = (2, False)\n\n    display(actual)\n    assert actual == expected\n
(2, False)\n
_mkdocs = \"\"\"\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n        - https://docs.python.org/3/objects.inv\n        options:\n          heading_level: 5\n          show_category_heading: false\n          show_root_heading: true\n          show_signature_annotations: true\n          show_if_no_docstring: true\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n    heading_level, show_category_heading = _get_mkdocstring_config(mkdocs_path=mkdocs_path)\n    actual = (heading_level, show_category_heading)\n    expected = (5, False)\n\n    display(actual)\n    assert actual == expected\n
(5, False)\n

source

"},{"location":"API_Docs_Helper/#get_formatted_docstring_for_symbol","title":"get_formatted_docstring_for_symbol","text":"
 get_formatted_docstring_for_symbol (symbol:Union[function,Type[Any]],\n                                     mkdocs_path:pathlib.Path)\n

Recursively parses and get formatted docstring of a symbol.

Args: symbol: A Python class or function object to parse the docstring for. mkdocs_path: The path to the mkdocs folder.

Returns: A formatted docstring of the symbol and its members.

_mkdocs = \"\"\"\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n        - https://docs.python.org/3/objects.inv\n        options:\n          heading_level: 5\n          show_category_heading: false\n          show_root_heading: true\n          show_signature_annotations: true\n          show_if_no_docstring: true\n\"\"\"\n
class Car:\n    \"\"\"A class representing a car.\n\n    Attributes:\n        make: The make of the car.\n        model: The model of the car.\n        year: The year the car was made.\n        color: The color of the car.\n    \"\"\"\n\n    SOME_CLASS_ATTRIBUTE = \"some class attribute\"\n    second_class_attribute = \"second_class_attribute\"\n\n    def __init__(self, make: str, model: str, year: int, color: str):\n        \"\"\"Initialize a new car.\n\n        Args:\n            make: The make of the car.\n            model: The model of the car.\n            year: The year the car was made.\n            color: The color of the car.\n        \"\"\"\n        self.make = make\n        self.model = model\n        self.year = year\n        self.color = color\n        self.is_running = False\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n    with mock_generate_autodoc_string():\n        actual = get_formatted_docstring_for_symbol(Car, mkdocs_path)\n\n    expected = \"\"\"::: nbdev_mkdocs.mkdocs.prepare    options:\n      filters: []\n\n\"\"\"\n\n    print(actual)\n    assert actual == expected\n
::: nbdev_mkdocs.mkdocs.prepare    options:\n      filters: []\n
def fixture_function(\n    arg_1: str,\n    arg_2: Union[List[str], str],\n    arg_3: Optional[int],\n    arg_4: Optional[str] = None,\n) -> str:\n    \"\"\"This is a one line description for the function\n\n    Args:\n        arg_1: Argument 1\n        arg_2: Argument 2\n        arg_3: Argument 3\n        arg_4: Argument 4\n\n    Returns:\n        The concatinated string\n    \"\"\"\n    pass\n\nget_module_source_value = \"\"\"\ndef fixture_function(\n    arg_1: str,\n    arg_2: Union[List[str], str],\n    arg_3: Optional[int],\n    arg_4: Optional[str] = None,\n) -> str:\n    \\\"\\\"\\\"This is a one line description for the function\n\n    Args:\n        arg_1: Argument 1\n        arg_2: Argument 2\n        arg_3: Argument 3\n        arg_4: Argument 4\n\n    Returns:\n        The concatinated string\n    \\\"\\\"\\\"\n    pass\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True)\n\n    with open((mkdocs_path / \"mkdocs.yml\"), \"w\", encoding=\"utf-8\") as f:\n        f.write(_mkdocs)\n\n\n    expected = \"::: nbdev_mkdocs.mkdocs.prepare\"\n\n    with mock_generate_autodoc_string():\n        actual = get_formatted_docstring_for_symbol(fixture_function, mkdocs_path)\n    display(actual)\n    assert actual == expected\n
'::: nbdev_mkdocs.mkdocs.prepare'\n
"},{"location":"CHANGELOG/","title":"Release notes","text":""},{"location":"CHANGELOG/#061","title":"0.6.1","text":""},{"location":"CHANGELOG/#new-features","title":"New Features","text":"
  • Create new CLI command \"nbdev mkdocs readme\" (#206), thanks to @harishmohanraj
"},{"location":"CHANGELOG/#bugs-squashed","title":"Bugs Squashed","text":"
  • Do not run \"nbdev_docs\" while running \"nbdev_mkdocs docs\" (#208), thanks to @harishmohanraj

  • AttributeError: module 'openai' has no attribute 'error (#212), thanks to @harishmohanraj

"},{"location":"CHANGELOG/#060","title":"0.6.0","text":""},{"location":"CHANGELOG/#new-features_1","title":"New Features","text":"
  • Support for Python 3.7 has been removed.
"},{"location":"CHANGELOG/#bugs-squashed_1","title":"Bugs Squashed","text":"
  • Add correct URL to mkdocs config file when executing the social image generate CLI command (#202), thanks to @harishmohanraj

  • Fix docs build failure on Windows (#194), thanks to @harishmohanraj

"},{"location":"CHANGELOG/#051","title":"0.5.1","text":""},{"location":"CHANGELOG/#bugs-squashed_2","title":"Bugs Squashed","text":"
  • Fix the misalignment of class methods in the documentation (#186), thanks to @harishmohanraj
  • Fix build failures when the repository and exported library names differ (#184), thanks to @harishmohanraj
"},{"location":"CHANGELOG/#050","title":"0.5.0","text":""},{"location":"CHANGELOG/#new-features_2","title":"New Features","text":"
  • Replace static parsing of source files with dynamic import from library when extracting symbols (#180), thanks to @harishmohanraj
"},{"location":"CHANGELOG/#040","title":"0.4.0","text":""},{"location":"CHANGELOG/#bugs-squashed_3","title":"Bugs Squashed","text":"
  • Callout does not work (#179), thanks to @harishmohanraj
"},{"location":"CHANGELOG/#030","title":"0.3.0","text":""},{"location":"CHANGELOG/#bugs-squashed_4","title":"Bugs Squashed","text":"
  • Switch to chatGPT model from codex model (#171)
"},{"location":"CHANGELOG/#022","title":"0.2.2","text":""},{"location":"CHANGELOG/#bugs-squashed_5","title":"Bugs Squashed","text":"
  • Don't run nbdev_readme automatically (#168), thanks to @harishmohanraj
  • Closes #166
"},{"location":"CHANGELOG/#021","title":"0.2.1","text":""},{"location":"CHANGELOG/#bugs-squashed_6","title":"Bugs Squashed","text":"
  • Load symbols dynamically and link it to the docs (#160)
"},{"location":"CHANGELOG/#020","title":"0.2.0","text":""},{"location":"CHANGELOG/#bugs-squashed_7","title":"Bugs Squashed","text":"
  • Upgrade mkdocstrings and python handler

  • Fix prepare and preview tests (#155)

  • Add docs version in the link to the symbols (#151)

  • Fix link to symbols in docs (#144)

  • https://github.com/fastai/nbdev/blob/master/nbdev/doclinks.py#L87
"},{"location":"CHANGELOG/#010","title":"0.1.0","text":""},{"location":"CHANGELOG/#new-features_3","title":"New Features","text":"
  • Add documentation versioning (#72)
  • https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/

  • add detect-secrets to pre-commit hooks (#138)

  • Integrate docstring-gen into nbdev-mkdocs (#123)

  • Rename the CLI command \"nbdev_mkdocs generate-social-image\" to \"nbdev_mkdocs social-image generate\" (#127)

"},{"location":"CHANGELOG/#bugs-squashed_8","title":"Bugs Squashed","text":"
  • Hide the badges displayed on the index page in the docs (#118)

  • nbdev docs: The CI build status badge should not appear in the documentation. (#113)

  • nbdev docs: Locally referenced images are not showing up in the docs (#110)

"},{"location":"CHANGELOG/#004","title":"0.0.4","text":""},{"location":"CHANGELOG/#new-features_4","title":"New Features","text":"
  • Rename the CLI command \"nbdev_mkdocs generate-social-image\" to \"nbdev_mkdocs social-image generate\" (#127)

  • Integrate docstring-gen into nbdev-mkdocs (#123)

"},{"location":"CHANGELOG/#bugs-squashed_9","title":"Bugs Squashed","text":"
  • Hide the badges displayed on the index page in the docs (#118)

  • nbdev docs: The CI build status badge should not appear in the documentation. (#113)

  • nbdev docs: Locally referenced images are not showing up in the docs (#110)

"},{"location":"CHANGELOG/#003","title":"0.0.3","text":""},{"location":"CHANGELOG/#bugs-squashed_10","title":"Bugs Squashed","text":"
  • CI bug fix
"},{"location":"CHANGELOG/#002","title":"0.0.2","text":""},{"location":"CHANGELOG/#new-features_5","title":"New Features","text":"
  • If a CLI command documentation fails, rather than failing, print the exception in the terminal. (#107)

  • Make API, CLI and Releases configurable in the docs (#106)

  • Handle glob expressions while building the navigation tree for MkDocs (#100)

  • Build tensorflow based Docker image with preinstalled nbdev_mkdocs and all requirements (#95)

  • Build docker images with preinstalled nbdev_mkdocs and all requirements (#94)

  • Use AI to generate social image (#81)

  • Read sidebar.yml for generating the docs navigation (#62)

"},{"location":"CHANGELOG/#bugs-squashed_11","title":"Bugs Squashed","text":"
  • Uploading large images breaks the social share image. (#98)

  • Copy requirements in dev-requirements for client projects and not for nbdev-mkdocs (#79)

  • Install mkdoc-nbdev from pypi instead of git (#54)

  • The following code in deployed.yml installs the git version for all our projects, but it should do that only for the nbdev-mkdocs project:
"},{"location":"CHANGELOG/#001","title":"0.0.1","text":""},{"location":"CHANGELOG/#new-features_6","title":"New Features","text":"
  • Add stuffs to gitignore when you run nbdev_new (#59)

  • Create new repo for maintaining workflows (#52)

  • Call nbdev_prepare internally when calling nbdev_mkdocs prepare (#43)

  • Enable local development (#36)

  • Use quarto to convert notebooks into markdown (#35), thanks to @harishmohanraj

  • Update ghp deploy action template (#33), thanks to @harishmohanraj

  • Use nbdev and quarto for converting notebooks into markdown files (#31)

    • Update walkthrough docs to install quarto
  • Create new deploy action as part of the nbdev-mkdocs new command (#25)

  • Implement logic to hide cells in guides notebook (#24)

  • Generate cli docs (#14), thanks to @harishmohanraj

  • Closes #4

  • Add release page (#10), thanks to @harish-airt

  • Closes #8

  • Initial commit, thanx to @davorrunje

"},{"location":"CLI/","title":"CLI","text":"
import shutil\nfrom tempfile import TemporaryDirectory\n\nfrom typer.testing import CliRunner\n\nfrom nbdev_mkdocs._helpers.utils import set_cwd\n
runner = CliRunner()\n
"},{"location":"CLI/#readme","title":"readme","text":"
 readme ()\n

CLI command for updating the README.md file from the readme_nb notebook.

"},{"location":"CLI/#docs","title":"docs","text":"
 docs (root_path:str=<typer.models.OptionInfo object at 0x7fdebeec59a0>)\n

CLI command for creating files for nbdev_mkdocs command

source

"},{"location":"CLI/#preview","title":"preview","text":"
 preview (root_path:str=<typer.models.OptionInfo object at\n          0x7fdebeec52e0>,\n          use_relative_doc_links:bool=<typer.models.OptionInfo object at\n          0x7fdebeec5970>, port:int=<typer.models.OptionInfo object at\n          0x7fdebeec58b0>)\n

CLI command for creating files for nbdev_mkdocs command

source

"},{"location":"CLI/#prepare","title":"prepare","text":"
 prepare (root_path:str=<typer.models.OptionInfo object at\n          0x7fdebeec53a0>)\n

CLI command for running tests and creating files for nbdev_mkdocs command.

source

"},{"location":"CLI/#new","title":"new","text":"
 new (root_path:str=<typer.models.OptionInfo object at 0x7fdebeec5310>)\n

CLI command for creating files for nbdev_mkdocs command

_sample_function = \"\"\"\ndef sum(num1: int, num2: int) -> int:\n    return num1 + num2\n\"\"\"\nwith TemporaryDirectory() as d:\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", Path(d) / \"settings.ini\")\n\n    with set_cwd(d):\n        nbs_path = Path(d) / \"nbs\"\n        Path(nbs_path).mkdir()\n\n        test_file_path = nbs_path / \"test.py\"\n        with open(test_file_path, \"w\", encoding=\"utf-8\") as f:\n            f.write(_sample_function)\n\n        result = runner.invoke(_app, [\"docstring\", \"generate\"])\n        print(result.stdout)\n        assert result.exit_code == 0, f\"result.stdout={result.stdout} result.exit_code={result.exit_code}\"\n\n        with open(test_file_path, \"r\", encoding=\"utf-8\") as f:\n            actual = f.read()\n\n        print(actual)\n        assert \"docstring-gen\" in actual, actual\n\n        result = runner.invoke(\n            _app, [\"docstring\", \"generate\", \"-p\", f\"{d}/invalid_directory_name\"]\n        )\n        print(result.stdout)\n        assert result.exit_code == 1, result.exit_code\n
Successfully added docstrings to /private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpk5xf8cpt/nbs/test.py\n\n\ndef sum(num1: int, num2: int) -> int:\n    \"\"\"Calculates the sum of two numbers.\n\n    Args:\n        num1: The first number.\n        num2: The second number.\n\n    Returns:\n        The sum of num1 and num2.\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)\n    \"\"\"\n    return num1 + num2\n\nPath '/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpk5xf8cpt/invalid_directory_name' does not exists!\n
all_branches = (\n    \"0.0.5rc10 [dev]\\n0.0.5dev\\n0.0.5rc0\\n0.0.4 [latest]\\n0.0.3\\n0.0.2\\n0.0.1\\n\"\n)\nexpected = \"0.0.5rc10\\n0.0.5dev\\n0.0.5rc0\"\nactual = _filter_rc_branches(all_branches)\nprint(actual)\nassert actual == expected\n
0.0.5rc10\n0.0.5dev\n0.0.5rc0\n
all_branches = \"0.0.4 [latest]\\n0.0.3\\n0.0.2\\n0.0.1\\n\"\nexpected = \"\"\nactual = _filter_rc_branches(all_branches)\nprint(actual)\nassert actual == expected\n
all_versions = \"0.0.5rc10 [dev]\\n0.0.5dev\\n0.0.5rc0\"\nexpected = [\"0.0.5rc10\", \"0.0.5dev\", \"0.0.5rc0\"]\n\nactual = _get_version_numbers(all_versions)\nprint(actual)\nassert actual == expected\n
['0.0.5rc10', '0.0.5dev', '0.0.5rc0']\n
"},{"location":"CLI/#delete_pre_release_docs","title":"delete_pre_release_docs","text":"
 delete_pre_release_docs ()\n

Deletes deployed pre-release documentation versions.

result = runner.invoke(_app, [\"--help\"])\nprint(result.stdout)\n
                                                                                                                   \n Usage: root [OPTIONS] COMMAND [ARGS]...                                                                           \n                                                                                                                   \n
\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --install-completion          Install completion for the current shell.                                         \u2502\n\u2502 --show-completion             Show completion for the current shell, to copy it or customize the installation.  \u2502\n\u2502 --help                        Show this message and exit.                                                       \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n
\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 delete-pre-release-docs  Deletes deployed pre-release documentation versions.                                   \u2502\n\u2502 docs                     Prepares files in 'mkdocs/docs' and then runs 'mkdocs build' command on them.          \u2502\n\u2502 docstring                Command for adding docstrings to classes and methods that don't have one using         \u2502\n\u2502                          docstring-gen library.                                                                 \u2502\n\u2502 new                      Creates files in 'mkdocs' subdirectory needed for other 'nbdev_mkdocs' subcommands.    \u2502\n\u2502 prepare                  Runs tests and prepares files in 'mkdocs/docs' and then runs 'mkdocs build' command on \u2502\n\u2502                          them.                                                                                  \u2502\n\u2502 preview                  Prepares files in 'mkdocs/docs' and then runs 'mkdocs serve' command on them.          \u2502\n\u2502 readme                   Updates the README.md file from the 'readme_nb' notebook. Unless explicitly changed in \u2502\n\u2502                          the settings.ini file, the 'readme_nb' points to the 'index.ipynb' notebook in the     \u2502\n\u2502                          'nbs_path' directory.                                                                  \u2502\n\u2502 social-image             Command for generating a custom social share image.                                    \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n
"},{"location":"CLI_Doc_Helper/","title":"CLI Doc Helper","text":"
import subprocess\nfrom tempfile import TemporaryDirectory\n

source

"},{"location":"CLI_Doc_Helper/#generate_cli_doc","title":"generate_cli_doc","text":"
 generate_cli_doc (module_name:str, app_name:str)\n

Generate CLI documentation for a Typer app.

Args: module_name: The name of the module containing the Typer app. app_name: The name of the Typer app.

Returns: The CLI documentation for the Typer app.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

module_name = \"nbdev_mkdocs._cli\"\napp_name = \"nbdev_mkdocs\"\nactual = generate_cli_doc(module_name, app_name)\nprint(actual)\nfor cmd in [\"nbdev_mkdocs new\", \"nbdev_mkdocs prepare\", \"nbdev_mkdocs preview\"]:\n    assert cmd in actual, f\"cmd={cmd}, actual={actual}\"\n
# `nbdev_mkdocs`\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs [OPTIONS] COMMAND [ARGS]...\n```\n\n**Options**:\n\n* `--install-completion`: Install completion for the current shell.\n* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.\n* `--help`: Show this message and exit.\n\n**Commands**:\n\n* `docs`: Prepares files in **mkdocs/docs** and then...\n* `new`: Creates files in **mkdocs** subdirectory...\n* `prepare`: Runs tests and prepares files in...\n* `preview`: Prepares files in **mkdocs/docs** and then...\n* `social-image`: Command for generating a custom social...\n\n## `nbdev_mkdocs docs`\n\nPrepares files in **mkdocs/docs** and then runs **mkdocs build** command on them\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs docs [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: Project's root path.  [default: .]\n* `--help`: Show this message and exit.\n\n## `nbdev_mkdocs new`\n\nCreates files in **mkdocs** subdirectory needed for other **nbdev_mkdocs** subcommands\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs new [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: [default: .]\n* `--help`: Show this message and exit.\n\n## `nbdev_mkdocs prepare`\n\nRuns tests and prepares files in **mkdocs/docs** and then runs **mkdocs build** command on them\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs prepare [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: [default: .]\n* `--help`: Show this message and exit.\n\n## `nbdev_mkdocs preview`\n\nPrepares files in **mkdocs/docs** and then runs **mkdocs serve** command on them\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs preview [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: path under which mkdocs directory will be created  [default: .]\n* `--port INTEGER`: port to use  [default: 4000]\n* `--help`: Show this message and exit.\n\n## `nbdev_mkdocs social-image`\n\nCommand for generating a custom social share image.\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs social-image [OPTIONS] COMMAND [ARGS]...\n```\n\n**Options**:\n\n* `--help`: Show this message and exit.\n\n**Commands**:\n\n* `generate`: Generate a custom social share image\n\n### `nbdev_mkdocs social-image generate`\n\nGenerate a custom social share image\n\n**Usage**:\n\n```console\n$ nbdev_mkdocs social-image generate [OPTIONS]\n```\n\n**Options**:\n\n* `--root-path TEXT`: Project's root path.  [default: .]\n* `--generator [file|dall_e]`: Generator to use to create the social image. Valid options are: 'file' and 'dall_e'. Choose 'file' if you want to use an existing image from your local machine in the social share image.  [default: file]\n* `--prompt TEXT`: The prompt to use for generating the image.  [default: Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render]\n* `--image-path TEXT`: Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used.\n* `--help`: Show this message and exit.\n
"},{"location":"CLI_Docs_Generator/","title":"CLI Docs Generator","text":"
import shutil\nfrom pathlib import Path\nfrom unittest.mock import patch, MagicMock\nfrom contextlib import contextmanager\nfrom tempfile import TemporaryDirectory\n\nfrom fastcore.foundation import Config\n
@contextmanager\ndef mock_nbdev_readme(mock_contents, d):\n    with patch('__main__.nbdev_readme') as mock_nbdev_readme:\n        mock_nbdev_readme.__wrapped__ = MagicMock()\n        with open((Path(d) / \"README.md\"), \"w\", encoding=\"utf-8\") as f:\n            f.write(mock_contents)\n        yield\n\n\n\n_mock_nbdev_readme_return_value = \"\"\"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\"\"\nwith TemporaryDirectory() as d:\n    with mock_nbdev_readme(_mock_nbdev_readme_return_value, d):\n        nbdev_readme.__wrapped__()\n\n        with open((Path(d) / \"README.md\"), \"r\", encoding=\"utf-8\") as f:\n            contents = f.read()\n\n        print(contents)\n        assert contents == _mock_nbdev_readme_return_value\n
This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\n
@contextmanager\ndef mock_get_config(d, cfg):\n    with patch(\"__main__.get_config\") as mock_get_config:\n        mock_get_config.return_value = cfg\n        yield\n\nwith TemporaryDirectory() as d:\n    _d = dict(\n        config_path=Path(d),\n        doc_host=\"https://airtai.github.io\",\n        lib_path=Path(d) / \"nbdev_mkdocs\",\n        doc_baseurl=\"/nbdev-mkdocs\",\n        docs_versioning=\"minor\",\n        version=\"0.7.0rc0\",\n        lib_name=\"nbdev-mkdocs\",\n    )\n\n    _types = dict(config_path=Path, doc_host=str, lib_path=Path, doc_baseurl=str, docs_versioning=str, version=str, lib_name=str)\n    cfg = Config(str(Path(d)), \"test_settings.ini\", create=_d, save=False, types=_types)\n    with mock_get_config(d, cfg):\n        cfg = get_config()\n\n        print(cfg.config_path)\n        assert cfg.config_path == Path(d)\n        assert cfg.doc_host == 'https://airtai.github.io'\n        assert cfg.lib_path.name == 'nbdev_mkdocs'\n
/tmp/tmpna2i1g2b\n

source

"},{"location":"CLI_Docs_Generator/#update_readme","title":"update_readme","text":"
 update_readme ()\n

Update the readme file and fix the symbol links

fixture = \"\"\"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\"\"\nexpected = {\n    \"minor\": \"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n    \"patch\": \"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n    \"None\": \"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n}\n\nfor docs_versioning in [\"minor\", \"patch\", \"None\", \"\"]:\n    with TemporaryDirectory() as d:\n        readme_path = Path(d) / \"README.md\"\n        _d = dict(\n            config_path=Path(d),\n            doc_host=\"https://airtai.github.io\",\n            lib_path=Path(d) / \"nbdev_mkdocs\",\n            doc_baseurl=\"/nbdev-mkdocs\",\n            docs_versioning=docs_versioning,\n            version=\"0.1.0\",\n            lib_name=\"nbdev-mkdocs\",\n        )\n\n        _types = dict(config_path=Path, doc_host=str, lib_path=Path, doc_baseurl=str, docs_versioning=str, version=str, lib_name=str)\n        cfg = Config(str(Path(d)), \"test_settings.ini\", create=_d, save=False, types=_types)\n        with mock_get_config(d, cfg):\n            with mock_nbdev_readme(fixture, d):\n                update_readme()\n\n            with open(readme_path, \"r\", encoding=\"utf-8\") as f:\n                actual = f.read()\n            print(actual)\n            if docs_versioning == \"\":\n                assert actual == expected[\"None\"]\n            else:\n                assert actual == expected[docs_versioning], f\"actual={actual}, expected={expected[doc_version]}\"\n
This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\nThis is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\nThis is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\nThis is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n
fixture = \"\"\"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\"\"\nexpected = \"This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n\nwith TemporaryDirectory() as d:\n    readme_path = Path(d) / \"README.md\"\n    _d = dict(\n        config_path=Path(d),\n        doc_host=\"https://airtai.github.io\",\n        lib_path=Path(d) / \"nbdev_mkdocs\",\n        doc_baseurl=\"/nbdev-mkdocs\",\n        version=\"0.1.0\",\n        lib_name=\"nbdev-mkdocs\",\n    )\n\n    _types = dict(config_path=Path, doc_host=str, lib_path=Path, doc_baseurl=str, version=str, lib_name=str)\n    cfg = Config(str(Path(d)), \"test_settings.ini\", create=_d, save=False, types=_types)\n    with mock_get_config(d, cfg):\n        with mock_nbdev_readme(fixture, d):\n            update_readme()\n\n        with open(readme_path, \"r\", encoding=\"utf-8\") as f:\n            actual = f.read()\n        print(actual)\n        assert actual == expected\n
This is a link to a symbol [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n
"},{"location":"Doc_Links_Utils/","title":"Doc Links Utils","text":"
import unittest.mock\nfrom contextlib import contextmanager\nfrom unittest.mock import MagicMock\n\nimport pytest\n
fixture = \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\nexpected = \"nbdev_mkdocs.mkdocs.prepare\"\nactual = _get_backtick_enclosed_string(fixture)\ndisplay(actual)\nassert actual == expected\n\nfixture = \"[`google`](https://www.google.com/)\"\nexpected = \"google\"\nactual = _get_backtick_enclosed_string(fixture)\ndisplay(actual)\nassert actual == expected\n\nfixture = \"[`airt.client.Client.get_token`](https://docs.airt.ai/api_client.html#client.get_token)\"\nexpected = \"airt.client.Client.get_token\"\nactual = _get_backtick_enclosed_string(fixture)\ndisplay(actual)\nassert actual == expected\n
'nbdev_mkdocs.mkdocs.prepare'\n\n'google'\n\n'airt.client.Client.get_token'\n
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev\")\nsymbol_details = (\n    \"https://nbdev.fast.ai/api/doclinks.html#nbdevlookup.linkify\",\n    \"nbdev/doclinks.py\",\n    \"https://github.com/fastai/nbdev/blob/master/nbdev/doclinks.py\",\n)\nexpected = \"nbdev.doclinks.NbdevLookup.linkify\"\nactual = _get_sym_path_from_nbdev_lookup(nbdev_lookup, symbol_details)\nprint(actual)\n\nassert actual == expected\n
nbdev.doclinks.NbdevLookup.linkify\n
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\nsymbol_details = (\n    \"https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare\",\n    \"nbdev_mkdocs/mkdocs.py\",\n    \"https://github.com/airtai/nbdev-mkdocs/blob/main/nbdev_mkdocs/mkdocs.py\",\n)\nexpected = \"nbdev_mkdocs.mkdocs.prepare\"\nactual = _get_sym_path_from_nbdev_lookup(nbdev_lookup, symbol_details)\nprint(actual)\n\nassert actual == expected\n
nbdev_mkdocs.mkdocs.prepare\n
with unittest.mock.patch(\"importlib.import_module\") as mock:\n    mock_object = MagicMock()\n    mock_object.whatever = MagicMock()\n    mock_object.whatever.something = \"it works\"\n    mock.return_value = mock_object\n\n    m = importlib.import_module(\"invalid_module\")\n    print(m.whatever.something)\n\n    assert m.whatever.something == \"it works\"\n
it works\n
@contextmanager\ndef mock_fastkafka():\n    with unittest.mock.patch(\"__main__.importlib\") as mock:\n        mock_module = MagicMock(name=\"mock_module\")\n        mock_module._application = MagicMock(name=\"_application\")\n        mock_module._application.app = MagicMock(name=\"app\")\n        mock_module._application.app.FastKafka = MagicMock(name=\"FastKafka\")\n        mock_module._application.app.FastKafka.__qualname__ = \"FastKafka\"\n        mock_module._application.app.FastKafka.__module__ = \"fastkafka\"\n\n        mock_module._application.app.FastKafka.get_topics = MagicMock()\n        mock_module._application.app.FastKafka.get_topics.__qualname__ = (\n            \"FastKafka.get_topics\"\n        )\n        mock_module._application.app.FastKafka.get_topics.__module__ = (\n            \"fastkafka._application.app\"\n        )\n\n        def import_module(s: str, m=mock_module):\n            if s == \"fastkafka._application.app\":\n                return m._application.app\n            elif s == \"fastkafka\":\n                return m._application.app\n            raise ModuleNotFoundError(s)\n\n        mock.import_module = import_module\n\n        yield\n
with mock_fastkafka():\n    m = importlib.import_module(\"fastkafka\")\n    print(m.FastKafka.__module__)\n    print(m.FastKafka.__qualname__)\n    assert m.FastKafka.__module__ == \"fastkafka\"\n    assert m.FastKafka.__qualname__ == \"FastKafka\"\n
fastkafka\nFastKafka\n
with mock_fastkafka():\n    m = importlib.import_module(\"fastkafka._application.app\")\n    print(m.FastKafka.__module__)\n    print(m.FastKafka.__qualname__)\n    assert m.FastKafka.__module__ == \"fastkafka\"\n    assert m.FastKafka.__qualname__ == \"FastKafka\"\n
fastkafka\nFastKafka\n
with mock_fastkafka():\n    fixture = \"fastkafka._application.app.FastKafka\"\n    expected = \"fastkafka.FastKafka\"\n\n    actual = _import_symbol(fixture)\n    print(actual)\n    print(actual.__module__ + \".\" + actual.__qualname__)\n    assert actual.__module__ + \".\" + actual.__qualname__ == expected\n
<MagicMock name='FastKafka' id='140320610827424'>\nfastkafka.FastKafka\n
with mock_fastkafka():\n    fixture = \"fastkafka._application.app.FastKafka.get_topics\"\n    expected = \"fastkafka._application.app.FastKafka.get_topics\"\n\n    actual = _import_symbol(fixture)\n    print(actual.__module__ + \".\" + actual.__qualname__)\n    assert actual.__module__ + \".\" + actual.__qualname__ == expected\n
fastkafka._application.app.FastKafka.get_topics\n
fixture = \"nbdev_mkdocs.mkdocs.prepare\"\nexpected = \"nbdev_mkdocs.mkdocs.prepare\"\n\nactual = _import_symbol(fixture)\nprint(actual.__module__ + \".\" + actual.__qualname__)\nassert actual.__module__ + \".\" + actual.__qualname__ == expected\n
nbdev_mkdocs.mkdocs.prepare\n
fixture = \"nbdev.doclinks.NbdevLookup.linkify\"\nexpected = \"nbdev.doclinks.NbdevLookup.linkify\"\n\nactual = _import_symbol(fixture)\nprint(actual.__module__ + \".\" + actual.__qualname__)\nassert actual.__module__ + \".\" + actual.__qualname__ == expected\n
nbdev.doclinks.NbdevLookup.linkify\n
with pytest.raises(ModuleNotFoundError) as e:\n    _import_symbol(\"invalid_package.module.symbol\")\nstr(e.value)\n
'ModuleNotFound: invalid_package.module.symbol'\n
docs_versioning = \"minor\"\nlib_version = \"2.3.4\"\nactual = _get_current_docs_version(docs_versioning, lib_version)\nexpected = \"2.3\"\n\nprint(actual)\nassert actual == expected\n
2.3\n
docs_versioning = \"patch\"\nlib_version = \"1.0.1\"\nactual = _get_current_docs_version(docs_versioning, lib_version)\nexpected = \"1.0.1\"\n\nprint(actual)\nassert actual == expected\n
1.0.1\n
docs_versioning = \"minor\"\nlib_version = \"1.0.1dev\"\nactual = _get_current_docs_version(docs_versioning, lib_version)\nexpected = \"1.0.1dev\"\n\nprint(actual)\nassert actual == expected\n
1.0.1dev\n
docs_versioning = \"patch\"\nlib_version = \"1.0.1rc0\"\nactual = _get_current_docs_version(docs_versioning, lib_version)\nexpected = \"1.0.1rc0\"\n\nprint(actual)\nassert actual == expected\n
1.0.1rc0\n
for docs_versioning in [\"minor\", \"patch\"]:\n    fixed_part = \"https://airtai.github.io/fastkafka\"\n    lib_version = \"0.0.1\"\n    use_latest_doc_version = True\n\n    expected = \"https://airtai.github.io/fastkafka/latest\"\n    actual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\n    print(actual)\n\n    assert actual == expected\n
https://airtai.github.io/fastkafka/latest\nhttps://airtai.github.io/fastkafka/latest\n
for docs_versioning in [\"\", \"None\"]:\n    fixed_part = \"https://airtai.github.io/fastkafka\"\n    lib_version = \"0.0.1\"\n    use_latest_doc_version = True\n\n    expected = \"https://airtai.github.io/fastkafka\"\n    actual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\n    print(actual)\n\n    assert actual == expected\n
https://airtai.github.io/fastkafka\nhttps://airtai.github.io/fastkafka\n
fixed_part = \"https://airtai.github.io/fastkafka\"\ndocs_versioning = \"\"\nlib_version = \"0.0.1\"\nuse_latest_doc_version = False\n\nexpected = \"https://airtai.github.io/fastkafka\"\nactual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\nprint(actual)\n\nassert actual == expected\n
https://airtai.github.io/fastkafka\n
fixed_part = \"https://airtai.github.io/fastkafka\"\ndocs_versioning = \"None\"\nlib_version = \"0.0.1\"\nuse_latest_doc_version = False\n\nexpected = \"https://airtai.github.io/fastkafka\"\nactual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\nprint(actual)\n\nassert actual == expected\n
https://airtai.github.io/fastkafka\n
fixed_part = \"https://airtai.github.io/fastkafka\"\ndocs_versioning = \"minor\"\nlib_version = \"0.1.0\"\nuse_latest_doc_version = False\n\nexpected = \"https://airtai.github.io/fastkafka/0.1\"\nactual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\nprint(actual)\n\nassert actual == expected\n
https://airtai.github.io/fastkafka/0.1\n
fixed_part = \"https://airtai.github.io/fastkafka\"\ndocs_versioning = \"patch\"\nlib_version = \"0.1.0\"\nuse_latest_doc_version = False\n\nexpected = \"https://airtai.github.io/fastkafka/0.1.0\"\nactual = _append_doc_version(fixed_part, docs_versioning, lib_version, use_latest_doc_version)\nprint(actual)\n\nassert actual == expected\n
https://airtai.github.io/fastkafka/0.1.0\n
o = _import_symbol(\"nbdev_mkdocs.mkdocs.prepare\")\nexpected = \"nbdev_mkdocs/mkdocs/prepare\"\n\nactual = _get_relative_sym_path(o)\nprint(actual)\nassert actual == expected\n
nbdev_mkdocs/mkdocs/prepare\n
with mock_fastkafka():\n    o = _import_symbol(\"fastkafka._application.app.FastKafka\")\n    expected = \"fastkafka/FastKafka\"\n\n    actual = _get_relative_sym_path(o)\n    print(actual)\n    assert actual == expected\n
fastkafka/FastKafka\n
with mock_fastkafka():\n    o = _import_symbol(\"fastkafka._application.app.FastKafka.get_topics\")\n    expected = \"fastkafka/FastKafka\"\n\n    actual = _get_relative_sym_path(o)\n    print(actual)\n    assert actual == expected\n
fastkafka/FastKafka\n
o = _import_symbol(\"nbdev.doclinks.NbdevLookup.linkify\")\nexpected = \"nbdev/doclinks/NbdevLookup\"\n\nactual = _get_relative_sym_path(o)\nprint(actual)\nassert actual == expected\n
nbdev/doclinks/NbdevLookup\n
o = _import_symbol(\"nbdev.doclinks.NbdevLookup\")\nexpected = \"nbdev/doclinks/NbdevLookup\"\n\nactual = _get_relative_sym_path(o)\nprint(actual)\nassert actual == expected\n
nbdev/doclinks/NbdevLookup\n
@contextmanager\ndef mock_fastkafka_nbdev_loopup():\n    syms = {\n        \"fastkafka._application.app.FastKafka\": (\n            \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka\",\n            \"fastkafka/_application/app.py\",\n            \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n        ),\n        \"fastkafka._application.app.FastKafka.get_topics\": (\n            \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka.get_topics\",\n            \"fastkafka/_application/app.py\",\n            \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n        ),\n    }\n    mock_entries = {\n        \"fastkafka\": {\n            \"syms\": {\n                \"fastkafka._application.app\": syms,\n            },\n            \"settings\": {\n                \"branch\": \"main\",\n                \"doc_baseurl\": \"/fastkafka\",\n                \"doc_host\": \"https://airtai.github.io\",\n                \"git_url\": \"https://github.com/airtai/fastkafka\",\n                \"lib_path\": \"fastkafka\",\n            },\n        }\n    }\n\n    nbdev_lookup = NbdevLookup(incl_libs=\"fastkafka\")\n    nbdev_lookup.entries = mock_entries\n    nbdev_lookup.syms = syms\n\n    yield nbdev_lookup\n
with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n    print(mock_nbdev_lookup[\"fastkafka._application.app.FastKafka\"])\n    assert mock_nbdev_lookup[\"fastkafka._application.app.FastKafka\"]\n
('https://airtai.github.io/fastkafka/fastkafka.html#fastkafka', 'fastkafka/_application/app.py', 'https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py')\n
expected = [\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/latest/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/latest/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n]\nwith mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n    with mock_fastkafka():\n        symbol = \"fastkafka.FastKafka.get_topics\"\n        symbol_details = (\n            \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka.get_topics\",\n            \"fastkafka/_application/app.py\",\n            \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n        )\n        docs_versioning = \"\"\n        lib_version = \"0.0.1\"\n\n        for i, docs_versioning in enumerate([\"\", \"None\", \"minor\", \"patch\"]):\n            actual = _update_link(\n                symbol,\n                symbol_details,\n                mock_nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                False,\n                True\n            )\n            print(actual)\n\n            assert actual == expected[i], actual\n
[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/latest/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/latest/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n
expected = [\n    \"[`fastkafka.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n]\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n        with mock_fastkafka():\n            symbol = \"fastkafka.FastKafka.get_topics\"\n            symbol_details = (\n                \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka.get_topics\",\n                \"fastkafka/_application/app.py\",\n                \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n            )\n            docs_versioning = \"\"\n            lib_version = \"0.0.1\"\n\n            for docs_versioning in [\"\", \"None\"]:\n                actual = _update_link(\n                    symbol,\n                    symbol_details,\n                    mock_nbdev_lookup,\n                    docs_versioning,\n                    lib_version,\n                    use_relative_doc_links,\n                    False\n                )\n                print(actual)\n\n                assert actual == expected[i], actual\n
[`fastkafka.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n[`fastkafka.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\n
expected = [\n    \"[`fastkafka.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)\",\n    \"[`fastkafka.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)\",\n]\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n        with mock_fastkafka():\n            symbol = \"fastkafka.FastKafka\"\n            symbol_details = (\n                \"https://airtai.github.io/fastkafka/fastkafka.html#fastkafka\",\n                \"fastkafka/_application/app.py\",\n                \"https://github.com/airtai/fastkafka/blob/main/fastkafka/_application/app.py\",\n            )\n            docs_versioning = \"\"\n            lib_version = \"0.0.1\"\n\n            for docs_versioning in [\"\", \"None\"]:\n                actual = _update_link(\n                    symbol,\n                    symbol_details,\n                    mock_nbdev_lookup,\n                    docs_versioning,\n                    lib_version,\n                    use_relative_doc_links,\n                    False\n                )\n                print(actual)\n\n                assert actual == expected[i], actual\n
[`fastkafka.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)\n[`fastkafka.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)\n[`fastkafka.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)\n[`fastkafka.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)\n
expected = [\n    \"[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n    \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n]\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\n    symbol = \"nbdev_mkdocs.mkdocs.prepare\"\n    symbol_details = (\n        \"https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare\",\n        \"nbdev_mkdocs/mkdocs.py\",\n        \"https://github.com/airtai/nbdev-mkdocs/blob/main/nbdev_mkdocs/mkdocs.py\",\n    )\n    docs_versioning = \"patch\"\n    lib_version = \"0.0.1\"\n    actual = _update_link(\n        symbol,\n        symbol_details,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        False\n    )\n    print(actual)\n\n    assert actual == expected[i], actual\n
[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n
expected = [\n    \"[`prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n    \"[`prepare`](https://airtai.github.io/nbdev-mkdocs/0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\",\n]\n\nnbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\nsymbol = \"prepare\"\nsymbol_details = (\n    \"https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare\",\n    \"nbdev_mkdocs/mkdocs.py\",\n    \"https://github.com/airtai/nbdev-mkdocs/blob/main/nbdev_mkdocs/mkdocs.py\",\n)\ndocs_versioning = \"minor\"\nlib_version = \"0.1.0\"\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    actual = _update_link(\n        symbol,\n        symbol_details,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        False,\n    )\n    print(actual)\n\n    assert actual == expected[i], actual\n
[`prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`prepare`](https://airtai.github.io/nbdev-mkdocs/0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\nsymbol = \"nbdev_mkdocs.mkdocs.prepare\"\nsymbol_details = (\n    \"https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare\",\n    \"nbdev_mkdocs/mkdocs.py\",\n    \"https://github.com/airtai/nbdev-mkdocs/blob/main/nbdev_mkdocs/mkdocs.py\",\n)\n\nlib_version = \"0.0.1rc0\"\nuse_relative_doc_links = False\n\nfor docs_versioning in [\"minor\", \"patch\"]:\n    actual = _update_link(\n        symbol,\n        symbol_details,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        False\n    )\n\n    expected = \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1rc0/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    print(actual)\n\n    assert actual == expected, actual\n\nuse_relative_doc_links = True\nfor docs_versioning in [\"minor\", \"patch\"]:\n    actual = _update_link(\n        symbol,\n        symbol_details=symbol_details,\n        nbdev_lookup=nbdev_lookup,\n        docs_versioning=docs_versioning,\n        lib_version=lib_version,\n        use_relative_doc_links=use_relative_doc_links,\n        use_latest_doc_version=False\n    )\n\n    expected = \"[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    print(actual)\n\n    assert actual == expected, actual\n
[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1rc0/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.0.1rc0/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n[`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\n

source

"},{"location":"Doc_Links_Utils/#fix_sym_links","title":"fix_sym_links","text":"
 fix_sym_links (s:str,\n                nbdev_lookup:<functools._lru_cache_wrapperobjectat0x7f5824\n                b047c0>, docs_versioning:str, lib_version:str,\n                use_relative_doc_links:bool,\n                use_latest_doc_version:bool=False)\n

Fix the default sym links generated by nbdev in the given string.

Args: s: The string to fix nbdev_lookup: Instance of the NbdevLookup class. docs_versioning: The value set for docs_versioning flag in settings.ini file. lib_version: The current version of the library. use_relative_doc_links: If set to True, relative link to symbols will be add in the generated documentation for easier local navigation. use_latest_doc_version: If set to True, the latest version of the docs will be appended to the symbol link.

Returns: The string with correct links added to the symbol references.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Type Default Details s str nbdev_lookup NbdevLookup docs_versioning str lib_version str use_relative_doc_links bool use_latest_doc_version bool False Returns str type: ignore
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\ndocs_versioning = \"patch\"\nlib_version = \"0.1.1\"\n\nuse_relative_doc_links = False\nuse_latest_doc_version = True\nfor symbol in [\"prepare\", \"nbdev_mkdocs.mkdocs.prepare\"]:\n    fixture = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n    expected = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    actual = fix_sym_links(\n        fixture,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        use_latest_doc_version,\n    )\n    display(actual)\n    assert actual == expected\n\n\nfixture = f\"This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\nexpected = f\"This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\nfor docs_versioning in [\"\", \"None\"]:\n    actual = fix_sym_links(\n        fixture,\n        nbdev_lookup,\n        docs_versioning,\n        lib_version,\n        use_relative_doc_links,\n        use_latest_doc_version,\n    )\n    display(actual)\n    assert actual == expected, expected\n
'This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/latest/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n
nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\ndocs_versioning = \"patch\"\nlib_version = \"0.1.1\"\n\nuse_relative_doc_links = False\nfor symbol in [\"prepare\", \"nbdev_mkdocs.mkdocs.prepare\"]:\n    fixture = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n    expected = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/0.1.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    actual = fix_sym_links(\n        fixture, nbdev_lookup, docs_versioning, lib_version, use_relative_doc_links\n    )\n    display(actual)\n    assert actual == expected\n\nuse_relative_doc_links = True\nfor symbol in [\"prepare\", \"nbdev_mkdocs.mkdocs.prepare\"]:\n    fixture = f\"This is a link to a symbol: [`{symbol}`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n    expected = f\"This is a link to a symbol: [`{symbol}`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)\"\n    actual = fix_sym_links(\n        fixture, nbdev_lookup, docs_versioning, lib_version, use_relative_doc_links\n    )\n    display(actual)\n    assert actual == expected\n
'This is a link to a symbol: [`prepare`](https://airtai.github.io/nbdev-mkdocs/0.1.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/0.1.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n\n'This is a link to a symbol: [`nbdev_mkdocs.mkdocs.prepare`](api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare)'\n
# Tests for external links\n\nnbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\ndocs_versioning = \"None\"\nlib_version = \"0.1.1\"\n\nuse_relative_doc_links = False\nfor external_link in [\n    \"[`google`](https://www.google.com/)\",\n    \"[`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)\",\n]:\n    fixture = f\"Link to external link, do not modify: {external_link}\"\n    expected = f\"Link to external link, do not modify: {external_link}\"\n\n    actual = fix_sym_links(\n        fixture, nbdev_lookup, docs_versioning, lib_version, use_relative_doc_links\n    )\n    display(actual)\n    assert actual == expected, actual\n\nuse_relative_doc_links = True\nfor external_link in [\n    \"[`google`](https://www.google.com/)\",\n    \"[`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)\",\n]:\n    fixture = f\"Link to external link, do not modify: {external_link}\"\n    expected = f\"Link to external link, do not modify: {external_link}\"\n\n    actual = fix_sym_links(\n        fixture, nbdev_lookup, docs_versioning, lib_version, use_relative_doc_links\n    )\n    display(actual)\n    assert actual == expected, actual\n
'Link to external link, do not modify: [`google`](https://www.google.com/)'\n\n'Link to external link, do not modify: [`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)'\n\n'Link to external link, do not modify: [`google`](https://www.google.com/)'\n\n'Link to external link, do not modify: [`numpy.array`](https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array)'\n
docs_versioning = \"None\"\nlib_version = \"0.1.1\"\nfixture = \"This is a link to a symbol: [`fastkafka._application.app.FastKafka`](https://airtai.github.io/fastkafka/fastkafka.html#fastkafka)\"\nexpected = [\n    \"This is a link to a symbol: [`fastkafka._application.app.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)\",\n    \"This is a link to a symbol: [`fastkafka._application.app.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)\",\n]\nfor i, use_relative_doc_links in enumerate([True, False]):\n    with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n        with mock_fastkafka():\n            actual = fix_sym_links(\n                fixture,\n                mock_nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                use_relative_doc_links,\n            )\n            display(actual)\n            assert actual == expected[i]\n
'This is a link to a symbol: [`fastkafka._application.app.FastKafka`](api/fastkafka/FastKafka/#fastkafka.FastKafka)'\n\n'This is a link to a symbol: [`fastkafka._application.app.FastKafka`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka.FastKafka)'\n
docs_versioning = \"None\"\nlib_version = \"0.1.1\"\n\nfixture = \"This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](https://airtai.github.io/fastkafka/fastkafka.html#fastkafka)\"\nexpected = [\n    \"This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n    \"This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)\",\n]\n\nfor i, use_relative_doc_links in enumerate([True, False]):\n    with mock_fastkafka_nbdev_loopup() as mock_nbdev_lookup:\n        with mock_fastkafka():\n            actual = fix_sym_links(\n                fixture,\n                mock_nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                use_relative_doc_links,\n            )\n            display(actual)\n            assert actual == expected[i]\n
'This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)'\n\n'This is a link to a symbol: [`fastkafka._application.app.FastKafka.get_topics`](https://airtai.github.io/fastkafka/api/fastkafka/FastKafka/#fastkafka._application.app.FastKafka.get_topics)'\n
"},{"location":"Docstring/","title":"Docstring helpers","text":"
import numpy as np\nimport pytest\n
logger.warning(\"xs\")\n
WARNING:__main__:xs\n
def f(i: str, *, a: int = 0):\n    \"\"\"Very cool function\n\n    **f** is a very cool function\n\n    Args:\n        i: something\n        a: something else\n\n    Example:\n        The following snippet prints out greetings for two names:\n        ```python\n        print(\"hello {fill in name_1}\")\n        print(\"goodbye {fill in name_2}\")\n        ```\n\n\n    Example:\n        Yet another example\n        ```python\n        password = {fill in password}\n        print(f\"this is your password: {password}\")\n\n\n        from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n        print(\"Logging in...\")\n        ```\n\n    \"\"\"\n    raise NotImplemented()\n
def g():\n    \"\"\"Function\n\n    Example:\n        ```python\n        from airt.helpers import print_header\n\n        print(\"hello world\")\n        ```\n\n    Example:\n        ``` python\n        from nbdev_mkdocs._package_data import get_root_data_path\n\n        req_path = get_root_data_path() / \"requirements.txt\"\n        print(f\"Path is: {req_path.resolve()}\")\n        assert req_path.exists()\n        ```\n    \"\"\"\n\n\n_extract_examples_from_docstring(g)\n
['\\nfrom airt.helpers import print_header\\n\\nprint(\"hello world\")\\n',\n '\\nfrom nbdev_mkdocs._package_data import get_root_data_path\\n\\nreq_path = get_root_data_path() / \"requirements.txt\"\\nprint(f\"Path is: {req_path.resolve()}\")\\nassert req_path.exists()\\n']\n
_extract_examples_from_docstring(f)\n
['\\nprint(\"hello {fill in name_1}\")\\nprint(\"goodbye {fill in name_2}\")\\n',\n '\\npassword = {fill in password}\\nprint(f\"this is your password: {password}\")\\n\\n\\nfrom  nbdev_mkdocs.docstring import run_examples_from_docstring\\n\\nprint(\"Logging in...\")\\n']\n
expected = [\n    textwrap.dedent(\n        \"\"\"\n            print(\"hello {fill in name_1}\")\n            print(\"goodbye {fill in name_2}\")\n        \"\"\"\n    ),\n    textwrap.dedent(\n        \"\"\"\n            password = {fill in password}\n            print(f\"this is your password: {password}\")\n\n\n            from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n            print(\"Logging in...\")\n        \"\"\"\n    ),\n]\n\nexamples = _extract_examples_from_docstring(f)\nfor example in examples:\n    print(example)\n\nnp.testing.assert_array_equal(examples, expected)\n
\nprint(\"hello {fill in name_1}\")\nprint(\"goodbye {fill in name_2}\")\n\n
\npassword = {fill in password}\nprint(f\"this is your password: {password}\")\n\n\nfrom  nbdev_mkdocs.docstring import run_examples_from_docstring\n\nprint(\"Logging in...\")\n\n
examples[0] == expected[0]\n
True\n
expected = [\"name_1\", \"name_2\", \"password\"]\n\nkeywords = _get_keywords(examples)\n\nnp.testing.assert_array_equal(keywords, expected)\n
expected = [\n    textwrap.dedent(\n        \"\"\"\n            print(\"hello davor\")\n            print(\"goodbye kumaran\")\n        \"\"\"\n    ),\n    textwrap.dedent(\n        \"\"\"\n            password = 'not_a_password'\n            print(f\"this is your password: {password}\")\n\n\n            from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n            print(\"Logging in...\")\n        \"\"\"\n    ),\n]\n\nactual = _replace_keywords(\n    examples, name_1=\"davor\", name_2=\"kumaran\", password=\"'not_a_password'\"\n)\nfor x in actual:\n    print(x)\n\nnp.testing.assert_array_equal(actual, expected)\n
\nprint(\"hello davor\")\nprint(\"goodbye kumaran\")\n\n
\npassword = 'not_a_password'\nprint(f\"this is your password: {password}\")\n\n\nfrom  nbdev_mkdocs.docstring import run_examples_from_docstring\n\nprint(\"Logging in...\")\n\n
width = 80\n\nconsole = Console(width=width)\n# panel = Panel(\ng = Group(\n    Rule(\"Code\"),\n    'print(\"stuff\")',\n    _format_output(\"hello world and one more time world\", title=\"output\", width=width),\n    _format_output(\n        \"hello world and one more time world\",\n        title=\"output\",\n        sub_dict={\"world\": \"*****\"},\n        width=width,\n    ),\n    _format_output(\n        \"hello world and one more time world\",\n        title=\"output\",\n        sub_dict={\"world\": \"*****\"},\n        supress=True,\n        width=width,\n    ),\n)  # ,\n#     title=\"Test: _format_output()\",\n#     width=width\n# )\n# console.print(panel)\nconsole.print(g)\n
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 Code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nprint(\"stuff\")\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 output \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nhello world and one more time world\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 output \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nhello ***** and one more time *****\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 output supressed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nN/A\n

source

"},{"location":"Docstring/#run_examples_from_docstring","title":"run_examples_from_docstring","text":"
 run_examples_from_docstring (o:Any, supress_stdout:bool=False,\n                              supress_stderr:bool=False,\n                              sub_dict:Optional[Dict[str,str]]=None,\n                              width:Optional[int]=80, **kwargs:str)\n

Runs example from a docstring

Parses docstring of an objects looking for examples. The examples are then saved into files and executed in a separate process.

Note: Execution context is not the same as the one in the notebook because we want examples to work from user code. Make sure you compiled the library prior to executing the examples, otherwise you might be running them agains an old version of the library.

Args: o: an object, typically a function or a class, for which docstring is being parsed for examples supress_stdout: omit stdout from output, typically due to security considerations supress_stderr: omit stderr from output, typically due to security considerations sub_dict: a dictionary mapping regexp patterns into replacement strings used to mask stdout and stderr, typically used to mask sensitive information such as passwords

**kwargs: arguments use to replace \"{fill in **param**}\" in docstring with the actual values when running examples\n

Raises: ValueError: if some params are missing from the kwargs RuntimeException: if example fails

Example: ```python from nbdev_mkdocs.docstring import run_examples_from_docstring

def f():\n    ```python\n    Example:\n        print(\"Hello {fill in name}!\")\n        print(\"Goodbye {fill in other_name}!\")\n    ```\n    pass\n\nrun_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")\n```\n

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

print(run_examples_from_docstring.__doc__)\n
Runs example from a docstring\n\n    Parses docstring of an objects looking for examples. The examples are then saved into files and executed\n    in a separate process.\n\n    Note:\n        Execution context is not the same as the one in the notebook because we want examples to work from\n        user code. Make sure you compiled the library prior to executing the examples, otherwise you might\n        be running them agains an old version of the library.\n\n    Args:\n        o: an object, typically a function or a class, for which docstring is being parsed for examples\n        supress_stdout: omit stdout from output, typically due to security considerations\n        supress_stderr: omit stderr from output, typically due to security considerations\n        sub_dict: a dictionary mapping regexp patterns into replacement strings used to mask stdout and\n            stderr, typically used to mask sensitive information such as passwords\n\n        **kwargs: arguments use to replace \"{fill in **param**}\" in docstring with the actual values when running \nexamples\n\n    Raises:\n        ValueError: if some params are missing from the **kwargs**\n        RuntimeException: if example fails\n\n    Example:\n        ```python\n        from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n        def f():\n            
Example:\n    <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">print</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008000; text-decoration-color: #008000\">\"Hello {fill in name}!\"</span><span style=\"font-weight: bold\">)</span>\n    <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">print</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008000; text-decoration-color: #008000\">\"Goodbye {fill in other_name}!\"</span><span style=\"font-weight: bold\">)</span>\n
\n pass\n\n\n run_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")\n ```\n\n !!! note\n\n The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n \n
examples = _extract_examples_from_docstring(run_examples_from_docstring)\n\nconsole = Console(width=80)\nconsole.print(Panel(examples[0]))\n
ERROR:griffe.agents.nodes:Failed to parse annotation from 'Name' node: 'NoneType' object has no attribute 'resolve'\nERROR:griffe.agents.nodes:Failed to parse annotation from 'Name' node: 'NoneType' object has no attribute 'resolve'\n
\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502                                                                              \u2502\n\u2502 from  nbdev_mkdocs.docstring import run_examples_from_docstring              \u2502\n\u2502                                                                              \u2502\n\u2502 def f():                                                                     \u2502\n\u2502     ```python                                                                \u2502\n\u2502     Example:                                                                 \u2502\n\u2502         print(\"Hello {fill in name}!\")                                       \u2502\n\u2502         print(\"Goodbye {fill in other_name}!\")                               \u2502\n\u2502     ```                                                                      \u2502\n\u2502     pass                                                                     \u2502\n\u2502                                                                              \u2502\n\u2502                                                                              \u2502\n\u2502 run_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")               \u2502\n\u2502                                                                              \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n
run_examples_from_docstring(\n    f,\n    name_1=\"davor\",\n    name_2=\"all\",\n    password='\"zeko\"',\n    supress_stderr=True,\n    sub_dict={\"zeko\": \"*\" * 12},\n)\n
Example:\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n    print(\"hello {fill in name_1}\")\n    print(\"goodbye {fill in name_2}\")\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stdout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nhello davor\ngoodbye all\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stderr supressed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nN/A\n
Example:\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n    password = {fill in password}\n    print(f\"this is your password: {password}\")\n\n\n    from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n    print(\"Logging in...\")\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stdout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nthis is your password: ************\nLogging in...\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stderr supressed \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nN/A\n
with pytest.raises(ValueError) as e:\n    run_examples_from_docstring(f, name_1=\"davor\")\n\ne.value\n
ValueError(\"{'name_2', 'password', 'name_1'} > {'name_1'}\")\n
class C:\n    \"\"\"Cool class with broken example\n\n    Example:\n        ```python\n        from nbdev_mkdocs.docstring import run_examples_from_docstring\n\n        raise NotImplementedError(\"expected to fail\")\n        ```\n    \"\"\"\n\n    pass\n
with pytest.raises(RuntimeError) as e:\n    run_examples_from_docstring(C)\ne.value\n
Example:\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n    from nbdev_mkdocs.docstring import run_examples_from_docstring\n\n    raise NotImplementedError(\"expected to fail\")\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stdout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stderr \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nTraceback (most recent call last):\n  File \n\"/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpzpgw9w14/example.py\", line \n4, in <module>\n    raise NotImplementedError(\"expected to fail\")\nNotImplementedError: expected to fail\n\n
RuntimeError('Traceback (most recent call last):\\n  File \"/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpzpgw9w14/example.py\", line 4, in <module>\\n    raise NotImplementedError(\"expected to fail\")\\nNotImplementedError: expected to fail\\n')\n
from nbdev_mkdocs._package_data import get_root_data_path\n
print(get_root_data_path.__doc__)\n
Returns path to package_data in lib\n\n    Example:\n        ``` python\n        from nbdev_mkdocs._package_data import get_root_data_path\n\n        mkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\n        print(f\"Path is: {mkdocs_template_path.resolve()}\")\n        assert mkdocs_template_path.exists()\n\n        ```\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \n
_extract_examples_from_docstring(get_root_data_path)\n
['\\nfrom nbdev_mkdocs._package_data import get_root_data_path\\n\\nmkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\\nprint(f\"Path is: {mkdocs_template_path.resolve()}\")\\nassert mkdocs_template_path.exists()\\n\\n']\n
"},{"location":"Mkdocs/","title":"Mkdocs","text":"
import asyncio\nimport json\nimport random\nimport string\nimport unittest.mock\nfrom contextlib import contextmanager\nfrom tempfile import TemporaryDirectory\nfrom unittest.mock import patch\nfrom inspect import getsource, getsourcefile\n\nimport numpy as np\nimport pytest\nfrom fastcore.imports import IN_NOTEBOOK\nfrom nbdev.config import nbdev_create_config\nfrom nbdev.quarto import nbdev_readme\nfrom ruamel.yaml import YAML\nimport nbformat\n\nfrom nbdev_mkdocs.social_image_generator import _read_yaml_file\n
"},{"location":"Mkdocs/#create-new","title":"Create new","text":""},{"location":"Mkdocs/#create-mkdocs-dir","title":"Create mkdocs dir","text":"
with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    _create_mkdocs_dir(d)\n\n    print(\"\\n\".join([str(p) for p in (Path(d) / \"mkdocs\").glob(\"**/*\")]))\n
Directory /tmp/tmpwr9ip3mc/mkdocs created.\n/tmp/tmpwr9ip3mc/mkdocs/site_overrides\n/tmp/tmpwr9ip3mc/mkdocs/docs\n/tmp/tmpwr9ip3mc/mkdocs/site\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides\n/tmp/tmpwr9ip3mc/mkdocs/site_overrides/main.html\n/tmp/tmpwr9ip3mc/mkdocs/site_overrides/partials\n/tmp/tmpwr9ip3mc/mkdocs/site_overrides/partials/copyright.html\n/tmp/tmpwr9ip3mc/mkdocs/docs/images\n/tmp/tmpwr9ip3mc/mkdocs/docs/images/.ipynb_checkpoints\n/tmp/tmpwr9ip3mc/mkdocs/site/assets\n/tmp/tmpwr9ip3mc/mkdocs/site/assets/.ipynb_checkpoints\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/images\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/js\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/css\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/images/compass-outline.png\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/images/default_social_logo.png\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/js/extra.js\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/js/mathjax.js\n/tmp/tmpwr9ip3mc/mkdocs/docs_overrides/css/extra.css\n
"},{"location":"Mkdocs/#create-mkdocsyml","title":"Create Mkdocs.yml","text":"
assert _mkdocs_template_path.exists()\n
print(_mkdocs_template)\n
# Site\nsite_name: {title}\nsite_url: {doc_host}{doc_baseurl}\nsite_author: {author}\nsite_description: {description}\n\n# Repository\nrepo_name: {repo}\nrepo_url: {git_url}\nedit_uri: \"\"\n\ncopyright: {copyright}\n\ndocs_dir: docs\nsite_dir: site\n\nplugins:\n- literate-nav:\n    nav_file: SUMMARY.md\n- search\n- mkdocstrings:\n    handlers:\n      python:\n        import:\n            - https://docs.python.org/3/objects.inv\n        options:\n            heading_level: 2\n            show_category_heading: true\n            show_root_heading: true\n            show_root_toc_entry: true\n            show_signature_annotations: true\n            show_if_no_docstring: true\n\nmarkdown_extensions:\n    - md_in_html\n    - pymdownx.arithmatex:\n        generic: true\n    - pymdownx.inlinehilite\n    - pymdownx.details\n    - pymdownx.emoji\n    - pymdownx.magiclink\n    - pymdownx.superfences:\n        custom_fences:\n          - name: mermaid\n            class: mermaid\n            format: !!python/name:pymdownx.superfences.fence_code_format\n    - pymdownx.tasklist\n    - pymdownx.highlight:\n        linenums: false\n    - pymdownx.snippets:\n        check_paths: true\n    - pymdownx.tabbed:\n        alternate_style: true\n    - admonition\n    - toc:\n        permalink: \"\u00a4\"\n#     - callouts\n\ntheme:\n  name: material\n  custom_dir: site_overrides\n  features:\n    - navigation.instant\n#     - navigation.tabs\n#     - navigation.tabs.sticky\n#     - navigation.sections\n#     - navigation.expand\n    - navigation.indexes\n    - navigation.top\n#     - toc.integrates\n    - search.suggest\n    - search.highlight\n    - search.share\n  palette:\n    - scheme: slate\n      primary: black\n      accent: yellow\n      toggle:\n        icon: material/toggle-switch\n        name: Switch to light mode\n    - scheme: default\n      primary: black # deep orange\n      accent: red\n      toggle:\n        icon: material/toggle-switch-off-outline\n        name: Switch to dark mode\n  icon:\n    repo: fontawesome/brands/github\n#     repo: fontawesome/brands/gitlab\n    logo: material/compass-outline\n#     admonition:\n#         <type>: <icon> \n  favicon: overrides/images/compass-outline.png\n\nextra_css:\n  - overrides/css/extra.css\n\nextra_javascript:\n  - overrides/js/extra.js\n  - overrides/js/mathjax.js\n  - https://polyfill.io/v3/polyfill.min.js?features=es6\n  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js  \nextra:\n  version:\n    provider: mike\n  social_image: \"\"\n
with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    kwargs = _get_kwargs_from_settings(settings_path)\n\n    actual = _mkdocs_template.format(**kwargs)\n\nkwargs\n
{'title': 'nbdev-mkdocs',\n 'doc_host': 'https://airtai.github.io',\n 'doc_baseurl': '/nbdev-mkdocs',\n 'author': 'airt',\n 'description': 'Extension of nbdev for generating documentation using Material for Mkdocs instead of Quarto',\n 'repo': 'nbdev-mkdocs',\n 'git_url': 'https://github.com/airtai/nbdev-mkdocs',\n 'copyright': '2022 onwards, airt'}\n
with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    _create_mkdocs_yaml(d)\n\n#     !cat {d}/mkdocs/mkdocs.yml\n
File '/tmp/tmpc7rr0nih/mkdocs/mkdocs.yml' generated.\n
"},{"location":"Mkdocs/#create-summary_templatetxt","title":"Create summary_template.txt","text":"
with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    _create_mkdocs_yaml(d)\n    _create_summary_template(d)\n\n    sidebar = \"\"\"- [Home](index.md)\n- Guides\n    - [Guide one](docs/guide_1.md)\n- Tutorial\n    - [Tutorial one](docs/tutorial_1.md)\"\"\"\n\n    api = \"\"\"    - [numpy.array](api/numpy/array.md)\"\"\"\n\n    cli = \"\"\"    - [my-cli](cli/my_cli.md)\"\"\"\n\n    changelog = \"(CHANGELOG.md)\"\n\n    with open((Path(d) / \"mkdocs/summary_template.txt\"), \"r\", encoding=\"utf-8\") as f:\n        summary_template = f.read()\n        actual = summary_template.format(\n            sidebar=sidebar, api=api, cli=cli, changelog=changelog\n        )\n\nexpected = \"\"\"- [Home](index.md)\n- Guides\n    - [Guide one](docs/guide_1.md)\n- Tutorial\n    - [Tutorial one](docs/tutorial_1.md)\n- API\n    - [numpy.array](api/numpy/array.md)\n- CLI\n    - [my-cli](cli/my_cli.md)\n- [Releases](CHANGELOG.md)\n\"\"\"\nprint(actual)\n\nassert actual == expected, actual\n
File '/tmp/tmp0g5s2f4t/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp0g5s2f4t/mkdocs/summary_template.txt' generated.\n- [Home](index.md)\n- Guides\n    - [Guide one](docs/guide_1.md)\n- Tutorial\n    - [Tutorial one](docs/tutorial_1.md)\n- API\n    - [numpy.array](api/numpy/array.md)\n- CLI\n    - [my-cli](cli/my_cli.md)\n- [Releases](CHANGELOG.md)\n
with TemporaryDirectory() as d:\n    assert not (Path(d) / \".github\" / \"workflows\" / \"deploy.yaml\").exists()\n    _replace_ghp_deploy_action(d)\n    assert (Path(d) / \".github\" / \"workflows\" / \"deploy.yaml\").exists()\n
@contextmanager\ndef unset_env_var(name: str):\n    \"\"\"Unset an environment variable.\n\n    Args:\n        name: The name of the environment variable to unset.\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    in_test_defined = name in os.environ\n    if in_test_defined:\n        original_value = os.environ.get(name)\n        del os.environ[name]\n    try:\n        yield\n    finally:\n        if in_test_defined:\n            os.environ[name] = original_value\n\n\ndef run_nbdev_new(d, random_string: str = None):\n    \"\"\"Run nbdev_new\n\n    Args:\n        d: the directory to run nbdev_new in\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    Path(Path(d) / \"nbs\").mkdir(exist_ok=True)\n\n    # Create a sample .gitignore file\n    gitignore_path = Path(d) / \".gitignore\"\n    sample_git_ignore = (\n        \"_docs/\"\n        \"_proc/\\n\"\n        \"*.bak\\n\"\n        \"# Byte-compiled / optimized / DLL files\\n\"\n        \"__pycache__/\"\n    )\n\n    with gitignore_path.open(\"w\", encoding=\"utf-8\") as f:\n        f.write(sample_git_ignore)\n\n    assert gitignore_path.exists()\n\n    # copy nbdev-mkdocs/nbs/index.ipynb folder to {d}/nbs/index.ipynb\n    for fname in [\"index.ipynb\"]:\n        shutil.copyfile(path / \"nbs\" / fname, Path(d) / \"nbs\" / fname)\n\n    # copy config files from nbdev-mkdocs/ to {d}/\n    for fname in [\"setup.py\"]:\n        shutil.copyfile(path / fname, Path(d) / fname)\n\n    # Generate settings.ini using nbdev in {d}\n    with set_cwd(d):\n        repo = f\"repo_{random_string}\" if random_string != None else \"repo\"\n        nbdev_create_config(\n            repo=repo,\n            branch=\"branch\",\n            user=\"user\",\n            author=\"author\",\n            author_email=\"author@mail.com\",\n            description=\"description\",\n        )\n        refresh_quarto_yml()\n\n        with unset_env_var(\"IN_TEST\"):\n            nbdev_export.__wrapped__()\n\n        nbdev_readme.__wrapped__(chk_time=True)\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n    assert (Path(d) / \"repo\").exists()\n\n    gitignore_path = Path(d) / \".gitignore\"\n\n    with open(gitignore_path, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n        assert \"mkdocs/docs/\" not in contents\n        assert \"mkdocs/site/\" not in contents\n\n    _update_gitignore_file(d)\n\n    with open(gitignore_path, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n        print(contents)\n        assert \"mkdocs/docs/\" in contents\n        assert \"mkdocs/site/\" in contents\n
settings.ini created.\n_docs/_proc/\n*.bak\n# Byte-compiled / optimized / DLL files\n__pycache__/\n\n# nbdev_mkdocs\nmkdocs/docs/\nmkdocs/site/\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    _create_mkdocs_dir(d)\n    _create_mkdocs_yaml(d)\n    _create_summary_template(d)\n    _replace_ghp_deploy_action(d)\n    _update_gitignore_file(d)\n\n    _generate_default_social_image_link(d)\n\n    def _f():\n        with _read_yaml_file(Path(d) / \"mkdocs/mkdocs.yml\") as (yaml, config):\n            print(config)\n            assert config[\"extra\"][\"social_image\"] != \"\"\n\n    _f()\n
settings.ini created.\nDirectory /tmp/tmp3t28sqwd/mkdocs created.\nFile '/tmp/tmp3t28sqwd/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp3t28sqwd/mkdocs/summary_template.txt' generated.\n{'site_name': 'repo', 'site_url': 'https://user.github.io/repo', 'site_author': 'author', 'site_description': 'description', 'repo_name': 'repo', 'repo_url': 'https://github.com/user/repo', 'edit_uri': '', 'copyright': '2023 onwards, author', 'docs_dir': 'docs', 'site_dir': 'site', 'plugins': [{'literate-nav': {'nav_file': 'SUMMARY.md'}}, 'search', {'mkdocstrings': {'handlers': {'python': {'import': ['https://docs.python.org/3/objects.inv'], 'options': {'heading_level': 2, 'show_category_heading': True, 'show_root_heading': True, 'show_root_toc_entry': True, 'show_signature_annotations': True, 'show_if_no_docstring': True}}}}}], 'markdown_extensions': ['md_in_html', {'pymdownx.arithmatex': {'generic': True}}, 'pymdownx.inlinehilite', 'pymdownx.details', 'pymdownx.emoji', 'pymdownx.magiclink', {'pymdownx.superfences': {'custom_fences': [{'name': 'mermaid', 'class': 'mermaid', 'format': <ruamel.yaml.comments.TaggedScalar object>}]}}, 'pymdownx.tasklist', {'pymdownx.highlight': {'linenums': False}}, {'pymdownx.snippets': {'check_paths': True}}, {'pymdownx.tabbed': {'alternate_style': True}}, 'admonition', {'toc': {'permalink': '\u00a4'}}], 'theme': {'name': 'material', 'custom_dir': 'site_overrides', 'features': ['navigation.instant', 'navigation.indexes', 'navigation.top', 'search.suggest', 'search.highlight', 'search.share'], 'palette': [{'scheme': 'slate', 'primary': 'black', 'accent': 'yellow', 'toggle': {'icon': 'material/toggle-switch', 'name': 'Switch to light mode'}}, {'scheme': 'default', 'primary': 'black', 'accent': 'red', 'toggle': {'icon': 'material/toggle-switch-off-outline', 'name': 'Switch to dark mode'}}], 'icon': {'repo': 'fontawesome/brands/github', 'logo': 'material/compass-outline'}, 'favicon': 'overrides/images/compass-outline.png'}, 'extra_css': ['overrides/css/extra.css'], 'extra_javascript': ['overrides/js/extra.js', 'overrides/js/mathjax.js', 'https://polyfill.io/v3/polyfill.min.js?features=es6', 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'], 'extra': {'version': {'provider': 'mike'}, 'social_image': 'https://opengraph.githubassets.com/1688963841.721823/user/repo'}}\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
"},{"location":"Mkdocs/#bringing-it-all-together","title":"Bringing it all together","text":"

source

"},{"location":"Mkdocs/#new","title":"new","text":"
 new (root_path:str)\n

Initialize mkdocs project files

Creates mkdocs directory in the root_path directory and populates it with initial values. You should edit mkdocs.yml file to customize it if needed.

Args: root_path: The path to the root of the project

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    new(d)\n\n    mkdocs_path = Path(d) / \"mkdocs\"\n\n    assert mkdocs_path.exists()\n    assert (mkdocs_path / \"mkdocs.yml\").exists()\n    assert (mkdocs_path / \"site_overrides\" / \"main.html\").exists()\n    assert (mkdocs_path / \"site_overrides\" / \"partials\" / \"copyright.html\").exists()\n    assert (mkdocs_path / \"summary_template.txt\").exists()\n\n    gitignore_path = Path(d) / \".gitignore\"\n    with open(gitignore_path, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n        print(contents)\n        assert \"mkdocs/docs/\" in contents\n        assert \"mkdocs/site/\" in contents\n\n    def _f():\n        with _read_yaml_file(Path(d) / \"mkdocs/mkdocs.yml\") as (yaml, config):\n            print(config)\n            assert config[\"extra\"][\"social_image\"] != \"\"\n\n    _f()\n
settings.ini created.\nDirectory /tmp/tmpjort0ypv/mkdocs created.\nFile '/tmp/tmpjort0ypv/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpjort0ypv/mkdocs/summary_template.txt' generated.\n_docs/_proc/\n*.bak\n# Byte-compiled / optimized / DLL files\n__pycache__/\n\n# nbdev_mkdocs\nmkdocs/docs/\nmkdocs/site/\n{'site_name': 'repo', 'site_url': 'https://user.github.io/repo', 'site_author': 'author', 'site_description': 'description', 'repo_name': 'repo', 'repo_url': 'https://github.com/user/repo', 'edit_uri': '', 'copyright': '2023 onwards, author', 'docs_dir': 'docs', 'site_dir': 'site', 'plugins': [{'literate-nav': {'nav_file': 'SUMMARY.md'}}, 'search', {'mkdocstrings': {'handlers': {'python': {'import': ['https://docs.python.org/3/objects.inv'], 'options': {'heading_level': 2, 'show_category_heading': True, 'show_root_heading': True, 'show_root_toc_entry': True, 'show_signature_annotations': True, 'show_if_no_docstring': True}}}}}], 'markdown_extensions': ['md_in_html', {'pymdownx.arithmatex': {'generic': True}}, 'pymdownx.inlinehilite', 'pymdownx.details', 'pymdownx.emoji', 'pymdownx.magiclink', {'pymdownx.superfences': {'custom_fences': [{'name': 'mermaid', 'class': 'mermaid', 'format': <ruamel.yaml.comments.TaggedScalar object>}]}}, 'pymdownx.tasklist', {'pymdownx.highlight': {'linenums': False}}, {'pymdownx.snippets': {'check_paths': True}}, {'pymdownx.tabbed': {'alternate_style': True}}, 'admonition', {'toc': {'permalink': '\u00a4'}}], 'theme': {'name': 'material', 'custom_dir': 'site_overrides', 'features': ['navigation.instant', 'navigation.indexes', 'navigation.top', 'search.suggest', 'search.highlight', 'search.share'], 'palette': [{'scheme': 'slate', 'primary': 'black', 'accent': 'yellow', 'toggle': {'icon': 'material/toggle-switch', 'name': 'Switch to light mode'}}, {'scheme': 'default', 'primary': 'black', 'accent': 'red', 'toggle': {'icon': 'material/toggle-switch-off-outline', 'name': 'Switch to dark mode'}}], 'icon': {'repo': 'fontawesome/brands/github', 'logo': 'material/compass-outline'}, 'favicon': 'overrides/images/compass-outline.png'}, 'extra_css': ['overrides/css/extra.css'], 'extra_javascript': ['overrides/js/extra.js', 'overrides/js/mathjax.js', 'https://polyfill.io/v3/polyfill.min.js?features=es6', 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'], 'extra': {'version': {'provider': 'mike'}, 'social_image': 'https://opengraph.githubassets.com/1688963843.640516/user/repo'}}\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
"},{"location":"Mkdocs/#build","title":"Build","text":""},{"location":"Mkdocs/#build-markdown-files","title":"Build markdown files","text":"
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    (Path(d) / \"_proc\" / \"guides\").mkdir(exist_ok=True)\n    (Path(d) / \"_proc\" / \"blogs\").mkdir(exist_ok=True)\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    _nbs_path = _root_path / \"nbs\" / \"Mkdocs.ipynb\"\n    shutil.copyfile(_nbs_path, Path(d) / \"_proc\" / \"Mkdocs.ipynb\")\n\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n\n    for i in [\"guides\", \"blogs\"]:\n        (Path(d) / \"_proc\" / f\"{i}\" / \".ipynb_checkpoints\").mkdir(exist_ok=True)\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"index.ipynb\",\n            Path(d) / \"_proc\" / f\"{i}\" / f\"{i}_index.ipynb\",\n        )\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"sample.qmd\",\n            Path(d) / \"_proc\" / f\"{i}\" / f\"qmd_{i}.qmd\",\n        )\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"index.ipynb\",\n            Path(d) / \"_proc\" / f\"{i}\" / \".ipynb_checkpoints\" / f\"{i}_index.ipynb\",\n        )\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"index.ipynb\",\n            Path(d) / \"_proc\" / f\"{i}\" / f\"_{i}_index.ipynb\",\n        )\n\n    new(d)\n\n    with set_cwd(d):\n        nbs = _get_files_to_convert_to_markdown(Path(d))\n\n    nbs = [str(nb) for nb in nbs]\n    print(nbs)\n\n    assert f\"{d}/_proc/index.ipynb\" in nbs\n    assert f\"{d}/_proc/guides/guides_index.ipynb\" in nbs\n    assert f\"{d}/_proc/blogs/qmd_blogs.qmd\" in nbs\n    assert f\"{d}/_proc/Mkdocs.ipynb\" in nbs\n\n    assert f\"{d}/_proc/_quarto.yml\" not in nbs\n    assert f\"{d}/_proc/guides/.ipynb_checkpoints/guides_index.ipynb\" not in nbs\n    assert f\"{d}/_proc/blogs/.ipynb_checkpoints/blogs_index.ipynb\" not in nbs\n
settings.ini created.\nDirectory /tmp/tmpos6fs4vt/mkdocs created.\nFile '/tmp/tmpos6fs4vt/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpos6fs4vt/mkdocs/summary_template.txt' generated.\n['/tmp/tmpos6fs4vt/_proc/Mkdocs.ipynb', '/tmp/tmpos6fs4vt/_proc/index.ipynb', '/tmp/tmpos6fs4vt/_proc/guides/_guides_index.ipynb', '/tmp/tmpos6fs4vt/_proc/guides/guides_index.ipynb', '/tmp/tmpos6fs4vt/_proc/guides/qmd_guides.qmd', '/tmp/tmpos6fs4vt/_proc/blogs/qmd_blogs.qmd', '/tmp/tmpos6fs4vt/_proc/blogs/_blogs_index.ipynb', '/tmp/tmpos6fs4vt/_proc/blogs/blogs_index.ipynb', '/tmp/tmpos6fs4vt/nbs/sample.qmd', '/tmp/tmpos6fs4vt/nbs/index.ipynb']\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    (Path(d) / \"nbs\" / \"guides\").mkdir(exist_ok=True)\n    (Path(d) / \"nbs\" / \"blogs\").mkdir(exist_ok=True)\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    _nbs_path = _root_path / \"nbs\" / \"Mkdocs.ipynb\"\n    shutil.copyfile(_nbs_path, Path(d) / \"nbs\" / \"Mkdocs.ipynb\")\n\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n\n    for i in [\"guides\", \"blogs\"]:\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"index.ipynb\",\n            Path(d) / \"nbs\" / f\"{i}\" / f\"{i}_index.ipynb\",\n        )\n        shutil.copyfile(\n            Path(d) / \"nbs\" / \"sample.qmd\",\n            Path(d) / \"nbs\" / f\"{i}\" / f\"qmd_{i}.qmd\",\n        )\n\n    test_nbs = Path(d) / \"nbs\" / \"test.ipynb\"\n    shutil.copyfile(\n        _root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\",\n        test_nbs\n    )\n\n    new(d)\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    _generate_markdown_from_files(d, cache_path)\n\n    # check markdown files\n    print(\"Checks:\")\n    mds = list((Path(d) / \"mkdocs\" / \"docs\").glob(\"**/*.md\"))\n    mds = [str(md) for md in mds]\n    print(\"\\n\".join(mds))\n    assert len(mds) > 0, len(mds)\n\n    for i in [\n        \"index.md\",\n        \"sample.md\",\n        \"guides/guides_index.md\",\n        \"guides/qmd_guides.md\",\n        \"blogs/blogs_index.md\",\n        \"blogs/qmd_blogs.md\",\n        \"Mkdocs.md\",\n    ]:\n        assert f\"{d}/mkdocs/docs/{i}\" in mds, f\"{d}/mkdocs/docs/{i}\"\n\n    with open(Path(d) / \"_proc\" / \"test.ipynb\", \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n\ndisplay(contents)\nassert '{markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}' in contents\nassert not '{markdown=1 .content-visible when-format=\"\\\\markdown\\\\\"}' in contents\n\nassert \"mermaid\" in contents\nassert not \"{mermaid}\" in contents\n\nassert '{markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}' in contents\nassert not '{markdown=1 .content-visible when-format=\\\\\"html\\\\\"}' in contents\n\nassert \".callout-note\" not in contents\nassert \".callout-tip\"  not in contents\nassert 'title=\"Tip with Title\"' not in contents\nassert 'collapse=\"true\"' not in contents\nassert 'collapse=\"false\"' not in contents\nassert 'icon=false' not in contents\nassert 'appearance=\"minimal' not in contents\n
settings.ini created.\nDirectory /tmp/tmpnqzgey9d/mkdocs created.\nFile '/tmp/tmpnqzgey9d/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpnqzgey9d/mkdocs/summary_template.txt' generated.\nChecks:\n/tmp/tmpnqzgey9d/mkdocs/docs/sample.md\n/tmp/tmpnqzgey9d/mkdocs/docs/index.md\n/tmp/tmpnqzgey9d/mkdocs/docs/test.md\n/tmp/tmpnqzgey9d/mkdocs/docs/Mkdocs.md\n/tmp/tmpnqzgey9d/mkdocs/docs/guides/qmd_guides.md\n/tmp/tmpnqzgey9d/mkdocs/docs/guides/guides_index.md\n/tmp/tmpnqzgey9d/mkdocs/docs/blogs/qmd_blogs.md\n/tmp/tmpnqzgey9d/mkdocs/docs/blogs/blogs_index.md\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Mkdocs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Create new\n\nOutput created: _docs/Mkdocs.md\n\npandoc -o sample.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Sample\n  author: Sample\n\nOutput created: _docs/sample.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o test.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: test.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Callouts\n\nOutput created: _docs/test.md\n\npandoc -o ../guides_index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: guides_index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/guides_index.md\n\npandoc -o ../qmd_guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Sample\n  author: Sample\n\nOutput created: ../_docs/qmd_guides.md\n\npandoc -o ../qmd_blogs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Sample\n  author: Sample\n\nOutput created: ../_docs/qmd_blogs.md\n\npandoc -o ../blogs_index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: blogs_index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/blogs_index.md\n\n'{\\n \"cells\": [\\n  {\\n   \"cell_type\": \"raw\",\\n   \"id\": \"6fc63aee\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"---\\\\n\",\\n    \"output-file: test.html\\\\n\",\\n    \"title: Callouts\\\\n\",\\n    \"\\\\n\",\\n    \"---\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"bd6c141d\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8ee6e33a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"This notebook is used to test the conversion of Quarto to Material for MkDocs syntax. It serves as a fixture to verify the syntax, including callouts, Mermaid charts, and making a section hidden, which differ between Quarto and Material for MkDocs.\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"d0a10ffc\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note\\\\n\",\\n    \"\\\\n\",\\n    \"    Note that there are five types of callouts, including:\\\\n\",\\n    \"    `note`, `warning`, `important`, `tip`, and `caution`.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"22014eb3\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"870e17d7\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"87f34d1a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"??? caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"4a8ac79c\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"???+ caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"034f6dbb\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8f79c54d\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ec9209a4\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"## Mermaid Charts and visibility\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"0a820438\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in markdown.\\\\n\",\\n    \"\\\\n\",\\n    \":::\\\\n\",\\n    \"\\\\n\",\\n    \"``` mermaid\\\\n\",\\n    \"flowchart LR\\\\n\",\\n    \"    A[Hard edge] --> B(Round edge)\\\\n\",\\n    \"    B --> C{Decision}\\\\n\",\\n    \"    C --> D[Result one]\\\\n\",\\n    \"    C --> E[Result two]\\\\n\",\\n    \"```\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ebd24225\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in html.\\\\n\",\\n    \"\\\\n\",\\n    \":::\"\\n   ]\\n  }\\n ],\\n \"metadata\": {\\n  \"kernelspec\": {\\n   \"display_name\": \"Python 3 (ipykernel)\",\\n   \"language\": \"python\",\\n   \"name\": \"python3\"\\n  },\\n  \"language_info\": {\\n   \"codemirror_mode\": {\\n    \"name\": \"ipython\",\\n    \"version\": 3\\n   },\\n   \"file_extension\": \".py\",\\n   \"mimetype\": \"text/x-python\",\\n   \"name\": \"python\",\\n   \"nbconvert_exporter\": \"python\",\\n   \"pygments_lexer\": \"ipython3\",\\n   \"version\": \"3.11.2\"\\n  },\\n  \"widgets\": {\\n   \"application/vnd.jupyter.widget-state+json\": {\\n    \"state\": {},\\n    \"version_major\": 2,\\n    \"version_minor\": 0\\n   }\\n  }\\n },\\n \"nbformat\": 4,\\n \"nbformat_minor\": 5\\n}'\n
text = \"\"\"![Git Repo_Clone_Page](images/nbs/../images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/../images/circles.svg\" />\n<img src=\"https://documentation.divio.com/_images/overview.png\" />\n\"\"\"\n\nexpected = \"\"\"![Git Repo_Clone_Page](images/nbs/../images/nbs/images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](../images/nbs/guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/../../images/nbs/images/circles.svg\" />\n<img src=\"https://documentation.divio.com/_images/overview.png\" />\n\"\"\"\n\ndir_prefix = \"guides\"\nactual = _replace_all(text, dir_prefix)\nprint(actual)\nassert actual == expected, actual\n\ntext = \"\"\"![Git Repo_Clone_Page](images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/images/nbs/images/marie-curie-notebook.jpg\" class=\"rounded preview-image\"\nalt=\"Photo of an opened research notebook with diagrams and writing in French\" />\n\"\"\"\n\nexpected = \"\"\"![Git Repo_Clone_Page](images/nbs/images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](images/nbs/guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/images/nbs/images/nbs/images/marie-curie-notebook.jpg\" class=\"rounded preview-image\"\nalt=\"Photo of an opened research notebook with diagrams and writing in French\" />\n\"\"\"\n\ndir_prefix = \"\"\nactual = _replace_all(text, dir_prefix)\nprint(actual)\nassert actual == expected, actual\n
![Git Repo_Clone_Page](images/nbs/../images/nbs/images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](../images/nbs/guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/../../images/nbs/images/circles.svg\" />\n<img src=\"https://documentation.divio.com/_images/overview.png\" />\n\n![Git Repo_Clone_Page](images/nbs/images/nbs/images/nbs/img/test.png)\n![Git Repo_Clone_Page](images/nbs/guides/images/nbs/images/git_repo_clone_page.png)\n![Test](https://github.com/airtai/nbdev-mkdocs/actions/workflows/test.yaml/badge.svg)\n![](http://example.com/badge.svg)\n![some test](https://www.test.com/styles/images/a.png)\n![](https://test.com/photos/920382/pexels-photo-920382.jpeg?auto=compress&cs=tinysrgb&w=1600)\n<img src=\"images/nbs/images/nbs/images/nbs/images/marie-curie-notebook.jpg\" class=\"rounded preview-image\"\nalt=\"Photo of an opened research notebook with diagrams and writing in French\" />\n
def copy_guides(src, dst):\n    \"\"\"Copy guides from one directory to another.\n\n    Args:\n        src: Source directory\n        dst: Destination directory\n\n    Raises:\n        AssertionError: If src does not exist\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    src = Path(src)\n    dst = Path(dst)\n    assert src.exists()\n    src_guides = src / \"nbs\" / \"guides\"\n    src_guides_len = len(src_guides.parts)\n\n    dst_guides = dst / \"nbs\" / \"guides\"\n\n    for ext in [\".ipynb\", \".png\", \".jpeg\", \".jpg\"]:\n        for src_f in src_guides.glob(f\"**/*{ext}\"):\n            dst_parts = dst_guides.parts + src_f.parts[src_guides_len:]\n            dst_f = Path(*dst_parts)\n            dst_f.parent.mkdir(exist_ok=True, parents=True)\n\n            print(f\"{src_f}, {dst_f}\")\n            shutil.copyfile(src_f, dst_f)\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    copy_guides(_root_path, d)\n    shutil.copytree((Path(d) / \"nbs\" / \"guides\"), (Path(d) / \"nbs\" / \"blogs\"))\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    new(d)\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    _generate_markdown_from_files(root_path=d, cache_path=cache_path)\n    _copy_images_to_docs_dir(d, cache_path)\n\n    # check image files\n    print(\"Checks for images:\")\n    imgs = list((Path(d) / \"mkdocs\" / \"docs\" / \"images\" / \"nbs\").glob(\"**/*.*\"))\n    print(\"\\n\".join([str(img) for img in imgs]))\n    assert len(imgs) > 0, len(imgs)\n\n    # check markdown files\n    print(\"Checks for markdown:\")\n    mds = list((Path(d) / \"mkdocs\" / \"docs\").glob(\"**/*.md\"))\n    print(\"\\n\".join([str(md) for md in mds]))\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"index.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"Mkdocs.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"Social_Image_Generator.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"guides\" / \"Basic_User_Guide.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"blogs\" / \"Basic_User_Guide.md\").exists()\n\n    with open(\n        (Path(d) / \"mkdocs\" / \"docs\" / \"blogs\" / \"Basic_User_Guide.md\"),\n        \"r\", encoding=\"utf-8\"\n    ) as f:\n        contents = f.read()\n        assert (\n            \"![Empty Git Repo](images/nbs/../images/nbs/blogs/images/empty_git_repo.png)\"\n            in contents\n        )\n        assert (\n            \"![Git Repo_Clone_Page](../images/nbs/blogs/images/nbs/images/git_repo_clone_page.png)\"\n            in contents\n        )\n        assert \"![](images/nbs/../images/nbs/blogs/images/jupyter_home.png)\" in contents\n\n    (\n        Path(d)\n        / \"mkdocs\"\n        / \"docs\"\n        / \"images\"\n        / \"nbs\"\n        / \"blogs\"\n        / \"images\"\n        / \"jupyter_home.png\"\n    ).exists()\n    (\n        Path(d)\n        / \"mkdocs\"\n        / \"docs\"\n        / \"images\"\n        / \"nbs\"\n        / \"guides\"\n        / \"images\"\n        / \"empty_git_repo.png\"\n    ).exists()\n\n    print(\"OK.\")\n
settings.ini created.\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmp2uwgyvn_/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmp2uwgyvn_/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmp2uwgyvn_/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmp2uwgyvn_/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmp2uwgyvn_/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmp2uwgyvn_/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmp2uwgyvn_/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmp2uwgyvn_/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmp2uwgyvn_/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmp2uwgyvn_/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmp2uwgyvn_/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmp2uwgyvn_/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmp2uwgyvn_/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmp2uwgyvn_/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmp2uwgyvn_/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmp2uwgyvn_/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmp2uwgyvn_/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmp2uwgyvn_/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmp2uwgyvn_/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmp2uwgyvn_/nbs/guides/images/guide_1.png\nDirectory /tmp/tmp2uwgyvn_/mkdocs created.\nFile '/tmp/tmp2uwgyvn_/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp2uwgyvn_/mkdocs/summary_template.txt' generated.\nChecks for images:\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/enable_gh_pages.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_notebook.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/jupyter_home.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/releases_default.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/doc_versioning.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/foo_doc_string.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/docstring-gen-extension-btn.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/releases.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/cli_not_found.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/empty_git_repo.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/nbs/images/git_repo_clone_page.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/set_github_token_permission.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/hello_class.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/say_hello.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_2.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_4.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/sidebar_2.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/guide_3.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/CLI_command.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/sidebar_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/enable_gh_pages.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_notebook.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/jupyter_home.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/releases_default.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/doc_versioning.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/foo_doc_string.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/docstring-gen-extension-btn.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/releases.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/cli_not_found.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/empty_git_repo.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/nbdev_mkdocs_preview_light_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/nbs/images/git_repo_clone_page.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/set_github_token_permission.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/hello_class.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/say_hello.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_2.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_4.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/sidebar_2.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/guide_3.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/CLI_command.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/sidebar_1.png\n/tmp/tmp2uwgyvn_/mkdocs/docs/images/nbs/blogs/images/nbdev_mkdocs_preview_dark_1.png\nChecks for markdown:\n/tmp/tmp2uwgyvn_/mkdocs/docs/index.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/Mkdocs.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/Social_Image_Generator.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Setting_Up_Document_Versioning.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Auto_Generating_Docstrings.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Handling_Pandas_In_The_Output.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Advanced_Customization_Options.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Adding_Guides.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Basic_User_Guide.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Customizing_The_Sidebar.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Adding_Release_Notes.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/guides/Setting_up_social_cards.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Setting_Up_Document_Versioning.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Auto_Generating_Docstrings.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Handling_Pandas_In_The_Output.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Advanced_Customization_Options.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Adding_Guides.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Basic_User_Guide.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Customizing_The_Sidebar.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Adding_Release_Notes.md\n/tmp/tmp2uwgyvn_/mkdocs/docs/blogs/Setting_up_social_cards.md\nOK.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Social_Image_Generator.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nOutput created: _docs/Social_Image_Generator.md\n\npandoc -o Mkdocs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Create new\n\nOutput created: _docs/Mkdocs.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n
"},{"location":"Mkdocs/#build-summary-for-guides","title":"Build summary for guides","text":"
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    copy_guides(_root_path, d)\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n\n    new(d)\n\n    cmd = f'cd \"{d}\" && nbdev_docs'\n    _sprun(cmd)\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    _generate_markdown_from_files(d, cache_path)\n\n    nb_paths = [\n        Path(\"index.ipynb\"),\n        Path(\"sample.qmd\"),\n        Path(\"Mkdocs.ipynb\"),\n        Path(\"Social_Image_Generator.ipynb\"),\n        Path(\"guides/Basic_User_Guide.ipynb\"),\n    ]\n\n    expected = [\n        \"Material for nbdev\",\n        \"Sample\",\n        \"Create new\",\n        \"Social_Image_Generator.html\",\n        \"Basic User Guide\",\n    ]\n    actual = []\n    for nb_path in nb_paths:\n        actual.append(_get_title_from_notebook(cache_path, nb_path))\n\n    print(actual)\n\n    assert actual == expected\n
settings.ini created.\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmplo_f4akn/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmplo_f4akn/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmplo_f4akn/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmplo_f4akn/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmplo_f4akn/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmplo_f4akn/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmplo_f4akn/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmplo_f4akn/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmplo_f4akn/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmplo_f4akn/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmplo_f4akn/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmplo_f4akn/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmplo_f4akn/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmplo_f4akn/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmplo_f4akn/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmplo_f4akn/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmplo_f4akn/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmplo_f4akn/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmplo_f4akn/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmplo_f4akn/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmplo_f4akn/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmplo_f4akn/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmplo_f4akn/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmplo_f4akn/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmplo_f4akn/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmplo_f4akn/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmplo_f4akn/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmplo_f4akn/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmplo_f4akn/nbs/guides/images/guide_1.png\nDirectory /tmp/tmplo_f4akn/mkdocs created.\nFile '/tmp/tmplo_f4akn/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmplo_f4akn/mkdocs/summary_template.txt' generated.\n['Material for nbdev', 'Sample', 'Create new', 'Social_Image_Generator.html', 'Basic User Guide']\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[ 1/13] guides/Setting_Up_Document_Versioning.ipynb\n[ 2/13] guides/Auto_Generating_Docstrings.ipynb\n[ 3/13] guides/Advanced_Customization_Options.ipynb\n[ 4/13] guides/Adding_Guides.ipynb\n[ 5/13] guides/Basic_User_Guide.ipynb\n[ 6/13] guides/Setting_up_social_cards.ipynb\n[ 7/13] guides/Adding_Release_Notes.ipynb\n[ 8/13] guides/Handling_Pandas_In_The_Output.ipynb\n[ 9/13] guides/Customizing_The_Sidebar.ipynb\n[10/13] Social_Image_Generator.ipynb\n[11/13] Mkdocs.ipynb\n[12/13] sample.qmd\n[13/13] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Social_Image_Generator.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nOutput created: _docs/Social_Image_Generator.md\n\npandoc -o Mkdocs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Create new\n\nOutput created: _docs/Mkdocs.md\n\npandoc -o sample.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Sample\n  author: Sample\n\nOutput created: _docs/sample.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n    new(d)\n\n    with set_cwd(d):\n        sidebar = _read_sidebar_from_yml(d)\n    print(sidebar)\n    assert sidebar == [\"index.ipynb\", \"sample.qmd\"]\n
settings.ini created.\nDirectory /tmp/tmp2u2qwr0m/mkdocs created.\nFile '/tmp/tmp2u2qwr0m/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp2u2qwr0m/mkdocs/summary_template.txt' generated.\n['index.ipynb', 'sample.qmd']\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with pytest.raises(typer.Exit) as e:\n    with TemporaryDirectory() as d:\n        run_nbdev_new(d)\n\n        new(d)\n\n        updater = ConfigUpdater()\n        updater.read(Path(d) / \"settings.ini\")\n        updater[\"DEFAULT\"][\"custom_sidebar\"] = True\n        updater.update_file()\n        with set_cwd(d):\n            _read_sidebar_from_yml(d)\n\nprint(\"OK\")\n
settings.ini created.\nDirectory /tmp/tmp3ks9qy2p/mkdocs created.\nFile '/tmp/tmp3ks9qy2p/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp3ks9qy2p/mkdocs/summary_template.txt' generated.\nOK\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\nKey Error: Contents of the sidebar are not defined in the files sidebar.yml or _quarto.yml.\n
_sidebar = \"\"\"- auto: \\\"/*.ipynb\\\"\n- section: Blogs\n  contents: blogs/*\n- section: Guides\n  contents: guides/*\n- section: Explanations\n  contents:\n  - explanations/explanation_1.ipynb\n  - explanations/explanation_2.ipynb\n\"\"\"\n\nexpected = [\n    \"getting_started.ipynb\",\n    \"index.ipynb\",\n    {\"section\": \"Blogs\", \"contents\": [\"blogs/blogs_1.ipynb\", \"blogs/blogs_2.ipynb\"]},\n    {\n        \"section\": \"Guides\",\n        \"contents\": [\"guides/guides_1.ipynb\", \"guides/guides_2.ipynb\"],\n    },\n    {\n        \"section\": \"Explanations\",\n        \"contents\": [\n            \"explanations/explanation_1.ipynb\",\n            \"explanations/explanation_2.ipynb\",\n        ],\n    },\n]\n\n\nwith TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    shutil.copyfile(\n        Path(d) / \"nbs\" / \"index.ipynb\", Path(d) / \"nbs\" / \"getting_started.ipynb\"\n    )\n\n    for dir_name in [\"guides\", \"blogs\", \"explanations\"]:\n        (Path(d) / \"nbs\" / dir_name).mkdir(parents=True)\n        for i in [f\"{dir_name}_1\", f\"{dir_name}_2\"]:\n            shutil.copyfile(\n                Path(d) / \"nbs\" / \"index.ipynb\",\n                (Path(d) / \"nbs\" / f\"{dir_name}\" / f\"{i}.ipynb\"),\n            )\n\n    new(d)\n\n    # update _quarto.yml file\n    _quarto_yml_path = Path(d) / \"nbs\" / \"_quarto.yml\"\n    _yaml = YAML()\n    config = _yaml.load(_quarto_yml_path)\n    config[\"website\"][\"sidebar\"][\"contents\"] = _yaml.load(_sidebar)\n    _yaml.dump(config, _quarto_yml_path)\n\n    # Set the custom_sidebar flag to True\n    updater = ConfigUpdater()\n    updater.read(Path(d) / \"settings.ini\")\n    updater[\"DEFAULT\"][\"custom_sidebar\"] = True\n    updater.update_file()\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    _generate_markdown_from_files(d, cache_path)\n    _copy_images_to_docs_dir(d, cache_path)\n\n    sidebar = _read_sidebar_from_yml(d)\n\n    actual = _expand_sidebar_if_needed(d, sidebar)\n\n    print(actual)\n    assert actual == expected, actual\n
settings.ini created.\nDirectory /tmp/tmp9i22pms5/mkdocs created.\nFile '/tmp/tmp9i22pms5/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp9i22pms5/mkdocs/summary_template.txt' generated.\n['getting_started.ipynb', 'index.ipynb', {'section': 'Blogs', 'contents': ['blogs/blogs_1.ipynb', 'blogs/blogs_2.ipynb']}, {'section': 'Guides', 'contents': ['guides/guides_1.ipynb', 'guides/guides_2.ipynb']}, {'section': 'Explanations', 'contents': ['explanations/explanation_1.ipynb', 'explanations/explanation_2.ipynb']}]\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\npandoc -o getting_started.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: getting_started.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/getting_started.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../explanations_2.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: explanations_2.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/explanations_2.md\n\npandoc -o ../explanations_1.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: explanations_1.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/explanations_1.md\n\npandoc -o ../guides_1.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: guides_1.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/guides_1.md\n\npandoc -o ../guides_2.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: guides_2.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/guides_2.md\n\npandoc -o ../blogs_1.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: blogs_1.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/blogs_1.md\n\npandoc -o ../blogs_2.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: blogs_2.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: ../_docs/blogs_2.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    (Path(d) / \"nbs\" / \"api\").mkdir(parents=True)\n    shutil.copyfile(\n        Path(d) / \"nbs\" / \"Mkdocs.ipynb\", (Path(d) / \"nbs\" / \"api\" / \"Mkdocs.ipynb\")\n    )\n\n    for dir_name in [\"guides\", \"blogs\"]:\n        (Path(d) / \"nbs\" / dir_name).mkdir(parents=True)\n        for i in [f\"{dir_name}_1\", f\"{dir_name}_2\"]:\n            shutil.copyfile(\n                Path(d) / \"nbs\" / \"index.ipynb\",\n                (Path(d) / \"nbs\" / f\"{dir_name}\" / f\"{i}.ipynb\"),\n            )\n\n    qmd_index_path = Path(d) / \"nbs\" / \"sample.qmd\"\n    shutil.copyfile(_root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\", qmd_index_path)\n\n    new(d)\n    with set_cwd(d):\n        cache_path = proc_nbs()\n        sidebar = _read_sidebar_from_yml(d)\n        expanded_sidebar = _expand_sidebar_if_needed(d, sidebar)\n        assert expanded_sidebar == [\n            \"index.ipynb\",\n            \"Mkdocs.ipynb\",\n            \"Social_Image_Generator.ipynb\",\n            \"sample.qmd\",\n            {\"section\": \"api\", \"contents\": [\"api/Mkdocs.ipynb\"]},\n            {\n                \"section\": \"blogs\",\n                \"contents\": [\"blogs/blogs_1.ipynb\", \"blogs/blogs_2.ipynb\"],\n            },\n            {\n                \"section\": \"guides\",\n                \"contents\": [\"guides/guides_1.ipynb\", \"guides/guides_2.ipynb\"],\n            },\n        ]\n\n        actual = _generate_nav_from_sidebar(expanded_sidebar, cache_path)\n        print(actual)\n\n        expected = \"\"\"- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- [Sample](sample.md)\n- api\n    - [Create new](api/Mkdocs.md)\n- blogs\n    - [Material for nbdev](blogs/blogs_1.md)\n    - [Material for nbdev](blogs/blogs_2.md)\n- guides\n    - [Material for nbdev](guides/guides_1.md)\n    - [Material for nbdev](guides/guides_2.md)\n\"\"\"\n\n        assert actual == expected, actual\n
settings.ini created.\nDirectory /tmp/tmpysresvr1/mkdocs created.\nFile '/tmp/tmpysresvr1/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpysresvr1/mkdocs/summary_template.txt' generated.\n- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- [Sample](sample.md)\n- api\n    - [Create new](api/Mkdocs.md)\n- blogs\n    - [Material for nbdev](blogs/blogs_1.md)\n    - [Material for nbdev](blogs/blogs_2.md)\n- guides\n    - [Material for nbdev](guides/guides_1.md)\n    - [Material for nbdev](guides/guides_2.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    (Path(d) / \"nbs\" / \"api\").mkdir(parents=True)\n    shutil.copyfile(\n        Path(d) / \"nbs\" / \"Mkdocs.ipynb\", (Path(d) / \"nbs\" / \"api\" / \"Mkdocs.ipynb\")\n    )\n\n    for dir_name in [\"guides\", \"blogs\"]:\n        (Path(d) / \"nbs\" / dir_name).mkdir(parents=True)\n        for i in [f\"{dir_name}_1\", f\"{dir_name}_2\"]:\n            shutil.copyfile(\n                Path(d) / \"nbs\" / \"index.ipynb\",\n                (Path(d) / \"nbs\" / f\"{dir_name}\" / f\"{i}.ipynb\"),\n            )\n\n    cmd = f'cd \"{d}\" && nbdev_sidebar'\n    print(f\"executing the command: {cmd}\")\n    _sprun(cmd)\n\n    new(d)\n\n    with set_cwd(d):\n        cache_path = proc_nbs()\n\n    actual = _generate_summary_for_sidebar(d, cache_path)\n\n    print(actual)\n\n    expected = \"\"\"- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- api\n    - [Create new](api/Mkdocs.md)\n- blogs\n    - [Material for nbdev](blogs/blogs_1.md)\n    - [Material for nbdev](blogs/blogs_2.md)\n- guides\n    - [Material for nbdev](guides/guides_1.md)\n    - [Material for nbdev](guides/guides_2.md)\n\"\"\"\n    assert actual == expected, actual\n
settings.ini created.\nexecuting the command: cd \"/tmp/tmpeuyda8ic\" && nbdev_sidebar\nDirectory /tmp/tmpeuyda8ic/mkdocs created.\nFile '/tmp/tmpeuyda8ic/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpeuyda8ic/mkdocs/summary_template.txt' generated.\n- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- api\n    - [Create new](api/Mkdocs.md)\n- blogs\n    - [Material for nbdev](blogs/blogs_1.md)\n    - [Material for nbdev](blogs/blogs_2.md)\n- guides\n    - [Material for nbdev](guides/guides_1.md)\n    - [Material for nbdev](guides/guides_2.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n    new(d)\n\n    cli_summary = _copy_not_found_file_and_get_path(d, \"cli_commands\")\n    print(cli_summary)\n\n    _dst_path = Path(d) / \"mkdocs\" / \"docs\"\n    assert cli_summary == \" \" * 4 + \"- [Not found](cli_commands_not_found.md)\"\n    assert (_dst_path / \"cli_commands_not_found.md\").exists()\n
settings.ini created.\nDirectory /tmp/tmpwg2o4jh3/mkdocs created.\nFile '/tmp/tmpwg2o4jh3/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpwg2o4jh3/mkdocs/summary_template.txt' generated.\n    - [Not found](cli_commands_not_found.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
"},{"location":"Mkdocs/#build-api","title":"Build API","text":"
# os.environ[\"NBDEV_MKDOCS_PATCH_IMPORTLIB\"] = \"true\"\n\n# submodules = _get_submodules(\"repo\")\n# submodules\n
@contextmanager\ndef add_tmp_path_to_sys_path(dir_):\n    \"\"\"Add a temporary path to sys.path\n\n    Args:\n        dir_ : the path to add to sys.path\n\n    Returns:\n        None\n\n    Raises:\n        ValueError: If dir_ is None\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    dir_ = Path(dir_).absolute().resolve(strict=True)\n    original_path = sys.path[:]\n    sys.path.insert(0, str(dir_))\n    try:\n        yield\n    finally:\n        sys.path = original_path\n\n\nwith TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n    new(d)\n\n    _module = f\"repo_{random_string}\"\n    with set_cwd(d):\n        with unset_env_var(\"IN_TEST\"):\n            nbdev_export.__wrapped__()\n\n    !ls {d}/repo\n\n    with add_tmp_path_to_sys_path(d):\n        api_summary = _get_submodules(_module)\n\n    print(api_summary)\n\n    assert api_summary == [f\"repo_{random_string}\"] + [\n        f\"repo_{random_string}.mkdocs\",\n        f\"repo_{random_string}.social_image_generator\",\n    ]\n
settings.ini created.\nDirectory /tmp/tmpvc_b5bcf/mkdocs created.\nFile '/tmp/tmpvc_b5bcf/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpvc_b5bcf/mkdocs/summary_template.txt' generated.\nls: cannot access '/tmp/tmpvc_b5bcf/repo': No such file or directory\n['repo_jxajlswxkq', 'repo_jxajlswxkq.mkdocs', 'repo_jxajlswxkq.social_image_generator']\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
@contextmanager\ndef set_numpy_experimental_dtype_env_var():\n    if sys.version_info >= (3,9):\n        original_value = os.environ.get(\"NUMPY_EXPERIMENTAL_DTYPE_API\", None)\n        os.environ[\"NUMPY_EXPERIMENTAL_DTYPE_API\"] = \"1\"\n        try:\n            yield\n        finally:\n            if original_value == None:\n                del os.environ[\"NUMPY_EXPERIMENTAL_DTYPE_API\"]\n            else:\n                os.environ[\"NUMPY_EXPERIMENTAL_DTYPE_API\"] = original_value\n    else:\n        yield\n\n\nwith set_numpy_experimental_dtype_env_var():\n    numpy_submodels = _import_submodules(\"numpy\")\n
WARN: Could not locate executable icc\nWARN: Could not locate executable ecc\n\n/usr/lib/python3.8/pkgutil.py:92: UserWarning: The numpy.array_api submodule is still experimental. See NEP 47.\n  __import__(info.name)\n
actual = _import_submodules(\"nbdev_mkdocs\")\nactual = [x.__name__ for x in actual]\n\nexpected = [\n    \"nbdev_mkdocs\",\n    \"nbdev_mkdocs.docstring\",\n    \"nbdev_mkdocs.mkdocs\",\n    \"nbdev_mkdocs.social_image_generator\",\n]\ndisplay(actual)\nassert all([i in actual for i in expected])\n
['nbdev_mkdocs',\n 'nbdev_mkdocs.docstring',\n 'nbdev_mkdocs.mkdocs',\n 'nbdev_mkdocs.social_image_generator']\n
xys = _import_functions_and_classes(asyncio)\ndisplay(xys[:5])\n\nactual = [x for x, _ in xys]\n\nassert set([\"run\", \"sleep\", \"BaseEventLoop\"]).issubset(set(actual))\n
[('AbstractChildWatcher', asyncio.unix_events.AbstractChildWatcher),\n ('AbstractEventLoop', asyncio.events.AbstractEventLoop),\n ('AbstractEventLoopPolicy', asyncio.events.AbstractEventLoopPolicy),\n ('AbstractServer', asyncio.events.AbstractServer),\n ('BaseEventLoop', asyncio.base_events.BaseEventLoop)]\n
assert _is_private(\"asyncio.base_events._SendfileFallbackProtocol\")\nassert not _is_private(\"asyncio.base_events.SendfileFallbackProtocol\")\n
members = _import_all_members(\"numpy\")\nmembers[:5], members[-5:]\n
(['numpy.AxisError',\n  'numpy.ComplexWarning',\n  'numpy.DataSource',\n  'numpy.ModuleDeprecationWarning',\n  'numpy.RankWarning'],\n ['numpy.typing.tests.test_typing.test_code_runs',\n  'numpy.typing.tests.test_typing.test_extended_precision',\n  'numpy.typing.tests.test_typing.test_fail',\n  'numpy.typing.tests.test_typing.test_reveal',\n  'numpy.typing.tests.test_typing.test_success'])\n
members = [\n    \"module.B\",\n    \"module.EventMetadata\",\n    \"module.KafkaEvent\",\n    \"module.a\",\n    \"module.x\",\n    \"module.encoder.AvroBase\",\n    \"module.encoder.avro_decoder\",\n    \"module.encoder.json_encoder\",\n    \"module.executors.DynamicTaskExecutor\",\n    \"module.executors.SequentialExecutor\",\n    \"module.testing.ApacheKafkaBroker\",\n    \"module.testing.LocalRedpandaBroker\",\n]\n\nexpected = [\n    \"module.\",\n    \"module.B\",\n    \"module.EventMetadata\",\n    \"module.KafkaEvent\",\n    \"module.a\",\n    \"module.x\",\n    \"module.encoder.\",\n    \"module.encoder.AvroBase\",\n    \"module.encoder.avro_decoder\",\n    \"module.encoder.json_encoder\",\n    \"module.executors.\",\n    \"module.executors.DynamicTaskExecutor\",\n    \"module.executors.SequentialExecutor\",\n    \"module.testing.\",\n    \"module.testing.ApacheKafkaBroker\",\n    \"module.testing.LocalRedpandaBroker\",\n]\nactual = _add_all_submodules(members)\nprint(actual)\nassert actual == expected, actual\n
['module.', 'module.B', 'module.EventMetadata', 'module.KafkaEvent', 'module.a', 'module.x', 'module.encoder.', 'module.encoder.AvroBase', 'module.encoder.avro_decoder', 'module.encoder.json_encoder', 'module.executors.', 'module.executors.DynamicTaskExecutor', 'module.executors.SequentialExecutor', 'module.testing.', 'module.testing.ApacheKafkaBroker', 'module.testing.LocalRedpandaBroker']\n
members = [\"a.b\", \"a.x\", \"a.c.d\", \"a.e.d\"]\nexpected = [\"a.\", \"a.b\", \"a.x\", \"a.c.\", \"a.c.d\", \"a.e.\", \"a.e.d\"]\nactual = _add_all_submodules(members)\nprint(actual)\nassert actual == expected, actual\n
['a.', 'a.b', 'a.x', 'a.c.', 'a.c.d', 'a.e.', 'a.e.d']\n
members = [\"a.b\", \"a.c\", \"a.e.d\", \"a.e.f\", \"a.e.f\"]\nexpected = [\"a.\", \"a.b\", \"a.c\", \"a.e.\", \"a.e.d\", \"a.e.f\"]\nactual = _add_all_submodules(members)\nprint(actual)\nassert actual == expected, actual\n
['a.', 'a.b', 'a.c', 'a.e.', 'a.e.d', 'a.e.f']\n
assert _get_api_summary_item(\"a.b.\") == \" \" * 8 + \"- b\"\nassert _get_api_summary_item(\"a.b\") == \" \" * 8 + \"- [b](api/a/b.md)\"\n
members = [\"a.\", \"a.b\", \"a.c.\", \"a.c.d\", \"a.e.\", \"a.e.f\"]\nactual = _get_api_summary(members)\nexpected = \"\"\"    - a\n        - [b](api/a/b.md)\n        - c\n            - [d](api/a/c/d.md)\n        - e\n            - [f](api/a/e/f.md)\n\"\"\"\nprint(\"*\" * 100)\nprint(\"- API\")\nprint(actual, end=\"\")\nprint(\"*\" * 100)\nassert actual == expected\n
****************************************************************************************************\n- API\n    - a\n        - [b](api/a/b.md)\n        - c\n            - [d](api/a/c/d.md)\n        - e\n            - [f](api/a/e/f.md)\n****************************************************************************************************\n
module_name = \"nbdev_mkdocs\"\nmembers_with_submodules = _get_submodule_members(module_name)\nmembers_with_submodules\n
['nbdev_mkdocs',\n 'nbdev_mkdocs.docstring',\n 'nbdev_mkdocs.docstring.run_examples_from_docstring',\n 'nbdev_mkdocs.mkdocs',\n 'nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs',\n 'nbdev_mkdocs.mkdocs.new',\n 'nbdev_mkdocs.mkdocs.prepare',\n 'nbdev_mkdocs.mkdocs.preview',\n 'nbdev_mkdocs.social_image_generator',\n 'nbdev_mkdocs.social_image_generator.generate_social_image']\n
module_name = \"nbdev_mkdocs\"\nmembers_with_submodules = _get_submodule_members(module_name)\nsymbols = _load_submodules(module_name, members_with_submodules)\nsymbols\n
[<function nbdev_mkdocs.docstring.run_examples_from_docstring(o: Any, *, supress_stdout: bool = False, supress_stderr: bool = False, sub_dict: Union[Dict[str, str], NoneType] = None, width: Union[int, NoneType] = 80, **kwargs: str) -> None>,\n <function nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs(root_path: str, refresh_quarto_settings: bool = False, use_relative_doc_links: bool = False, no_mkdocs_build: bool = False) -> None>,\n <function nbdev_mkdocs.mkdocs.new(root_path: str) -> None>,\n <function nbdev_mkdocs.mkdocs.prepare(root_path: str, use_relative_doc_links: bool = False, no_test: bool = False, no_mkdocs_build: bool = False) -> None>,\n <function nbdev_mkdocs.mkdocs.preview(root_path: str, use_relative_doc_links: bool, port: Union[int, NoneType] = None) -> None>,\n <function nbdev_mkdocs.social_image_generator.generate_social_image(root_path: str, generator: str = 'file', prompt: str = 'Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render', image_path: Union[str, NoneType] = None) -> None>]\n
with TemporaryDirectory() as d:\n    docs_path = Path(d)\n    path = _generate_api_doc(\"a.b\", docs_path)\n\n    assert path == docs_path / \"a\" / \"b.md\"\n\n    with open(path, \"r\", encoding=\"utf-8\") as f:\n        actual = f.read()\n\n    expected = \"::: a.b\\n\"\n\n    assert actual == expected\n
members = [\"a.\", \"a.b\", \"a.c.\", \"a.c.d\", \"a.e.\", \"a.e.d\"]\n\nwith TemporaryDirectory() as d:\n    docs_path = Path(d)\n    generated_paths = _generate_api_docs(members, docs_path)\n\n    expected = [docs_path / \"a/b.md\", docs_path / \"a/c/d.md\", docs_path / \"a/e/d.md\"]\n    assert generated_paths == expected\n
_get_annotated_symbol_definition_mock_value = f'::: test_lib.test_module.test_symbol'\n\n@contextmanager\ndef mock_get_annotated_symbol_definition():\n    with unittest.mock.patch('__main__.get_formatted_docstring_for_symbol') as mock_get_annotated_symbol_definition:\n        mock_get_annotated_symbol_definition.return_value = _get_annotated_symbol_definition_mock_value\n        yield\n
with TemporaryDirectory() as d:\n    module_name = \"nbdev_mkdocs\"\n\n    docs_path = Path(d) / \"mkdocs\" / \"docs\"\n    docs_path.mkdir(parents=True)\n\n    api_path = docs_path / \"api\"\n    api_path.mkdir(parents=True)\n\n    members_with_submodules = _get_submodule_members(module_name)\n    symbols = _load_submodules(module_name, members_with_submodules)\n\n    for symbol in symbols:\n        target_file_path = (\n            \"/\".join(f\"{symbol.__module__}.{symbol.__name__}\".split(\".\")) + \".md\"\n        )\n        (api_path / \"/\".join(f\"{symbol.__module__}\".split(\".\"))).mkdir(\n            parents=True, exist_ok=True\n        )\n\n        with open((api_path / target_file_path), \"w\", encoding=\"utf-8\") as f:\n            f.write(f\"Initial content in '{target_file_path}'\")\n\n        with open((api_path / target_file_path), \"r\", encoding=\"utf-8\") as f:\n            contents = f.read()\n            print(contents)\n            assert f\"Initial content in '{target_file_path}'\" == contents, contents\n\n    with mock_get_annotated_symbol_definition():\n        _update_api_docs(symbols, docs_path)\n\n    print(\"*\" * 100)\n    for symbol in symbols:\n        target_file_path = (\n            \"/\".join(f\"{symbol.__module__}.{symbol.__name__}\".split(\".\")) + \".md\"\n        )\n        (api_path / \"/\".join(f\"{symbol.__module__}\".split(\".\"))).mkdir(\n            parents=True, exist_ok=True\n        )\n\n        with open((api_path / target_file_path), \"r\", encoding=\"utf-8\") as f:\n            contents = f.read()\n            print(contents)\n            assert f\"Initial content in '{target_file_path}'\" != contents, contents\n
Initial content in 'nbdev_mkdocs/docstring/run_examples_from_docstring.md'\nInitial content in 'nbdev_mkdocs/mkdocs/nbdev_mkdocs_docs.md'\nInitial content in 'nbdev_mkdocs/mkdocs/new.md'\nInitial content in 'nbdev_mkdocs/mkdocs/prepare.md'\nInitial content in 'nbdev_mkdocs/mkdocs/preview.md'\nInitial content in 'nbdev_mkdocs/social_image_generator/generate_social_image.md'\n****************************************************************************************************\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n::: test_lib.test_module.test_symbol\n
with TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    shutil.copyfile(\n        _root_path / \"nbs\" / \"Social_Image_Generator.ipynb\",\n        Path(d) / \"nbs\" / \"Social_Image_Generator.ipynb\",\n    )\n    new(d)\n\n    with set_cwd(d):\n        with unset_env_var(\"IN_TEST\"):\n            nbdev_export.__wrapped__()\n\n    module_name = f\"repo_{random_string}\"\n\n    expected = f\"\"\"    - repo_{random_string}\n        - social_image_generator\n            - [generate_social_image](api/repo_{random_string}/social_image_generator/generate_social_image.md)\n\"\"\"\n    with add_tmp_path_to_sys_path(d):\n        with mock_get_annotated_symbol_definition():\n            api_summary = _generate_api_docs_for_module(d, module_name)\n\n    print(\"*\" * 100)\n    print(\"- API\")\n    print(api_summary)\n    print(\"*\" * 100)\n\n    assert api_summary == expected\n\n    files = sorted(\n        [x for x in (Path(d) / \"mkdocs\" / \"docs\" / \"api\").glob(\"**/*\") if x.is_file()]\n    )\n\n    display(files)\n\n    for file in files:\n        with open(file, \"r\", encoding=\"utf-8\") as f:\n            print(f.read())\n\nfilenames_1 = re.findall(r\"[a-z|A-Z|_]*\\.md\", api_summary)\nfilenames_2 = [f.name for f in files]\nassert set(filenames_1) == set(\n    filenames_2\n), f\"set(filenames_1) = {set(filenames_1)}, set(filenames_2) = {set(filenames_2)}\"\n
settings.ini created.\nDirectory /tmp/tmp9dhld1sd/mkdocs created.\nFile '/tmp/tmp9dhld1sd/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp9dhld1sd/mkdocs/summary_template.txt' generated.\n****************************************************************************************************\n- API\n    - repo_efqwbqdopp\n        - social_image_generator\n            - [generate_social_image](api/repo_efqwbqdopp/social_image_generator/generate_social_image.md)\n\n****************************************************************************************************\n::: test_lib.test_module.test_symbol\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[Path('/tmp/tmp9dhld1sd/mkdocs/docs/api/repo_efqwbqdopp/social_image_generator/generate_social_image.md')]\n
s = \"\"\"usage: nbdev_mkdocs_new [-h] root_path\n\nInitialize mkdocs project files Creates **mkdocs** directory in the **root_path** directory and populates it with\ninitial values. You should edit mkdocs.yml file to customize it if needed.\n\npositional arguments:\n  root_path\n\noptional arguments:\n  -h, --help  show this help message and exit show this help message and exit show this help message and exit\n  -h, --help  show this help message and exit\n  --port PORT\n  --domain DOMAIN\n\"\"\"\n\nwidth = 60\ndoc = _restrict_line_length(s, width)\n\nprint(doc)\nassert all([len(line) <= width for line in doc.splitlines() if line.strip() != \"\"])\n
usage: nbdev_mkdocs_new [-h] root_path\n\nInitialize mkdocs project files Creates **mkdocs** directory\nin the **root_path** directory and populates it with initial\nvalues. You should edit mkdocs.yml file to customize it if\nneeded.\n\n\npositional arguments:\n root_path\n\noptional arguments:\n -h, --help  show this help message and exit show this help\nmessage and exit show this help message and exit\n -h, --help  show this help message and exit\n --port PORT\n --domain DOMAIN\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    # update settings.ini file add invalid console script\n    updater = ConfigUpdater()\n    updater.read(settings_path)\n    updater[\"DEFAULT\"][\"console_scripts\"] = \"nbdev_mkdocs=nbdev_mkdocs._cli:_app\"\n    updater[\"DEFAULT\"][\"console_scripts\"].append(\n        \"invalid_cmd=nbdev_mkdocs._cli:_invalid_app\"\n    )\n    updater.update_file()\n\n    new(d)\n\n    _module = \"repo\"\n    cli_summary = _generate_cli_docs_for_module(d, _module)\n    print(cli_summary)\n    expected = \"\"\"    - [nbdev_mkdocs](cli/nbdev_mkdocs.md)\n    - [invalid_cmd](cli/invalid_cmd.md)\"\"\"\n\n    assert cli_summary == expected, cli_summary\n\n    _dst_path = Path(d) / \"mkdocs\" / \"docs\"\n    assert (_dst_path / \"cli\" / \"nbdev_mkdocs.md\").exists()\n    assert (_dst_path / \"cli\" / \"invalid_cmd.md\").exists()\n\n    with (_dst_path / \"cli\" / \"invalid_cmd.md\").open(\"r\") as f:\n        contents = f.read()\n\n    print(contents)\n    assert (\n        contents\n        == \"Unable to generate documentation for command. Execution of `invalid_cmd --help` command failed.\"\n    )\n
settings.ini created.\nDirectory /tmp/tmpf3hl19sv/mkdocs created.\nFile '/tmp/tmpf3hl19sv/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpf3hl19sv/mkdocs/summary_template.txt' generated.\n    - [nbdev_mkdocs](cli/nbdev_mkdocs.md)\n    - [invalid_cmd](cli/invalid_cmd.md)\nUnable to generate documentation for command. Execution of `invalid_cmd --help` command failed.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n    settings_path = Path(d) / \"settings.ini\"\n    new(d)\n\n    _module = \"invalid_module\"\n    cli_summary = _generate_cli_docs_for_module(d, _module)\n    print(cli_summary)\n\n    _dst_path = Path(d) / \"mkdocs\" / \"docs\"\n\n    for path in _dst_path.iterdir():\n        print(path)\n\n    assert cli_summary == \" \" * 4 + \"- [Not found](cli_commands_not_found.md)\"\n\n    assert (_dst_path / \"cli_commands_not_found.md\").exists()\n
settings.ini created.\nDirectory /tmp/tmplqwtdefu/mkdocs created.\nFile '/tmp/tmplqwtdefu/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmplqwtdefu/mkdocs/summary_template.txt' generated.\n    - [Not found](cli_commands_not_found.md)\n/tmp/tmplqwtdefu/mkdocs/docs/images\n/tmp/tmplqwtdefu/mkdocs/docs/cli_commands_not_found.md\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    new(d)\n\n    _module = \"nbdev_mkdocs\"\n    cli_summary = _generate_cli_docs_for_module(d, _module)\n    print(cli_summary)\n\n    # make sure all paths and content exist\n    paths = re.findall(\"\\(.*?\\)\", cli_summary)\n    paths = [Path(d) / \"mkdocs/docs\" / x[1:-1] for x in paths]\n    for path in paths:\n        assert path.exists(), path\n        assert \"cli\" in str(path)\n
settings.ini created.\nDirectory /tmp/tmp4gfi9sq6/mkdocs created.\nFile '/tmp/tmp4gfi9sq6/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp4gfi9sq6/mkdocs/summary_template.txt' generated.\n    - [nbdev_mkdocs](cli/nbdev_mkdocs.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n\n    new(d)\n\n    change_log = _copy_change_log_if_exists(d, f\"{d}/mkdocs/docs\")\n\n    print(f\"change_log={change_log}\")\n    assert change_log == \"(changelog_not_found.md)\"\n\n    change_log_path = Path(d) / \"CHANGELOG.md\"\n    with open(change_log_path, \"w\", encoding=\"utf-8\") as f:\n        f.write(\"CHANGELOG\")\n\n    (Path(d) / \"mkdocs\" / \"docs\").mkdir(exist_ok=True, parents=True)\n    change_log = _copy_change_log_if_exists(d, f\"{d}/mkdocs/docs\")\n\n    print(f\"change_log={change_log}\")\n    assert change_log == \"(CHANGELOG.md)\"\n
settings.ini created.\nDirectory /tmp/tmp_fiu1l6b/mkdocs created.\nFile '/tmp/tmp_fiu1l6b/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmp_fiu1l6b/mkdocs/summary_template.txt' generated.\nchange_log=(changelog_not_found.md)\nchange_log=(CHANGELOG.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
"},{"location":"Mkdocs/#bringing-it-all-together_1","title":"Bringing it all together","text":"
_test_summary_template = \"\"\"{sidebar}\n- Reference\n{api}\n- Command line\n{cli}\n- [Change log]{changelog}\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    for fname in [\"README.md\", \"CHANGELOG.md\"]:\n        shutil.copyfile(Path(\"..\") / fname, Path(d) / fname)\n\n    for f in [\"Mkdocs.ipynb\", \"Social_Image_Generator.ipynb\"]:\n        shutil.copyfile(_root_path / \"nbs\" / f, Path(d) / \"nbs\" / f)\n\n    copy_guides(_root_path, d)\n    shutil.copytree((Path(d) / \"nbs\" / \"guides\"), (Path(d) / \"nbs\" / \"blogs\"))\n\n    updater = ConfigUpdater()\n    updater.read(Path(d) / \"settings.ini\")\n    updater[\"DEFAULT\"][\"custom_sidebar\"] = False\n    updater.update_file()\n\n    new(d)\n\n    _summary_template_path = Path(d) / \"mkdocs\" / \"summary_template.txt\"\n    _summary_template_path.unlink()\n    with _summary_template_path.open(\"w\", encoding=\"utf-8\") as f:\n        f.write(_test_summary_template)\n\n    with set_cwd(d):\n        with unset_env_var(\"IN_TEST\"):\n            nbdev_export.__wrapped__()\n\n        cache_path = proc_nbs()\n\n    with add_tmp_path_to_sys_path(d):\n        with mock_get_annotated_symbol_definition():\n            _build_summary(d, f\"repo_{random_string}\", cache_path)\n\n    with open(Path(d) / \"mkdocs/docs/SUMMARY.md\", \"r\", encoding=\"utf-8\") as f:\n        summary = f.read()\n\n    print(summary)\n    assert \"- [Material for nbdev](index.md)\" in summary\n    assert \"- [Change log](CHANGELOG.md)\" in summary\n    assert \"- Reference\\n\" in summary\n    assert \"- Command line\\n\" in summary\n    assert (\n        f\"- [nbdev_mkdocs_docs](api/repo_{random_string}/mkdocs/nbdev_mkdocs_docs.md)\"\n        in summary\n    )\n    assert (\n        f\"- [generate_social_image](api/repo_{random_string}/social_image_generator/generate_social_image.md)\"\n        in summary\n    )\n
settings.ini created.\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmph73bybi6/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmph73bybi6/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmph73bybi6/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmph73bybi6/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmph73bybi6/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmph73bybi6/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmph73bybi6/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmph73bybi6/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmph73bybi6/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmph73bybi6/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmph73bybi6/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmph73bybi6/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmph73bybi6/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmph73bybi6/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmph73bybi6/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmph73bybi6/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmph73bybi6/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmph73bybi6/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmph73bybi6/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmph73bybi6/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmph73bybi6/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmph73bybi6/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmph73bybi6/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmph73bybi6/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmph73bybi6/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmph73bybi6/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmph73bybi6/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmph73bybi6/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmph73bybi6/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmph73bybi6/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmph73bybi6/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmph73bybi6/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmph73bybi6/nbs/guides/images/guide_1.png\nDirectory /tmp/tmph73bybi6/mkdocs created.\nFile '/tmp/tmph73bybi6/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmph73bybi6/mkdocs/summary_template.txt' generated.\n- [Material for nbdev](index.md)\n- [Create new](Mkdocs.md)\n- [Social_Image_Generator.html](Social_Image_Generator.md)\n- blogs\n    - [Adding guides](blogs/Adding_Guides.md)\n    - [Adding release notes](blogs/Adding_Release_Notes.md)\n    - [Advanced customization options](blogs/Advanced_Customization_Options.md)\n    - [Auto-generating docstrings](blogs/Auto_Generating_Docstrings.md)\n    - [Basic User Guide](blogs/Basic_User_Guide.md)\n    - [Customizing the sidebar](blogs/Customizing_The_Sidebar.md)\n    - [Handling pandas in the output](blogs/Handling_Pandas_In_The_Output.md)\n    - [Setting up document versioning](blogs/Setting_Up_Document_Versioning.md)\n    - [Setting up social cards](blogs/Setting_up_social_cards.md)\n- guides\n    - [Adding guides](guides/Adding_Guides.md)\n    - [Adding release notes](guides/Adding_Release_Notes.md)\n    - [Advanced customization options](guides/Advanced_Customization_Options.md)\n    - [Auto-generating docstrings](guides/Auto_Generating_Docstrings.md)\n    - [Basic User Guide](guides/Basic_User_Guide.md)\n    - [Customizing the sidebar](guides/Customizing_The_Sidebar.md)\n    - [Handling pandas in the output](guides/Handling_Pandas_In_The_Output.md)\n    - [Setting up document versioning](guides/Setting_Up_Document_Versioning.md)\n    - [Setting up social cards](guides/Setting_up_social_cards.md)\n- Reference\n    - repo_yruqmqiwmu\n        - mkdocs\n            - [nbdev_mkdocs_docs](api/repo_yruqmqiwmu/mkdocs/nbdev_mkdocs_docs.md)\n            - [new](api/repo_yruqmqiwmu/mkdocs/new.md)\n            - [prepare](api/repo_yruqmqiwmu/mkdocs/prepare.md)\n            - [preview](api/repo_yruqmqiwmu/mkdocs/preview.md)\n        - social_image_generator\n            - [generate_social_image](api/repo_yruqmqiwmu/social_image_generator/generate_social_image.md)\n- Command line\n    - [Not found](cli_commands_not_found.md)\n- [Change log](CHANGELOG.md)\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Social_Image_Generator.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nOutput created: _docs/Social_Image_Generator.md\n\npandoc -o Mkdocs.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Create new\n\nOutput created: _docs/Mkdocs.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n
"},{"location":"Mkdocs/#copy-cname-if-needed","title":"Copy CNAME if needed","text":"
for has_cname in [True, False]:\n    with TemporaryDirectory() as d:\n        settings_path = Path(d) / \"settings.ini\"\n        for fname in [\"settings.ini\", \"README.md\"] + [\"CNAME\"] if has_cname else []:\n            shutil.copyfile(Path(\"..\") / fname, Path(d) / fname)\n\n        _copy_cname_if_needed(d)\n        if has_cname:\n            assert (Path(d) / \"mkdocs\" / \"docs\" / \"CNAME\").exists()\n        else:\n            assert not (Path(d) / \"mkdocs\" / \"docs\" / \"CNAME\").exists()\n
File '/tmp/tmpayy2vh64/CNAME' copied to '/tmp/tmpayy2vh64/mkdocs/docs/CNAME'.\nFile '/tmp/tmp8n1__l9o/CNAME' not found, skipping copying..\n
with TemporaryDirectory() as d:\n    run_nbdev_new(d)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    new(d)\n\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"css\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"js\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"css\" / \"extra.css\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs_overrides\" / \"js\" / \"extra.js\").exists()\n\n    _copy_docs_overrides(d)\n\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"css\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"js\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"images\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"css\" / \"extra.css\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"overrides\" / \"js\" / \"extra.js\").exists()\n
settings.ini created.\nDirectory /tmp/tmpy999o2ev/mkdocs created.\nFile '/tmp/tmpy999o2ev/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpy999o2ev/mkdocs/summary_template.txt' generated.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n
use_relative_doc_links = False\nexpected_dict = {\n    \"0.1.1\": [\n        \"https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"https://airtai.github.io/nbdev-mkdocs/0.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"https://airtai.github.io/nbdev-mkdocs/0.1.1/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n    ],\n    \"0.1.1dev\": [\n        \"https://airtai.github.io/nbdev-mkdocs/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"https://airtai.github.io/nbdev-mkdocs/0.1.1dev/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"https://airtai.github.io/nbdev-mkdocs/0.1.1dev/api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n    ],\n}\nfor version, expected in expected_dict.items():\n    for i, docs_versioning in enumerate([None, \"minor\", \"patch\"]):\n        with TemporaryDirectory() as d:\n            run_nbdev_new(d)\n            updater = ConfigUpdater()\n            updater.read(Path(d) / \"settings.ini\")\n            updater[\"DEFAULT\"][\"version\"].add_after.option(\n                \"docs_versioning\", docs_versioning\n            )\n            updater[\"DEFAULT\"][\"version\"] = version\n            updater.update_file()\n\n            _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n            shutil.copyfile(\n                _root_path / \"fixtures/Test_Sym_Links_In_Docs.ipynb\",\n                Path(d) / \"nbs/Test_Sym_Links_In_Docs.ipynb\",\n            )\n\n            with set_cwd(d):\n                with unset_env_var(\"IN_TEST\"):\n                    nbdev_export.__wrapped__()\n                cache_path = proc_nbs()\n\n            cmd = f'cd \"{d}\" && nbdev_docs'\n            _sprun(cmd)\n\n            nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\n            docs_versioning = get_value_from_config(d, \"docs_versioning\")\n            lib_version = get_value_from_config(d, \"version\")\n\n            _fix_sym_links_in_nbs(\n                d,\n                cache_path,\n                nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                use_relative_doc_links,\n            )\n\n            with open(f\"{d}/_proc/Test_Sym_Links_In_Docs.ipynb\", \"r\", encoding=\"utf-8\") as f:\n                file_contents = f.read()\n\n            assert (\n                \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n                not in file_contents\n            )\n            assert (\n                \"[`nbdev.doclinks.NbdevLookup.linkify`](https://nbdev.fast.ai/api/doclinks.html#nbdevlookup.linkify)\"\n                in file_contents\n            )\n            assert expected[i] in file_contents, f\"{expected[i]}, {file_contents}\"\n\n            print(\"OK.\")\n
settings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/home/harish/.local/lib/python3.8/site-packages/configupdater/option.py:115: NoneValueDisallowed: Cannot represent <docs_versioning = None>, it will be converted to <docs_versioning = ''>.\n    Please use ``allow_no_value=True`` with ``ConfigUpdater``.\n\n  NoneValueDisallowed.warn(self._key)\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/home/harish/.local/lib/python3.8/site-packages/configupdater/option.py:115: NoneValueDisallowed: Cannot represent <docs_versioning = None>, it will be converted to <docs_versioning = ''>.\n    Please use ``allow_no_value=True`` with ``ConfigUpdater``.\n\n  NoneValueDisallowed.warn(self._key)\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\n
use_relative_doc_links = True\nexpected_dict = {\n    \"0.1.1\": [\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n    ],\n    \"0.1.1dev\": [\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n        \"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare\",\n    ],\n}\nfor version, expected in expected_dict.items():\n    for i, docs_versioning in enumerate([None, \"minor\", \"patch\"]):\n        with TemporaryDirectory() as d:\n            run_nbdev_new(d)\n            updater = ConfigUpdater()\n            updater.read(Path(d) / \"settings.ini\")\n            updater[\"DEFAULT\"][\"version\"].add_after.option(\n                \"docs_versioning\", docs_versioning\n            )\n            updater[\"DEFAULT\"][\"version\"] = version\n            updater.update_file()\n\n            _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n            shutil.copyfile(\n                _root_path / \"fixtures/Test_Sym_Links_In_Docs.ipynb\",\n                Path(d) / \"nbs/Test_Sym_Links_In_Docs.ipynb\",\n            )\n\n            with set_cwd(d):\n                with unset_env_var(\"IN_TEST\"):\n                    nbdev_export.__wrapped__()\n                cache_path = proc_nbs()\n\n            cmd = f'cd \"{d}\" && nbdev_docs'\n            _sprun(cmd)\n\n            nbdev_lookup = NbdevLookup(incl_libs=\"nbdev-mkdocs\")\n            docs_versioning = get_value_from_config(d, \"docs_versioning\")\n            lib_version = get_value_from_config(d, \"version\")\n\n            _fix_sym_links_in_nbs(\n                d,\n                cache_path,\n                nbdev_lookup,\n                docs_versioning,\n                lib_version,\n                use_relative_doc_links,\n            )\n\n            with open(f\"{d}/_proc/Test_Sym_Links_In_Docs.ipynb\", \"r\", encoding=\"utf-8\") as f:\n                file_contents = f.read()\n\n            assert (\n                \"[`nbdev_mkdocs.mkdocs.prepare`](https://airtai.github.io/nbdev-mkdocs/mkdocs.html#prepare)\"\n                not in file_contents\n            )\n            assert (\n                \"[`nbdev.doclinks.NbdevLookup.linkify`](https://nbdev.fast.ai/api/doclinks.html#nbdevlookup.linkify)\"\n                in file_contents\n            )\n            assert expected[i] in file_contents, f\"{expected[i]}, {file_contents}\"\n\n            print(\"OK.\")\n
settings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\nsettings.ini created.\nOK.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/home/harish/.local/lib/python3.8/site-packages/configupdater/option.py:115: NoneValueDisallowed: Cannot represent <docs_versioning = None>, it will be converted to <docs_versioning = ''>.\n    Please use ``allow_no_value=True`` with ``ConfigUpdater``.\n\n  NoneValueDisallowed.warn(self._key)\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/home/harish/.local/lib/python3.8/site-packages/configupdater/option.py:115: NoneValueDisallowed: Cannot represent <docs_versioning = None>, it will be converted to <docs_versioning = ''>.\n    Please use ``allow_no_value=True`` with ``ConfigUpdater``.\n\n  NoneValueDisallowed.warn(self._key)\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n[1/2] Test_Sym_Links_In_Docs.ipynb\n[2/2] index.ipynb\n\nOutput created: _docs/index.html\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\n

source

"},{"location":"Mkdocs/#prepare","title":"prepare","text":"
 prepare (root_path:str, use_relative_doc_links:bool=False,\n          no_test:bool=False, no_mkdocs_build:bool=False)\n

Prepare mkdocs for serving

Args: root_path: The root path of the project use_relative_doc_links: If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview. no_test: If set to False, the unit tests will be run, else they will be skipped no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

source

"},{"location":"Mkdocs/#nbdev_mkdocs_docs","title":"nbdev_mkdocs_docs","text":"
 nbdev_mkdocs_docs (root_path:str, refresh_quarto_settings:bool=False,\n                    use_relative_doc_links:bool=False,\n                    no_mkdocs_build:bool=False)\n

Prepare mkdocs documentation

Args: root_path: The root path of the project refresh_quarto_settings: Flag to refresh quarto yml file. This flag should be set to True if this function is called directly without calling prepare. use_relative_doc_links: If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview. no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    updater = ConfigUpdater()\n    updater.read(settings_path)\n    updater[\"DEFAULT\"][\"version\"] = \"5.0.1\"\n    updater.update_file()\n\n    #     !cat {settings_path}\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    copy_guides(_root_path, d)\n\n    for f in [\"CNAME\", \"nbs/Docstring.ipynb\"]:\n        shutil.copyfile(_root_path / f, Path(d) / f)\n\n    new(d)\n    #     !cat {d}/mkdocs/mkdocs.yml\n\n    with add_tmp_path_to_sys_path(d):\n        with unset_env_var(\"IN_TEST\"):\n            prepare(d)\n\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"CNAME\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"SUMMARY.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"index.md\").exists()\n    assert (Path(d) / \"mkdocs\" / \"docs\" / \"guides\").exists()\n    assert (\n        Path(d)\n        / \"mkdocs\"\n        / \"docs\"\n        / \"api\"\n        / f\"repo_{random_string}\"\n        / \"docstring\"\n        / \"run_examples_from_docstring.md\"\n    ).exists()\n
settings.ini created.\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmpf8j672p2/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmpf8j672p2/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmpf8j672p2/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmpf8j672p2/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmpf8j672p2/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmpf8j672p2/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmpf8j672p2/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmpf8j672p2/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmpf8j672p2/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmpf8j672p2/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmpf8j672p2/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmpf8j672p2/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmpf8j672p2/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmpf8j672p2/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmpf8j672p2/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmpf8j672p2/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmpf8j672p2/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmpf8j672p2/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmpf8j672p2/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmpf8j672p2/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmpf8j672p2/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmpf8j672p2/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmpf8j672p2/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmpf8j672p2/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmpf8j672p2/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmpf8j672p2/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmpf8j672p2/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmpf8j672p2/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmpf8j672p2/nbs/guides/images/guide_1.png\nDirectory /tmp/tmpf8j672p2/mkdocs created.\nFile '/tmp/tmpf8j672p2/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpf8j672p2/mkdocs/summary_template.txt' generated.\nSuccess.\nFile '/tmp/tmpf8j672p2/CNAME' copied to '/tmp/tmpf8j672p2/mkdocs/docs/CNAME'.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Docstring.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: docstring.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Docstring helpers\n\nOutput created: _docs/Docstring.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\nINFO     -  Cleaning site directory\nINFO     -  Building documentation to directory: /tmp/tmpf8j672p2/mkdocs/site\nINFO     -  DeprecationWarning: invalid escape sequence \\s\n  File \"/home/harish/.local/lib/python3.8/site-packages/griffe/agents/visitor.py\", line 180, in get_module\n    top_node = compile(self.code, mode=\"exec\", filename=str(self.filepath), flags=ast.PyCF_ONLY_AST, optimize=1)\n  File \"repo_zjsgwfnvop/docstring.py\", line 94, in \n    code = [x[0] for x in re.findall(\"```\\s*python((\\n|.|\\\\n])+)```\", s)]\n\nINFO     -  DeprecationWarning: invalid escape sequence \\w\n  File \"/home/harish/.local/lib/python3.8/site-packages/griffe/agents/visitor.py\", line 180, in get_module\n    top_node = compile(self.code, mode=\"exec\", filename=str(self.filepath), flags=ast.PyCF_ONLY_AST, optimize=1)\n  File \"repo_zjsgwfnvop/docstring.py\", line 124, in \n    [x[9:-1] for x in re.findall(\"{fill in \\w+}\", example)]\n\nINFO     -  Documentation built in 0.99 seconds\n
"},{"location":"Mkdocs/#preview","title":"Preview","text":"

source

"},{"location":"Mkdocs/#preview_1","title":"preview","text":"
 preview (root_path:str, use_relative_doc_links:bool,\n          port:Optional[int]=None)\n

Preview the mkdocs documentation.

Args: root_path: The root path of the documentation. use_relative_doc_links: If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. port: The port to serve the documentation on.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

_test_summary_template = \"\"\"{sidebar}\n- Reference\n{api}\n- Command line\n{cli}\n- [Change log]{changelog}\n\"\"\"\n\nwith TemporaryDirectory() as d:\n    random_string = \"\".join(\n        random.choice(string.ascii_lowercase) for _ in range(10)  # nosec B311\n    )\n    run_nbdev_new(d, random_string)\n    print(f\"Docs will be server at: http://0.0.0.0:4000/repo_{random_string}/\")\n\n    settings_path = Path(d) / \"settings.ini\"\n    assert settings_path.exists()\n\n    updater = ConfigUpdater()\n    updater.read(settings_path)\n    updater[\"DEFAULT\"][\"version\"] = \"1.0.1\"\n    updater.update_file()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n\n    copy_guides(_root_path, d)\n    shutil.copytree((Path(d) / \"nbs\" / \"guides\"), (Path(d) / \"nbs\" / \"blogs\"))\n\n    for f in [\"CNAME\", \"nbs/Docstring.ipynb\"]:\n        shutil.copyfile(_root_path / f, Path(d) / f)\n\n    for f in [\"Fixture.ipynb\"]:\n        shutil.copyfile(_root_path / \"fixtures\" / f, Path(d) / \"nbs\" / f)\n\n    new(d)\n\n    _summary_template_path = Path(d) / \"mkdocs\" / \"summary_template.txt\"\n    _summary_template_path.unlink()\n    with _summary_template_path.open(\"w\", encoding=\"utf-8\") as f:\n        f.write(_test_summary_template)\n\n    preview(d, use_relative_doc_links=True, port=4000)\n
settings.ini created.\nDocs will be server at: http://0.0.0.0:4000/repo_jdjxstjafm/\n../nbs/guides/Adding_Release_Notes.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Adding_Release_Notes.ipynb\n../nbs/guides/Setting_up_social_cards.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Setting_up_social_cards.ipynb\n../nbs/guides/Basic_User_Guide.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Basic_User_Guide.ipynb\n../nbs/guides/Advanced_Customization_Options.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Advanced_Customization_Options.ipynb\n../nbs/guides/Auto_Generating_Docstrings.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Auto_Generating_Docstrings.ipynb\n../nbs/guides/Customizing_The_Sidebar.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Customizing_The_Sidebar.ipynb\n../nbs/guides/Handling_Pandas_In_The_Output.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Handling_Pandas_In_The_Output.ipynb\n../nbs/guides/Setting_Up_Document_Versioning.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Setting_Up_Document_Versioning.ipynb\n../nbs/guides/Adding_Guides.ipynb, /tmp/tmpvfcku8sc/nbs/guides/Adding_Guides.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Adding_Guides-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Basic_User_Guide-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Adding_Release_Notes-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Handling_Pandas_In_The_Output-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Guide_00_Installation-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Setting_Up_Document_Versioning-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Auto_Generating_Docstrings-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Guide_01_End_To_End_Walkthrough-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Advanced_Customization_Options-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Setting_up_social_cards-checkpoint.ipynb\n../nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb, /tmp/tmpvfcku8sc/nbs/guides/.ipynb_checkpoints/Guide_00_How_To_Install-checkpoint.ipynb\n../nbs/guides/images/guide_notebook.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_notebook.png\n../nbs/guides/images/sidebar_1.png, /tmp/tmpvfcku8sc/nbs/guides/images/sidebar_1.png\n../nbs/guides/images/cli_not_found.png, /tmp/tmpvfcku8sc/nbs/guides/images/cli_not_found.png\n../nbs/guides/images/enable_gh_pages.png, /tmp/tmpvfcku8sc/nbs/guides/images/enable_gh_pages.png\n../nbs/guides/images/CLI_command.png, /tmp/tmpvfcku8sc/nbs/guides/images/CLI_command.png\n../nbs/guides/images/guide_3.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_3.png\n../nbs/guides/images/sidebar_2.png, /tmp/tmpvfcku8sc/nbs/guides/images/sidebar_2.png\n../nbs/guides/images/docstring-gen-extension-btn.png, /tmp/tmpvfcku8sc/nbs/guides/images/docstring-gen-extension-btn.png\n../nbs/guides/images/releases.png, /tmp/tmpvfcku8sc/nbs/guides/images/releases.png\n../nbs/guides/images/say_hello.png, /tmp/tmpvfcku8sc/nbs/guides/images/say_hello.png\n../nbs/guides/images/foo_doc_string.png, /tmp/tmpvfcku8sc/nbs/guides/images/foo_doc_string.png\n../nbs/guides/images/nbdev_mkdocs_preview_dark_1.png, /tmp/tmpvfcku8sc/nbs/guides/images/nbdev_mkdocs_preview_dark_1.png\n../nbs/guides/images/nbs/images/git_repo_clone_page.png, /tmp/tmpvfcku8sc/nbs/guides/images/nbs/images/git_repo_clone_page.png\n../nbs/guides/images/guide_2.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_2.png\n../nbs/guides/images/guide_4.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_4.png\n../nbs/guides/images/doc_versioning.png, /tmp/tmpvfcku8sc/nbs/guides/images/doc_versioning.png\n../nbs/guides/images/nbdev_mkdocs_preview_light_1.png, /tmp/tmpvfcku8sc/nbs/guides/images/nbdev_mkdocs_preview_light_1.png\n../nbs/guides/images/empty_git_repo.png, /tmp/tmpvfcku8sc/nbs/guides/images/empty_git_repo.png\n../nbs/guides/images/hello_class.png, /tmp/tmpvfcku8sc/nbs/guides/images/hello_class.png\n../nbs/guides/images/releases_default.png, /tmp/tmpvfcku8sc/nbs/guides/images/releases_default.png\n../nbs/guides/images/set_github_token_permission.png, /tmp/tmpvfcku8sc/nbs/guides/images/set_github_token_permission.png\n../nbs/guides/images/jupyter_home.png, /tmp/tmpvfcku8sc/nbs/guides/images/jupyter_home.png\n../nbs/guides/images/guide_1.png, /tmp/tmpvfcku8sc/nbs/guides/images/guide_1.png\nDirectory /tmp/tmpvfcku8sc/mkdocs created.\nFile '/tmp/tmpvfcku8sc/mkdocs/mkdocs.yml' generated.\nFile '/tmp/tmpvfcku8sc/mkdocs/summary_template.txt' generated.\nFile '/tmp/tmpvfcku8sc/CNAME' copied to '/tmp/tmpvfcku8sc/mkdocs/docs/CNAME'.\n\npandoc -o README.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/README.md\n\n/usr/local/lib/python3.8/dist-packages/nbformat/__init__.py:93: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.\n  validate(nb)\npandoc -o Fixture.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  standalone: true\n  default-image-extension: png\n\nOutput created: _docs/Fixture.md\n\npandoc -o Docstring.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: docstring.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Docstring helpers\n\nOutput created: _docs/Docstring.md\n\npandoc -o index.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: index.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Material for nbdev\n\nOutput created: _docs/index.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\npandoc -o ../Setting_Up_Document_Versioning.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_document_versioning.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up document versioning\n\nOutput created: ../_docs/Setting_Up_Document_Versioning.md\n\npandoc -o ../Auto_Generating_Docstrings.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: auto_generating_docstrings.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Auto-generating docstrings\n\nOutput created: ../_docs/Auto_Generating_Docstrings.md\n\npandoc -o ../Advanced_Customization_Options.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: advanced_customization_options.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Advanced customization options\n\nOutput created: ../_docs/Advanced_Customization_Options.md\n\npandoc -o ../Adding_Guides.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_guides.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding guides\n\nOutput created: ../_docs/Adding_Guides.md\n\npandoc -o ../Basic_User_Guide.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: basic_user_guide.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Basic User Guide\n\nOutput created: ../_docs/Basic_User_Guide.md\n\npandoc -o ../Setting_up_social_cards.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: setting_up_social_cards.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Setting up social cards\n\nOutput created: ../_docs/Setting_up_social_cards.md\n\npandoc -o ../Adding_Release_Notes.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: adding_release_notes.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Adding release notes\n\nOutput created: ../_docs/Adding_Release_Notes.md\n\npandoc -o ../Handling_Pandas_In_The_Output.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: handling_pandas_in_the_output.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Handling pandas in the output\n\nOutput created: ../_docs/Handling_Pandas_In_The_Output.md\n\npandoc -o ../Customizing_The_Sidebar.md\n  to: >-\n    commonmark+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars\n  output-file: customizing_the_sidebar.html\n  standalone: true\n  default-image-extension: png\n\nmetadata\n  title: Customizing the sidebar\n\nOutput created: ../_docs/Customizing_The_Sidebar.md\n\nWARNING  -  Config value 'dev_addr': The use of the IP address '0.0.0.0' suggests a production environment or the use of a proxy to connect to the MkDocs server. However, the MkDocs' server is intended for local development purposes only. Please use a third party production-ready server instead.\nINFO     -  Building documentation...\nINFO     -  Cleaning site directory\nINFO     -  DeprecationWarning: invalid escape sequence \\s\n  File \"/home/harish/.local/lib/python3.8/site-packages/griffe/agents/visitor.py\", line 180, in get_module\n    top_node = compile(self.code, mode=\"exec\", filename=str(self.filepath), flags=ast.PyCF_ONLY_AST, optimize=1)\n  File \"repo_jdjxstjafm/docstring.py\", line 94, in \n    code = [x[0] for x in re.findall(\"```\\s*python((\\n|.|\\\\n])+)```\", s)]\n\nINFO     -  DeprecationWarning: invalid escape sequence \\w\n  File \"/home/harish/.local/lib/python3.8/site-packages/griffe/agents/visitor.py\", line 180, in get_module\n    top_node = compile(self.code, mode=\"exec\", filename=str(self.filepath), flags=ast.PyCF_ONLY_AST, optimize=1)\n  File \"repo_jdjxstjafm/docstring.py\", line 124, in \n    [x[9:-1] for x in re.findall(\"{fill in \\w+}\", example)]\n\nINFO     -  Documentation built in 1.21 seconds\nINFO     -  [04:41:41] Watching paths for changes: 'mkdocs/docs', 'mkdocs/mkdocs.yml'\nINFO     -  [04:41:41] Serving on http://0.0.0.0:4000/repo_jdjxstjafm/\nWARNING  -  [04:41:48] \"GET /versions.json HTTP/1.1\" code 404\nINFO     -  [04:41:48] Browser connected: http://0.0.0.0:4000/repo_jdjxstjafm/\nINFO     -  Shutting down...\n\nKeyboardInterrupt:\n
"},{"location":"PackageData/","title":"PackageData","text":""},{"location":"PackageData/#get_root_data_path","title":"get_root_data_path","text":"
 get_root_data_path ()\n

Returns path to package_data in lib

Example: ``` python from nbdev_mkdocs._package_data import get_root_data_path

mkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\nprint(f\"Path is: {mkdocs_template_path.resolve()}\")\nassert mkdocs_template_path.exists()\n\n```\n

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

get_root_data_path.__doc__\n
'Returns path to package_data in lib\\n\\n    Example:\\n        ``` python\\n        from nbdev_mkdocs._package_data import get_root_data_path\\n\\n        mkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\\n        print(f\"Path is: {mkdocs_template_path.resolve()}\")\\n        assert mkdocs_template_path.exists()\\n\\n        ```\\n\\n    !!! note\\n\\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\\n    '\n
from nbdev_mkdocs.docstring import run_examples_from_docstring\n
run_examples_from_docstring(get_root_data_path)\n
Example:\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 code \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n    from nbdev_mkdocs._package_data import get_root_data_path\n\n    mkdocs_template_path = get_root_data_path() / \"mkdocs_template.yml\"\n    print(f\"Path is: {mkdocs_template_path.resolve()}\")\n    assert mkdocs_template_path.exists()\n\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stdout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nPath is: \n/Users/harishm/Dev/airt-git/nbdev-mkdocs/nbdev_mkdocs/package_data/mkdocs_templa\nte.yml\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 stderr \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n
"},{"location":"Quarto_To_MkDocs_Syntax_Convertor/","title":"Quarto To MkDocs Syntax Convertor","text":"
from tempfile import TemporaryDirectory\nimport shutil\n
_input = \"\"\"\nmay have some text before ::: {markdown=1 .content-visible when-format=\\\\\"markdown\\\\\" style=\\\\\"text-align: center\\\\\"}\n\nsome random text \n\n::: {markdown=1 .content-visible when-format=\\\\\"markdown\\\\\"}\n\"\"\"\nexpected = \"\"\"\nmay have some text before ::: {markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\" style=\\\\\"text-align: center\\\\\"}\n\nsome random text \n\n::: {markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}\n\"\"\"\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-visible when-format=\\\\\"html\\\\\"}'\nexpected = '::: {markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-visible  unless-format=\\\\\"html\\\\\"}'\nexpected = '::: {markdown=1 .content-visible  when-format=\\\\\"html\\\\\"}'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = \"::: {markdown=1 .content-visible  unless-format=\\\\'markdown\\\\'}\"\nexpected = \"::: {markdown=1 .content-visible  when-format=\\\\'markdown\\\\'}\"\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n
may have some text before ::: {markdown=1 .content-visible unless-format=\\\"markdown\\\" style=\\\"text-align: center\\\"}\n\nsome random text\n\n::: {markdown=1 .content-visible unless-format=\\\"markdown\\\"}\n\n::: {markdown=1 .content-visible unless-format=\\\"html\\\"}\n::: {markdown=1 .content-visible  when-format=\\\"html\\\"}\n::: {markdown=1 .content-visible  when-format=\\'markdown\\'}\n
_input = \"::: {markdown=1 .content-hidden  when-format=\\\\'html\\\\'}\"\nexpected = \"::: {markdown=1 .content-hidden  unless-format=\\\\'html\\\\'}\"\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-hidden  when-format=\\\\\"markdown\\\\\" }'\nexpected = '::: {markdown=1 .content-hidden  unless-format=\\\\\"markdown\\\\\" }'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-hidden  unless-format=\\\\\"html\\\\\" }'\nexpected = '::: {markdown=1 .content-hidden  when-format=\\\\\"html\\\\\" }'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n\n_input = '::: {markdown=1 .content-hidden  unless-format=\\\\\"markdown\\\\\" }'\nexpected = '::: {markdown=1 .content-hidden  when-format=\\\\\"markdown\\\\\" }'\n\nactual = _update_conditional_content_tags(_input)\nprint(actual)\nassert actual == expected, actual\n
::: {markdown=1 .content-hidden  unless-format=\\'html\\'}\n::: {markdown=1 .content-hidden  unless-format=\\\"markdown\\\" }\n::: {markdown=1 .content-hidden  when-format=\\\"html\\\" }\n::: {markdown=1 .content-hidden  when-format=\\\"markdown\\\" }\n
valid_inputs = [\n    \"\\n``` mermaid\\nflowchart LR\\n \",\n    \"\\n\\n``` mermaid   \\nflowchart LR\\n \",\n]\nexpected = [\"\\n``` mermaid\\nflowchart LR\\n \", \"\\n\\n``` mermaid   \\nflowchart LR\\n \"]\n\nfor n, i in enumerate(valid_inputs):\n    actual = _update_mermaid_chart_tags(i)\n    print(actual)\n    assert actual == expected[n], actual\n\n\ninvalid_inputs = [\n    \"\\n```{ mermaid}\\nflowchart LR\\n \",\n    \"\\n\\n```  some text {mermaid}   \\nflowchart LR\\n \",\n]\nexpected = [\n    \"\\n```{ mermaid}\\nflowchart LR\\n \",\n    \"\\n\\n```  some text {mermaid}   \\nflowchart LR\\n \",\n]\n\nfor n, i in enumerate(invalid_inputs):\n    actual = _update_mermaid_chart_tags(i)\n    print(actual)\n    assert actual == expected[n], actual\n
``` mermaid\nflowchart LR\n\n\n\n``` mermaid   \nflowchart LR\n\n\n```{ mermaid}\nflowchart LR\n\n\n\n```  some text {mermaid}   \nflowchart LR\n

``` python _input = \"\"\" Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"}

This is a Markdown Paragraph.

::: Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"} This is a Markdown Paragraph.

::: \"\"\" expected = \"\"\" Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"}

This is a Markdown Paragraph.

::: Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"} This is a Markdown Paragraph.

::: \"\"\" actual = _add_markdown_attribute_to_enable_md_in_html(_input) print(actual)

assert actual == expected

    Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"}\n\n    This is a *Markdown* Paragraph.\n\n    :::\n    Sample markdown Content ::: {markdown=1 .content-visible unless-format=\"html\"}\n    This is a *Markdown* Paragraph.\n\n    :::\n\n``` python\nfixtures = [\n    \"\",\n    ' collapse=\"false\" title=\"Some title\"',\n    ' collapse=\"true\" icon=false appearance=\"minimal\"',\n    \" collapse='false' title='Some title'\",\n    \" collapse='true' title='Some title'\",\n]\nexpected = [\"!!!\", \"???+\", \"???\", \"???+\", \"???\"]\n\nfor i, fixture in enumerate(fixtures):\n    actual = _get_callout_identifier(fixture)\n    print(actual)\n    assert actual == expected[i]\n

!!!\n???+\n???\n???+\n???\n
callout_attributes = \".callout-note icon=false\"\ncallout_content = \"\"\"Using callouts is an effective way to highlight content that your reader give special consideration or attention.\"\"\"\n\nexpected_title = \"\"\nexpected_callout_content = \"\"\"Using callouts is an effective way to highlight content that your reader give special consideration or attention.\"\"\"\n\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n\ncallout_attributes = '.callout-note appearance=\"minimal\"'\ncallout_content = \"\"\"Using callouts is an effective way to highlight content that your reader give special consideration or attention.\"\"\"\n\nexpected_title = \"\"\nexpected_callout_content = \"\"\"Using callouts is an effective way to highlight content that your reader give special consideration or attention.\"\"\"\n\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n
Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n\nUsing callouts is an effective way to highlight content that your reader give special consideration or attention.\n
callout_attributes = \" title='Tip with Title' icon='false'\"\ncallout_content = \"\"\"## Tip with Title\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\"\"\"\n\nexpected_title = \"Tip with Title\"\nexpected_callout_content = \"\"\"## Tip with Title\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\"\"\"\n\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n
Tip with Title\n## Tip with Title\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n
callout_attributes = \" icon='false'\"\ncallout_content = \"\"\"## Tip with Title\n\nThis is an example of a callout with a title.\n\"\"\"\n\nexpected_title = \"Tip with Title\"\nexpected_callout_content = \"\"\"This is an example of a callout with a title.\n\"\"\"\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n
Tip with Title\nThis is an example of a callout with a title.\n
callout_attributes = \"\"\ncallout_content = \"\"\"\n\n    This is an example of a callout with a title.\n\"\"\"\n\nexpected_title = None\nexpected_callout_content = \"\"\"\n\n    This is an example of a callout with a title.\n\"\"\"\nactual_title, actual_callout_content = _get_callout_title_and_content(callout_attributes, callout_content)\nprint(f\"{actual_title}\")\nprint(f\"{actual_callout_content}\")\nassert actual_title == expected_title\nassert actual_callout_content == expected_callout_content\n
None\n\n\n    This is an example of a callout with a title.\n
fixture = \"\"\"\n::: {markdown=1 .callout-note}\nNote that there are five types of callouts, including:\n`note`, `warning`, `important`, `tip`, and `caution`.\n:::\n\"\"\"\n\nexpected = \"\"\"\n!!! note\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\n\"\"\"\n\nactual = _fix_callout_syntax(fixture)\nprint(actual)\n\nassert actual == expected, actual\n
!!! note\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n
fixture = \"\"\"\n::: {markdown=1 .callout-tip}\n## Tip with Title\n\nNote that there are five types of callouts, including:\n`note`, `warning`, `important`, `tip`, and `caution`.\n:::\n\n::: {markdown=1 .callout-tip title=\"Tip with Title 2\"}\n\nThis is a callout with a title.\n:::\n\n\"\"\"\n\nexpected = \"\"\"\n!!! tip \\\\\"Tip with Title\\\\\"\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\n\n!!! tip \\\\\"Tip with Title 2\\\\\"\n\n    This is a callout with a title.\n\n\n\"\"\"\n\nactual = _fix_callout_syntax(fixture)\nprint(actual)\n\nassert actual == expected, actual\n
!!! tip \\\"Tip with Title\\\"\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n\n\n!!! tip \\\"Tip with Title 2\\\"\n\n    This is a callout with a title.\n
fixture = \"\"\"\n::: {markdown=1 .callout-caution collapse=\"true\"}\n## Expand To Learn About Collapse\n\nThis is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n:::\n\n::: {markdown=1 .callout-caution collapse=\"false\"}\n## Expand To Learn About Collapse\n\nThis is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n:::\n\"\"\"\n\nexpected = \"\"\"\n??? caution \\\\\"Expand To Learn About Collapse\\\\\"\n\n    This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n\n\n???+ caution \\\\\"Expand To Learn About Collapse\\\\\"\n\n    This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n\n\"\"\"\n\nactual = _fix_callout_syntax(fixture)\nprint(actual)\n\nassert actual == expected, actual\n
??? caution \\\"Expand To Learn About Collapse\\\"\n\n    This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n\n\n???+ caution \\\"Expand To Learn About Collapse\\\"\n\n    This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse=\"true\"` to collapse it by default or `collapse=\"false\"` to make a collapsible callout that is expanded by default.\n
fixture = \"\"\"\n::: {markdown=1 .callout-note icon=false}\n\nUsing callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n:::\n\n::: {markdown=1 .callout-note appearance=\"minimal\"}\n\nUsing callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n:::\n\"\"\"\n\nexpected = \"\"\"\n!!! note \\\\\"\\\\\"\n\n    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n\n\n!!! note \\\\\"\\\\\"\n\n    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n\n\"\"\"\n\nactual = _fix_callout_syntax(fixture)\nprint(actual)\n\nassert actual == expected, actual\n
!!! note \\\"\\\"\n\n    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n\n\n\n!!! note \\\"\\\"\n\n    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\n
with TemporaryDirectory() as d:\n\n    nbs_path = Path(d) / \"nbs\"\n    nbs_path.mkdir()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    fname = Path(d) / \"nbs\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\"\n    shutil.copyfile(\n        _root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.qmd\",\n        fname,\n    )\n\n    with open(fname, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n\n    actual = _fix_callout_syntax_in_file(contents)\n\n    assert \".callout-note\" not in actual\n    print(actual)\n
---\ntitle: \"Sample\"\nauthor: Sample\n---\n\n## Introduction\n\n!!! note\n\n    Note that there are five types of callouts, including:\n    `note`, `warning`, `important`, `tip`, and `caution`.\n
with TemporaryDirectory() as d:\n\n    nbs_path = Path(d) / \"nbs\"\n    nbs_path.mkdir()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    fname = Path(d) / \"nbs\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\"\n    shutil.copyfile(\n        _root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\",\n        fname,\n    )\n\n    with open(fname, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n\n    actual = _fix_callout_syntax_in_file(contents)\n    display(actual)\n\n    assert \".callout-note\" not in actual\n    assert \".callout-tip\"  not in actual\n    assert 'title=\"Tip with Title\"' not in actual\n    assert 'collapse=\"true\"' not in actual\n    assert 'collapse=\"false\"' not in actual\n    assert 'icon=false' not in actual\n    assert 'appearance=\"minimal' not in actual\n
'{\\n \"cells\": [\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8ee6e33a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"This notebook is used to test the conversion of Quarto to Material for MkDocs syntax. It serves as a fixture to verify the syntax, including callouts, Mermaid charts, and making a section hidden, which differ between Quarto and Material for MkDocs.\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"58c93178\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"# Callouts\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"d0a10ffc\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note\\\\n\",\\n    \"\\\\n\",\\n    \"    Note that there are five types of callouts, including:\\\\n\",\\n    \"    `note`, `warning`, `important`, `tip`, and `caution`.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"22014eb3\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"870e17d7\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"87f34d1a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"??? caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"4a8ac79c\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"???+ caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"034f6dbb\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8f79c54d\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ec9209a4\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"## Mermaid Charts and visibility\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"0a820438\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible when-format=\\\\\"markdown\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in markdown.\\\\n\",\\n    \"\\\\n\",\\n    \":::\\\\n\",\\n    \"\\\\n\",\\n    \"``` mermaid\\\\n\",\\n    \"flowchart LR\\\\n\",\\n    \"    A[Hard edge] --> B(Round edge)\\\\n\",\\n    \"    B --> C{Decision}\\\\n\",\\n    \"    C --> D[Result one]\\\\n\",\\n    \"    C --> E[Result two]\\\\n\",\\n    \"```\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ebd24225\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible when-format=\\\\\"html\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in html.\\\\n\",\\n    \"\\\\n\",\\n    \":::\"\\n   ]\\n  }\\n ],\\n \"metadata\": {\\n  \"kernelspec\": {\\n   \"display_name\": \"Python 3 (ipykernel)\",\\n   \"language\": \"python\",\\n   \"name\": \"python3\"\\n  },\\n  \"language_info\": {\\n   \"codemirror_mode\": {\\n    \"name\": \"ipython\",\\n    \"version\": 3\\n   },\\n   \"file_extension\": \".py\",\\n   \"mimetype\": \"text/x-python\",\\n   \"name\": \"python\",\\n   \"nbconvert_exporter\": \"python\",\\n   \"pygments_lexer\": \"ipython3\",\\n   \"version\": \"3.11.2\"\\n  }\\n },\\n \"nbformat\": 4,\\n \"nbformat_minor\": 5\\n}'\n
with TemporaryDirectory() as d:\n\n    nbs_path = Path(d) / \"nbs\"\n    nbs_path.mkdir()\n\n    _root_path = Path(\".\") if Path(\"settings.ini\").exists() else Path(\"..\")\n    shutil.copyfile(\n        _root_path / \"fixtures\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\",\n        Path(d) / \"nbs\" / \"Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\",\n    )\n    fname = Path(d) / \"nbs/Test_Notebook_For_Quarto_Syntax_Conversion.ipynb\"\n    _update_quarto_tags_to_markdown_format(fname)\n\n    with open(fname, \"r\", encoding=\"utf-8\") as f:\n        contents = f.read()\n\ndisplay(contents)\n\nassert '{markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}' in contents\nassert not '{markdown=1 .content-visible when-format=\"\\\\markdown\\\\\"}' in contents\n\nassert \"mermaid\" in contents\nassert not \"{mermaid}\" in contents\n\nassert '{markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}' in contents\nassert not '{markdown=1 .content-visible when-format=\\\\\"html\\\\\"}' in contents\n\nassert \".callout-note\" not in contents\nassert \".callout-tip\"  not in contents\nassert 'title=\"Tip with Title\"' not in contents\nassert 'collapse=\"true\"' not in contents\nassert 'collapse=\"false\"' not in contents\nassert 'icon=false' not in contents\nassert 'appearance=\"minimal' not in contents\n
'{\\n \"cells\": [\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8ee6e33a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"This notebook is used to test the conversion of Quarto to Material for MkDocs syntax. It serves as a fixture to verify the syntax, including callouts, Mermaid charts, and making a section hidden, which differ between Quarto and Material for MkDocs.\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"58c93178\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"# Callouts\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"d0a10ffc\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note\\\\n\",\\n    \"\\\\n\",\\n    \"    Note that there are five types of callouts, including:\\\\n\",\\n    \"    `note`, `warning`, `important`, `tip`, and `caution`.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"22014eb3\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"870e17d7\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! tip \\\\\\\\\\\\\"Tip with Title\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is a callout with a title.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"87f34d1a\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"??? caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"4a8ac79c\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"???+ caution \\\\\\\\\\\\\"Expand To Learn About Collapse\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    This is an example of a \\'folded\\' caution callout that can be expanded by the user. You can use `collapse=\\\\\"true\\\\\"` to collapse it by default or `collapse=\\\\\"false\\\\\"` to make a collapsible callout that is expanded by default.\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"034f6dbb\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"8f79c54d\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"!!! note \\\\\\\\\\\\\"\\\\\\\\\\\\\"\\\\n\",\\n    \"\\\\n\",\\n    \"    Using callouts is an effective way to highlight content that your reader give special consideration or attention.\\\\n\",\\n    \"\\\\n\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ec9209a4\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"## Mermaid Charts and visibility\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"0a820438\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible unless-format=\\\\\"markdown\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in markdown.\\\\n\",\\n    \"\\\\n\",\\n    \":::\\\\n\",\\n    \"\\\\n\",\\n    \"``` mermaid\\\\n\",\\n    \"flowchart LR\\\\n\",\\n    \"    A[Hard edge] --> B(Round edge)\\\\n\",\\n    \"    B --> C{Decision}\\\\n\",\\n    \"    C --> D[Result one]\\\\n\",\\n    \"    C --> E[Result two]\\\\n\",\\n    \"```\"\\n   ]\\n  },\\n  {\\n   \"cell_type\": \"markdown\",\\n   \"id\": \"ebd24225\",\\n   \"metadata\": {},\\n   \"source\": [\\n    \"::: {markdown=1 .content-visible unless-format=\\\\\"html\\\\\"}\\\\n\",\\n    \"\\\\n\",\\n    \"Will only appear in html.\\\\n\",\\n    \"\\\\n\",\\n    \":::\"\\n   ]\\n  }\\n ],\\n \"metadata\": {\\n  \"kernelspec\": {\\n   \"display_name\": \"Python 3 (ipykernel)\",\\n   \"language\": \"python\",\\n   \"name\": \"python3\"\\n  },\\n  \"language_info\": {\\n   \"codemirror_mode\": {\\n    \"name\": \"ipython\",\\n    \"version\": 3\\n   },\\n   \"file_extension\": \".py\",\\n   \"mimetype\": \"text/x-python\",\\n   \"name\": \"python\",\\n   \"nbconvert_exporter\": \"python\",\\n   \"pygments_lexer\": \"ipython3\",\\n   \"version\": \"3.11.2\"\\n  }\\n },\\n \"nbformat\": 4,\\n \"nbformat_minor\": 5\\n}'\n
"},{"location":"SUMMARY/","title":"SUMMARY","text":"
  • Material for nbdev
  • Guides
    • Basic User Guide
    • Advanced User Guide
      • Adding guides
      • Adding release notes
      • Customizing the sidebar
      • Auto-generating docstrings
      • Setting up social cards
      • Setting up document versioning
      • Handling pandas in the output
      • Advanced customization options
  • API
    • nbdev_mkdocs
      • docstring
        • run_examples_from_docstring
      • mkdocs
        • nbdev_mkdocs_docs
        • new
        • prepare
        • preview
      • social_image_generator
        • generate_social_image
  • CLI
    • nbdev_mkdocs
  • Releases
"},{"location":"Social_Image_Generator/","title":"Social Image Generator","text":"
import unittest.mock\n\nimport pytest\n\nfrom nbdev_mkdocs._testing import mock_openai_Image_create_for_notebook\n
# todo: please ask for openai account with no limit so I can actually test this function\n
mock_openai_Image_create_for_notebook()\n
with TemporaryDirectory() as d:\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", Path(d) / \"settings.ini\")\n\n    user_name = get_value_from_config(d, \"user\")\n    project_name = get_value_from_config(d, \"repo\")\n    project_description = get_value_from_config(d, \"description\")\n\n    image_url = \"https://sample-image.png\"\n    actual = _generate_html_str(d, image_url)\n    print(actual)\n\n    assert f\"{user_name}/\" in actual\n    assert project_name in actual\n    assert image_url in actual\n
<!DOCTYPE html>\n<html>\n    <head>\n        <link rel=\"preload\" href='https://fonts.googleapis.com/css?family=Source Sans Pro' rel='stylesheet'/>\n        <style>\n            body {\n                margin: 0px;\n                width: 1200px;\n                height: 630px;\n                font-family: 'Source Sans Pro', sans-serif;\n            }\n            #container {\n                display: flex;\n                height: 630px;\n                border-radius: 5px;\n                border:1px solid rgba(110, 118, 129, .1);\n            }\n            #container div:first-child{\n                flex-basis: 622px;\n                padding-top: 40px;\n                width: 622px;\n                word-wrap: break-word;\n            }\n            #container div:first-child h1{\n                font-size: 80px;\n                margin: 74px 0px 64px 55px;\n                color: #2E363D;\n                padding-right: 30px;\n            }\n            #container div:first-child h1 span{\n                font-weight: 100;\n            }\n            #container div:first-child p {\n                font-size: 25px;\n                color: #6E7681;\n                margin: 64px 0px 64px 59px;\n                padding-right: 30px;\n            }\n            #container div:last-child img{\n                margin: 60px 59px 59px 4px;\n                border-radius: 50px;\n                width: 512px;\n                height: auto;\n            }\n        </style>\n      </head>\n      <body>\n      <div id=\"container\">\n         <div>\n            <h1><span>airtai/</span>nbdev-mkdocs</h1>\n            <p>Extension of nbdev for generating documentation using Material for Mkdocs instead of Quarto</p>\n         </div>\n         <div>\n            <img src=\"https://sample-image.png\" />\n         </div>\n      </div>\n   </body>\n</html>\n
with TemporaryDirectory() as d:\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", Path(d) / \"settings.ini\")\n\n    user_name = get_value_from_config(d, \"user\")\n    project_name = get_value_from_config(d, \"repo\")\n    project_description = get_value_from_config(d, \"description\")\n\n    image_url = Path(d) / \"sample-image.png\"\n    actual = _generate_html_str(d, image_url)\n    print(actual)\n\n    assert f\"{user_name}/\" in actual\n    assert project_name in actual\n    assert str(image_url) not in actual\n    assert \"sample-image.png\" in actual\n
<!DOCTYPE html>\n<html>\n    <head>\n        <link rel=\"preload\" href='https://fonts.googleapis.com/css?family=Source Sans Pro' rel='stylesheet'/>\n        <style>\n            body {\n                margin: 0px;\n                width: 1200px;\n                height: 630px;\n                font-family: 'Source Sans Pro', sans-serif;\n            }\n            #container {\n                display: flex;\n                height: 630px;\n                border-radius: 5px;\n                border:1px solid rgba(110, 118, 129, .1);\n            }\n            #container div:first-child{\n                flex-basis: 622px;\n                padding-top: 40px;\n                width: 622px;\n                word-wrap: break-word;\n            }\n            #container div:first-child h1{\n                font-size: 80px;\n                margin: 74px 0px 64px 55px;\n                color: #2E363D;\n                padding-right: 30px;\n            }\n            #container div:first-child h1 span{\n                font-weight: 100;\n            }\n            #container div:first-child p {\n                font-size: 25px;\n                color: #6E7681;\n                margin: 64px 0px 64px 59px;\n                padding-right: 30px;\n            }\n            #container div:last-child img{\n                margin: 60px 59px 59px 4px;\n                border-radius: 50px;\n                width: 512px;\n                height: auto;\n            }\n        </style>\n      </head>\n      <body>\n      <div id=\"container\">\n         <div>\n            <h1><span>airtai/</span>nbdev-mkdocs</h1>\n            <p>Extension of nbdev for generating documentation using Material for Mkdocs instead of Quarto</p>\n         </div>\n         <div>\n            <img src=\"sample-image.png\" />\n         </div>\n      </div>\n   </body>\n</html>\n
with TemporaryDirectory() as d:\n    html_path = Path(d) / \"social_image.html\"\n    with open(html_path, \"w\", encoding=\"utf-8\") as f:\n        f.write(\n            \"<html><body><div id = 'container'><p>This is a sample text</p></div></body></html>\"\n        )\n\n    png_path = Path(d) / \"dst_path\" / \"mkdocs\" / \"docs_overrides\" / \"images\"\n    png_path.mkdir(parents=True)\n\n    dst_path = Path(d) / \"dst_path\"\n    await _capture_and_save_screenshot(d, dst_path)\n\n    assert (png_path / \"social_image.png\").exists()\n\n    await _capture_and_save_screenshot(d, dst_path)\n\n    assert (png_path / \"social_image.png\").exists()\n    assert (png_path / \"social_image.1.png\").exists()\n\n    await _capture_and_save_screenshot(d, dst_path)\n\n    assert (png_path / \"social_image.png\").exists()\n    assert (png_path / \"social_image.1.png\").exists()\n    assert (png_path / \"social_image.2.png\").exists()\n\n    (png_path / \"social_image.1.png\").unlink()\n    await _capture_and_save_screenshot(d, dst_path)\n\n    assert (png_path / \"social_image.png\").exists()\n    assert (png_path / \"social_image.2.png\").exists()\n    assert (png_path / \"social_image.3.png\").exists()\n
Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp6uqfce6e/dst_path/mkdocs/docs_overrides/images/social_image.png'\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp6uqfce6e/dst_path/mkdocs/docs_overrides/images/social_image.png'\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp6uqfce6e/dst_path/mkdocs/docs_overrides/images/social_image.png'\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp6uqfce6e/dst_path/mkdocs/docs_overrides/images/social_image.png'\n
with TemporaryDirectory() as d:\n    mkdocs_dir_path = Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\"\n    mkdocs_dir_path.mkdir(parents=True)\n\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"default_social_logo.png\",\n        Path(d) / \"default_social_logo.png\",\n    )\n\n    image_url = (Path(d) / \"default_social_logo.png\").resolve()\n    await _create_social_image(root_path=d, image_url=image_url)\n\n    png_path = mkdocs_dir_path / \"social_image.png\"\n    assert png_path.exists()\n
Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpj_4m6w6w/mkdocs/docs_overrides/images/social_image.png'\n
test_mkdocs_yml = \"\"\"\nsite_name: Test site\ntheme:\n  name: material\nnav:\n- Home:\n  - Home: index.md\nmarkdown_extensions:\n- markdown.extensions.toc:\n    slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}\n    permalink: ''\n- markdown.extensions.admonition:\n- markdown.extensions.smarty:\n    smart_quotes: false\n- pymdownx.betterem:\n- pymdownx.superfences:\n    preserve_tabs: true\n    custom_fences:\n        # Mermaid diagrams\n    - name: diagram\n      class: diagram\n      format:      !%21python/name:pymdownx.superfences.fence_code_format\n    - name: math\n      class: arithmatex\n      format: !%21python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {\n        kwds: {mode: generic, tag: pre}}\n    - name: md-render\n      class: md-render\n      format: !%21python/name:tools.pymdownx_md_render.md_sub_render\n- pymdownx.inlinehilite:\n    custom_inline:\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_inline_format {\n        kwds: {mode: generic}}\n- pymdownx.emoji:\n    emoji_index: !%21python/name:materialx.emoji.twemoji\n    emoji_generator: !%21python/name:materialx.emoji.to_svg\nextra:\n  social_image: \"\"\n\"\"\"\n\nexpected = \"\"\"\nsite_name: Test site\ntheme:\n  name: material\nnav:\n- Home:\n  - Home: index.md\nmarkdown_extensions:\n- markdown.extensions.toc:\n    slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}\n    permalink: ''\n- markdown.extensions.admonition:\n- markdown.extensions.smarty:\n    smart_quotes: false\n- pymdownx.betterem:\n- pymdownx.superfences:\n    preserve_tabs: true\n    custom_fences:\n        # Mermaid diagrams\n    - name: diagram\n      class: diagram\n      format: !!python/name:pymdownx.superfences.fence_code_format\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {\n        kwds: {mode: generic, tag: pre}}\n    - name: md-render\n      class: md-render\n      format: !!python/name:tools.pymdownx_md_render.md_sub_render\n- pymdownx.inlinehilite:\n    custom_inline:\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_inline_format {\n        kwds: {mode: generic}}\n- pymdownx.emoji:\n    emoji_index: !!python/name:materialx.emoji.twemoji\n    emoji_generator: !!python/name:materialx.emoji.to_svg\nextra:\n  social_image: \"\"\n\"\"\"\n\nactual = _unescape_exclamation_mark(test_mkdocs_yml)\n\nprint(actual)\nassert actual == expected\n
site_name: Test site\ntheme:\n  name: material\nnav:\n- Home:\n  - Home: index.md\nmarkdown_extensions:\n- markdown.extensions.toc:\n    slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}\n    permalink: ''\n- markdown.extensions.admonition:\n- markdown.extensions.smarty:\n    smart_quotes: false\n- pymdownx.betterem:\n- pymdownx.superfences:\n    preserve_tabs: true\n    custom_fences:\n        # Mermaid diagrams\n    - name: diagram\n      class: diagram\n      format: !!python/name:pymdownx.superfences.fence_code_format\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {\n        kwds: {mode: generic, tag: pre}}\n    - name: md-render\n      class: md-render\n      format: !!python/name:tools.pymdownx_md_render.md_sub_render\n- pymdownx.inlinehilite:\n    custom_inline:\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_inline_format {\n        kwds: {mode: generic}}\n- pymdownx.emoji:\n    emoji_index: !!python/name:materialx.emoji.twemoji\n    emoji_generator: !!python/name:materialx.emoji.to_svg\nextra:\n  social_image: \"\"\n
with TemporaryDirectory() as d:\n    mkdocs_path = Path(d) / \"mkdocs\"\n    mkdocs_path.mkdir(parents=True, exist_ok=True)\n\n    mkdocs_yml_path = mkdocs_path / \"mkdocs.yml\"\n    with mkdocs_yml_path.open(\"w\") as f:\n        f.write(test_mkdocs_yml)\n\n    def _f():\n        with _read_yaml_file(mkdocs_yml_path) as (yaml, config):\n            assert type(yaml) == YAML\n\n    _f()\n\nwith pytest.raises(NameError) as e:\n    print(yaml)\nprint(e.value)\n
name 'yaml' is not defined\n
with TemporaryDirectory() as d:\n    mkdocs_dir_path = Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\"\n    mkdocs_dir_path.mkdir(parents=True)\n\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"default_social_logo.png\",\n        Path(d) / \"default_social_logo.png\",\n    )\n\n    image_url = (Path(d) / \"default_social_logo.png\").resolve()\n    await _create_social_image(root_path=d, image_url=image_url)\n\n    png_path = mkdocs_dir_path / \"social_image.png\"\n    assert png_path.exists()\n\n    mkdocs_yml_path = Path(d) / \"mkdocs\" / \"mkdocs.yml\"\n    with mkdocs_yml_path.open(\"w\") as f:\n        f.write(test_mkdocs_yml)\n\n    for image_url in [\"https://my-random-domain/sample.png\", str(Path(d) / \"sample-image.png\")]:\n        _update_social_image_in_mkdocs_yml(d, image_url)\n        yaml = YAML()\n        config = yaml.load((Path(d) / \"mkdocs/mkdocs.yml\"))\n        print(config[\"extra\"][\"social_image\"])\n        assert (\n        config[\"extra\"][\"social_image\"] == \"overrides/images/social_image.png\"\n    ), config[\"extra\"][\"social_image\"]\n\n    image_url = \"https://opengraph.githubassets.com/13123.123/user/repo/sample.png\"\n    _update_social_image_in_mkdocs_yml(d, image_url)\n\n    yaml = YAML()\n    config = yaml.load((Path(d) / \"mkdocs/mkdocs.yml\"))\n    print(config[\"extra\"][\"social_image\"])\n    assert (\n        config[\"extra\"][\"social_image\"] == image_url\n    ), config[\"extra\"][\"social_image\"]\n\n    with mkdocs_yml_path.open(\"r\") as f:\n        contents = f.read()\n\n    print(contents)\n    assert \"!%21\" not in contents\n
Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpc1i3ujc1/mkdocs/docs_overrides/images/social_image.png'\noverrides/images/social_image.png\noverrides/images/social_image.png\nhttps://opengraph.githubassets.com/13123.123/user/repo/sample.png\nsite_name: Test site\ntheme:\n  name: material\nnav:\n- Home:\n  - Home: index.md\nmarkdown_extensions:\n- markdown.extensions.toc:\n    slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}\n    permalink: ''\n- markdown.extensions.admonition:\n- markdown.extensions.smarty:\n    smart_quotes: false\n- pymdownx.betterem:\n- pymdownx.superfences:\n    preserve_tabs: true\n    custom_fences:\n        # Mermaid diagrams\n    - name: diagram\n      class: diagram\n      format: !!python/name:pymdownx.superfences.fence_code_format\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {\n        kwds: {mode: generic, tag: pre}}\n    - name: md-render\n      class: md-render\n      format: !!python/name:tools.pymdownx_md_render.md_sub_render\n- pymdownx.inlinehilite:\n    custom_inline:\n    - name: math\n      class: arithmatex\n      format: !!python/object/apply:pymdownx.arithmatex.arithmatex_inline_format {\n        kwds: {mode: generic}}\n- pymdownx.emoji:\n    emoji_index: !!python/name:materialx.emoji.twemoji\n    emoji_generator: !!python/name:materialx.emoji.to_svg\nextra:\n  social_image: \"https://opengraph.githubassets.com/13123.123/user/repo/sample.png\"\n
with TemporaryDirectory() as d:\n    site_overrides_path = Path(d) / \"mkdocs\" / \"site_overrides\"\n    site_overrides_path.mkdir(exist_ok=True, parents=True)\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"site_overrides\" / \"main.html\",\n        (site_overrides_path / \"main.html\"),\n    )\n\n    _update_social_image_in_site_overrides(d)\n    with open((site_overrides_path / \"main.html\"), \"r\", encoding=\"utf-8\") as f:\n        actual = f.read()\n\n    print(actual)\n\n    assert (\n        '{% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}'\n        in actual\n    ), actual\n
{% extends \"base.html\" %}\n\n{% block extrahead %}\n  {% set title = config.site_name %}\n  {% if page and page.meta and page.meta.title %}\n    {% set title = title ~ \" - \" ~ page.meta.title %}\n  {% elif page and page.title and not page.is_homepage %}\n    {% set title = title ~ \" - \" ~ page.title | striptags %}\n  {% endif %}\n  {% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}\n  <meta property=\"og:type\" content=\"website\" />\n  <meta property=\"og:title\" content=\"{{ title }}\" />\n  <meta property=\"og:description\" content=\"{{ config.site_description }}\" />\n  <meta property=\"og:url\" content=\"{{ page.canonical_url }}\" />\n  <meta property=\"og:image\" content=\"{{ image_url }}\" />\n  <meta property=\"og:image:type\" content=\"image/png\" />\n  <meta property=\"og:image:width\" content=\"1200\" />\n  <meta property=\"og:image:height\" content=\"630\" />\n\n  <meta name=\"twitter:card\" content=\"summary_large_image\" />\n  <meta name=\"twitter:title\" content=\"{{ title }}\" />\n  <meta name=\"twitter:description\" content=\"{{ config.site_description }}\" />\n  <meta name=\"twitter:image\" content=\"{{ image_url }}\" />\n{% endblock %}\n\n{% block outdated %}\n  You're not viewing the latest version.\n  <a href=\"{{ '../' ~ base_url }}\">\n    <strong>Click here to go to latest.</strong>\n  </a>\n{% endblock %}\n
with TemporaryDirectory() as d:\n    with pytest.raises(ValueError) as e:\n        generator = \"random_name\"\n        image_path = None\n        prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n        _generate_image_url(d, generator, prompt)\n\n    print(e.value)\n
Invalid Option for generator. Valid options are: 'file' and 'dall_e'\n
with TemporaryDirectory() as d:\n    prompt = \"The quick brown fox jumps over a lazy dog\"\n    generator = \"dall_e\"\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n\n    _generate_image_url(root_path=d, generator=generator, prompt=prompt)\n\n#     with pytest.raises(Exception) as e:\n#     print(e.value)\n
with TemporaryDirectory() as d:\n    generator = \"file\"\n    image_path = \"invalid_image_path.png\"\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n    with pytest.raises(typer.Exit) as e:\n        _generate_image_url(\n            root_path=d, generator=generator, prompt=prompt, image_path=image_path\n        )\n\n    print(e.value)\n
Unexpected error: path /private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpy1rehpkv/invalid_image_path.png does not exists!\n
with TemporaryDirectory() as d:\n    prompt = \"The quick brown fox jumps over a lazy dog\"\n    generator = \"file\"\n    image_path = \"./valid_image_path.png\"\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"airt_icon_blue.svg\",\n        Path(d) / \"valid_image_path.png\",\n    )\n\n    image_url = _generate_image_url(\n        root_path=d, generator=generator, prompt=prompt, image_path=image_path\n    )\n\n    print(image_url)\n\n    assert image_url == str(Path(d).resolve() / image_path), str(\n        Path(d).resolve() / image_path\n    )\n
/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpyey8qlcd/valid_image_path.png\n
with TemporaryDirectory() as d:\n    shutil.copyfile(\n        Path(\"..\") / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"airt_icon_blue.svg\",\n        Path(d) / \"valid_image_path.png\",\n    )\n\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n    generator = \"file\"\n\n    d_tmp = Path(d) / \"tmp\"\n    d_tmp.mkdir(parents=True)\n\n    image_path = \"../valid_image_path.png\"\n\n    image_url = _generate_image_url(\n        root_path=d_tmp, generator=generator, prompt=prompt, image_path=image_path\n    )\n\n    print(image_url)\n\n    assert image_url == str(Path(d).resolve() / \"valid_image_path.png\"), str(\n        Path(d).resolve() / \"valid_image_path.png\"\n    )\n
/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmppxyhbfkx/valid_image_path.png\n
with TemporaryDirectory() as d:\n    generator = \"file\"\n    prompt = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\"\n    image_url = _generate_image_url(root_path=d, generator=generator, prompt=prompt)\n    print(image_url)\n    assert image_url == str(\n        (\n            Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\" / \"default_social_logo.png\"\n        ).resolve()\n    ), image_url\n
/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpghmlcy1v/mkdocs/docs_overrides/images/default_social_logo.png\n

source

"},{"location":"Social_Image_Generator/#generate_social_image","title":"generate_social_image","text":"
 generate_social_image (root_path:str, generator:str='file',\n                        prompt:str='Cute animal wearing hoodie sitting in\n                        high chair in purple room, browsing computer, 3d\n                        render', image_path:Optional[str]=None)\n

Generate a custom image for social card using the OpenAI Image API.

Args: root_path: The root path of the project. generator: Generator to use to create the social image. Valid options are: \u2018file\u2019 and \u2018dall_e\u2019. prompt: The prompt to use for generating the image. image_path: Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

for generator in [\"file\", \"dall_e\"]:\n    print(\"*\" * 120)\n    with TemporaryDirectory() as d:\n        mkdocs_dir_path = Path(d) / \"mkdocs\" / \"docs_overrides\" / \"images\"\n        mkdocs_dir_path.mkdir(exist_ok=True, parents=True)\n\n        mkdocs_yml_path = Path(d) / \"mkdocs\"\n        shutil.copyfile(\n            Path(\"..\") / \"mkdocs\" / \"mkdocs.yml\", (mkdocs_yml_path / \"mkdocs.yml\")\n        )\n\n        site_overrides_path = Path(d) / \"mkdocs\" / \"site_overrides\"\n        site_overrides_path.mkdir(exist_ok=True, parents=True)\n        shutil.copyfile(\n            Path(\"..\") / \"mkdocs\" / \"site_overrides\" / \"main.html\",\n            (site_overrides_path / \"main.html\"),\n        )\n\n        shutil.copyfile(\n            Path(\"..\")\n            / \"mkdocs\"\n            / \"docs_overrides\"\n            / \"images\"\n            / \"default_social_logo.png\",\n            mkdocs_dir_path / \"default_social_logo.png\",\n        )\n\n        prompt = \"The quick brown fox jumps over a lazy dog\"\n        await generate_social_image(root_path=d, prompt=prompt, generator=generator)\n\n        png_path = mkdocs_dir_path / \"social_image.png\"\n\n        assert png_path.exists()\n\n        yaml = YAML()\n        config = yaml.load((Path(d) / \"mkdocs/mkdocs.yml\"))\n        print(config[\"extra\"][\"social_image\"])\n        assert (\n            config[\"extra\"][\"social_image\"] == \"overrides/images/social_image.png\"\n        ), config[\"extra\"][\"social_image\"]\n\n        with open((site_overrides_path / \"main.html\"), \"r\", encoding=\"utf-8\") as f:\n            actual = f.read()\n        print(actual)\n        assert (\n            '{% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}'\n            in actual\n        ), actual\n
************************************************************************************************************************\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpviw_z2gw/mkdocs/docs_overrides/images/social_image.png'\noverrides/images/social_image.png\n{% extends \"base.html\" %}\n\n{% block extrahead %}\n  {% set title = config.site_name %}\n  {% if page and page.meta and page.meta.title %}\n    {% set title = title ~ \" - \" ~ page.meta.title %}\n  {% elif page and page.title and not page.is_homepage %}\n    {% set title = title ~ \" - \" ~ page.title | striptags %}\n  {% endif %}\n  {% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}\n  <meta property=\"og:type\" content=\"website\" />\n  <meta property=\"og:title\" content=\"{{ title }}\" />\n  <meta property=\"og:description\" content=\"{{ config.site_description }}\" />\n  <meta property=\"og:url\" content=\"{{ page.canonical_url }}\" />\n  <meta property=\"og:image\" content=\"{{ image_url }}\" />\n  <meta property=\"og:image:type\" content=\"image/png\" />\n  <meta property=\"og:image:width\" content=\"1200\" />\n  <meta property=\"og:image:height\" content=\"630\" />\n\n  <meta name=\"twitter:card\" content=\"summary_large_image\" />\n  <meta name=\"twitter:title\" content=\"{{ title }}\" />\n  <meta name=\"twitter:description\" content=\"{{ config.site_description }}\" />\n  <meta name=\"twitter:image\" content=\"{{ image_url }}\" />\n{% endblock %}\n\n{% block outdated %}\n  You're not viewing the latest version.\n  <a href=\"{{ '../' ~ base_url }}\">\n    <strong>Click here to go to latest.</strong>\n  </a>\n{% endblock %}\n\n\n\n************************************************************************************************************************\nSocial share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp3j5_bo6n/mkdocs/docs_overrides/images/social_image.png'\noverrides/images/social_image.png\n{% extends \"base.html\" %}\n\n{% block extrahead %}\n  {% set title = config.site_name %}\n  {% if page and page.meta and page.meta.title %}\n    {% set title = title ~ \" - \" ~ page.meta.title %}\n  {% elif page and page.title and not page.is_homepage %}\n    {% set title = title ~ \" - \" ~ page.title | striptags %}\n  {% endif %}\n  {% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}\n  <meta property=\"og:type\" content=\"website\" />\n  <meta property=\"og:title\" content=\"{{ title }}\" />\n  <meta property=\"og:description\" content=\"{{ config.site_description }}\" />\n  <meta property=\"og:url\" content=\"{{ page.canonical_url }}\" />\n  <meta property=\"og:image\" content=\"{{ image_url }}\" />\n  <meta property=\"og:image:type\" content=\"image/png\" />\n  <meta property=\"og:image:width\" content=\"1200\" />\n  <meta property=\"og:image:height\" content=\"630\" />\n\n  <meta name=\"twitter:card\" content=\"summary_large_image\" />\n  <meta name=\"twitter:title\" content=\"{{ title }}\" />\n  <meta name=\"twitter:description\" content=\"{{ config.site_description }}\" />\n  <meta name=\"twitter:image\" content=\"{{ image_url }}\" />\n{% endblock %}\n\n{% block outdated %}\n  You're not viewing the latest version.\n  <a href=\"{{ '../' ~ base_url }}\">\n    <strong>Click here to go to latest.</strong>\n  </a>\n{% endblock %}\n
"},{"location":"Testing/","title":"Testing","text":"
import openai\n
"},{"location":"Testing/#mock_openai_image_create_for_notebook","title":"mock_openai_Image_create_for_notebook","text":"
 mock_openai_Image_create_for_notebook ()\n
"},{"location":"Testing/#mock_openai_image_create","title":"mock_openai_Image_create","text":"
 mock_openai_Image_create ()\n
with mock_openai_Image_create():\n    url = openai.Image.create(prompt=\"whatever\", n=1, size=\"512x512\")[\"data\"][0][\"url\"]\n\nassert (\n    url\n    == \"https://github.com/airtai/nbdev-mkdocs/raw/main/mkdocs/docs_overrides/images/default_social_logo.png\"\n)\n
mock_openai_Image_create_for_notebook()\n
url = openai.Image.create(prompt=\"whatever\", n=1, size=\"512x512\")[\"data\"][0][\"url\"]\n\nassert (\n    url\n    == \"https://github.com/airtai/nbdev-mkdocs/raw/main/mkdocs/docs_overrides/images/default_social_logo.png\"\n)\n
"},{"location":"Utils/","title":"Utils","text":"
import shutil\nfrom tempfile import TemporaryDirectory\n\nimport numpy as np\nimport pytest\n

source

"},{"location":"Utils/#set_cwd","title":"set_cwd","text":"
 set_cwd (cwd_path:Union[pathlib.Path,str])\n

Set the current working directory for the duration of the context manager.

Args: cwd_path: The path to the new working directory.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    with set_cwd(d):\n        assert (\n            Path(os.getcwd()) == Path(d).resolve()\n        ), f\"{os.getcwd()}, {Path(d).resolve()}\"\n

source

"},{"location":"Utils/#get_value_from_config","title":"get_value_from_config","text":"
 get_value_from_config (root_path:str, config_name:str)\n

Get a value from the configuration file.

Args: root_path: The root path of the configuration file. config_name: The name of the configuration to get.

Returns: The value of the configuration.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    settings_path = Path(d) / \"settings.ini\"\n    shutil.copyfile(Path(\"..\") / \"settings.ini\", settings_path)\n    ret_val = get_value_from_config(d, \"lib_path\")\n    print(ret_val)\n    assert ret_val == \"nbdev_mkdocs\", ret_val\n\n    ret_val = get_value_from_config(d, \"repo\")\n    print(ret_val)\n    assert ret_val == \"nbdev-mkdocs\", ret_val\n\n    ret_val = get_value_from_config(d, \"user\")\n    print(ret_val)\n    assert ret_val == \"airtai\", ret_val\n
nbdev_mkdocs\nnbdev-mkdocs\nairtai\n

source

"},{"location":"Utils/#is_local_path","title":"is_local_path","text":"
 is_local_path (path:str)\n

Check if a path is a local path.

Args: path: The path to check.

Returns: True if the path is a local path, False otherwise.

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

assert is_local_path(\"/tmp/abc/file.txt\")\nassert not is_local_path(\"http://www.example.com\")\n

source

"},{"location":"Utils/#add_counter_suffix_to_filename","title":"add_counter_suffix_to_filename","text":"
 add_counter_suffix_to_filename (src_path:pathlib.Path)\n

Add a counter suffix to the given file

Args: src_path: Path to the file to be renamed

Returns: None

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

with TemporaryDirectory() as d:\n    file_path = Path(d) / \"social_image.txt\"\n    with open(file_path, \"w\", encoding=\"utf-8\") as f:\n        f.write(\"sample_text\")\n\n    add_counter_suffix_to_filename(file_path)\n\n    actual = [f.name for f in Path(d).glob(f\"{file_path.stem}*.*\")]\n    print(actual)\n\n    expected = [\"social_image.1.txt\"]\n    np.testing.assert_array_equal(actual, expected)\n\n    assert not file_path.exists()\n    assert (Path(d) / \"social_image.1.txt\").exists()\n
['social_image.1.txt']\n
with TemporaryDirectory() as d:\n    for i in [\n        \"social_image.txt\",\n        \"social_image.1.txt\",\n        \"social_image.2.txt\",\n        \"social_image.11.txt\",\n    ]:\n        file_path = Path(d) / i\n        with open(file_path, \"w\", encoding=\"utf-8\") as f:\n            f.write(\"sample_text\")\n\n    file_path = Path(d) / \"social_image.txt\"\n    add_counter_suffix_to_filename(file_path)\n\n    actual = sorted([f.name for f in Path(d).glob(f\"{file_path.stem}*.*\")])\n    print(actual)\n    expected = sorted(\n        [\n            \"social_image.1.txt\",\n            \"social_image.2.txt\",\n            \"social_image.11.txt\",\n            \"social_image.12.txt\",\n        ]\n    )\n    np.testing.assert_array_equal(actual, expected)\n\n    assert not file_path.exists()\n    assert (Path(d) / \"social_image.12.txt\").exists()\n
['social_image.1.txt', 'social_image.11.txt', 'social_image.12.txt', 'social_image.2.txt']\n

source

"},{"location":"Utils/#raise_error_and_exit","title":"raise_error_and_exit","text":"
 raise_error_and_exit (message:str)\n

Raise an error and exit

Args: message: The error message to display

Returns: None

Raises: typer.Exit: If the error message is not provided

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

with pytest.raises(typer.Exit) as e:\n    raise_error_and_exit(\"testing!!!\")\n
testing!!!\n
"},{"location":"api/nbdev_mkdocs/docstring/run_examples_from_docstring/","title":"run_examples_from_docstring","text":""},{"location":"api/nbdev_mkdocs/docstring/run_examples_from_docstring/#nbdev_mkdocs.docstring.run_examples_from_docstring","title":"nbdev_mkdocs.docstring.run_examples_from_docstring(o: Any, *, supress_stdout: bool = False, supress_stderr: bool = False, sub_dict: Optional[Dict[str, str]] = None, width: Optional[int] = 80, **kwargs: str) -> None","text":"

Runs example from a docstring

Parses docstring of an objects looking for examples. The examples are then saved into files and executed in a separate process.

Note

Execution context is not the same as the one in the notebook because we want examples to work from user code. Make sure you compiled the library prior to executing the examples, otherwise you might be running them agains an old version of the library.

Parameters:

Name Type Description Default o Any

an object, typically a function or a class, for which docstring is being parsed for examples

required supress_stdout bool

omit stdout from output, typically due to security considerations

False supress_stderr bool

omit stderr from output, typically due to security considerations

False sub_dict Optional[Dict[str, str]]

a dictionary mapping regexp patterns into replacement strings used to mask stdout and stderr, typically used to mask sensitive information such as passwords

None **kwargs str

arguments use to replace \"{fill in param}\" in docstring with the actual values when running examples

{}

Raises:

Type Description ValueError

if some params are missing from the kwargs

RuntimeException

if example fails

Example
from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\ndef f():\n    ```python\n    Example:\n        print(\"Hello {fill in name}!\")\n        print(\"Goodbye {fill in other_name}!\")\n    ```\n    pass\n\n\nrun_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")\n

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/docstring.py
def run_examples_from_docstring(\n    o: Any,\n    *,\n    supress_stdout: bool = False,\n    supress_stderr: bool = False,\n    sub_dict: Optional[Dict[str, str]] = None,\n    width: Optional[int] = 80,\n    **kwargs: str,\n) -> None:\n    \"\"\"Runs example from a docstring\n\n    Parses docstring of an objects looking for examples. The examples are then saved into files and executed\n    in a separate process.\n\n    Note:\n        Execution context is not the same as the one in the notebook because we want examples to work from\n        user code. Make sure you compiled the library prior to executing the examples, otherwise you might\n        be running them agains an old version of the library.\n\n    Args:\n        o: an object, typically a function or a class, for which docstring is being parsed for examples\n        supress_stdout: omit stdout from output, typically due to security considerations\n        supress_stderr: omit stderr from output, typically due to security considerations\n        sub_dict: a dictionary mapping regexp patterns into replacement strings used to mask stdout and\n            stderr, typically used to mask sensitive information such as passwords\n\n        **kwargs: arguments use to replace \"{fill in **param**}\" in docstring with the actual values when running examples\n\n    Raises:\n        ValueError: if some params are missing from the **kwargs**\n        RuntimeException: if example fails\n\n    Example:\n        ```python\n        from  nbdev_mkdocs.docstring import run_examples_from_docstring\n\n        def f():\n            ```python\n            Example:\n                print(\"Hello {fill in name}!\")\n                print(\"Goodbye {fill in other_name}!\")\n            ```\n            pass\n\n\n        run_examples_from_docstring(f, name=\"John\", other_name=\"Jane\")\n        ```\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    console = Console(width=width)\n\n    examples = _extract_examples_from_docstring(o)\n    if len(examples) == 0:\n        raise ValueError(f\"No examples found in:\\n{o.__doc__}\")\n\n    executable_examples = _replace_keywords(examples, **kwargs)\n    for example, executable_example in zip(examples, executable_examples):\n        with TemporaryDirectory() as d:\n            cmd_path = (Path(d) / \"example.py\").absolute()\n            with open(cmd_path, \"w\", encoding=\"utf-8\") as f:\n                f.write(executable_example)\n            process = run(  # nosec: B603\n                [sys.executable, str(cmd_path)], capture_output=True, text=True\n            )\n            group = Group(\n                \"Example:\",\n                Rule(\"code\"),\n                textwrap.indent(example, \" \" * 4),\n                _format_output(\n                    process.stdout,\n                    title=\"stdout\",\n                    supress=supress_stdout,\n                    sub_dict=sub_dict,\n                    width=width,\n                ),\n                _format_output(\n                    process.stderr,\n                    title=\"stderr\",\n                    supress=supress_stderr,\n                    sub_dict=sub_dict,\n                    width=width,\n                ),\n            )\n            #             print(Panel(panel_group, width=width))\n            console.print(group)\n            if process.returncode != 0:\n                raise RuntimeError(process.stderr)\n
"},{"location":"api/nbdev_mkdocs/mkdocs/nbdev_mkdocs_docs/","title":"nbdev_mkdocs_docs","text":""},{"location":"api/nbdev_mkdocs/mkdocs/nbdev_mkdocs_docs/#nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs","title":"nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs(root_path: str, refresh_quarto_settings: bool = False, use_relative_doc_links: bool = False, no_mkdocs_build: bool = False) -> None","text":"

Prepare mkdocs documentation

Parameters:

Name Type Description Default root_path str

The root path of the project

required refresh_quarto_settings bool

Flag to refresh quarto yml file. This flag should be set to True if this function is called directly without calling prepare.

False use_relative_doc_links bool

If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview.

False no_mkdocs_build bool

If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview.

False

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
def nbdev_mkdocs_docs(\n    root_path: str,\n    refresh_quarto_settings: bool = False,\n    use_relative_doc_links: bool = False,\n    no_mkdocs_build: bool = False,\n) -> None:\n    \"\"\"Prepare mkdocs documentation\n\n    Args:\n        root_path: The root path of the project\n        refresh_quarto_settings: Flag to refresh quarto yml file. This flag should be set to `True`\n            if this function is called directly without calling prepare.\n        use_relative_doc_links: If set to True, relative links are added to symbol references in generated\n            documentation. Else, the value set in doc_host in settings.ini is added to symbol references in\n            generated documentation. This flag should be set to `False` if this function is called directly\n            without calling preview.\n        no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag should be set to\n            `False` if this function is called directly without calling preview.\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    with set_cwd(root_path):\n        if refresh_quarto_settings:\n            refresh_quarto_yml()\n\n        _copy_cname_if_needed(root_path)\n\n        _copy_docs_overrides(root_path)\n\n        lib_name = get_value_from_config(root_path, \"lib_name\")\n        lib_path = get_value_from_config(root_path, \"lib_path\")\n\n        cache_path = proc_nbs(force=True)\n        nbdev_lookup = NbdevLookup(incl_libs=lib_name.replace(\"_\", \"-\"))\n        docs_versioning = get_value_from_config(root_path, \"docs_versioning\")\n        lib_version = get_value_from_config(root_path, \"version\")\n        _fix_sym_links_in_nbs(\n            root_path,\n            cache_path,\n            nbdev_lookup,\n            docs_versioning,\n            lib_version,\n            use_relative_doc_links,\n        )\n\n        _build_summary(root_path, lib_path, cache_path)\n\n        if not no_mkdocs_build:\n            cmd = f\"mkdocs build -f \\\"{(Path(root_path) / 'mkdocs' / 'mkdocs.yml').resolve()}\\\"\"\n            _sprun(cmd)\n
"},{"location":"api/nbdev_mkdocs/mkdocs/new/","title":"new","text":""},{"location":"api/nbdev_mkdocs/mkdocs/new/#nbdev_mkdocs.mkdocs.new","title":"nbdev_mkdocs.mkdocs.new(root_path: str) -> None","text":"

Initialize mkdocs project files

Creates mkdocs directory in the root_path directory and populates it with initial values. You should edit mkdocs.yml file to customize it if needed.

Parameters:

Name Type Description Default root_path str

The path to the root of the project

required

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
def new(root_path: str) -> None:\n    \"\"\"Initialize mkdocs project files\n\n    Creates **mkdocs** directory in the **root_path** directory and populates\n    it with initial values. You should edit mkdocs.yml file to customize it if\n    needed.\n\n    Args:\n        root_path: The path to the root of the project\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    _create_mkdocs_dir(root_path)\n    _create_mkdocs_yaml(root_path)\n    _create_summary_template(root_path)\n    _replace_ghp_deploy_action(root_path)\n    _update_gitignore_file(root_path)\n    _generate_default_social_image_link(root_path)\n
"},{"location":"api/nbdev_mkdocs/mkdocs/prepare/","title":"prepare","text":""},{"location":"api/nbdev_mkdocs/mkdocs/prepare/#nbdev_mkdocs.mkdocs.prepare","title":"nbdev_mkdocs.mkdocs.prepare(root_path: str, use_relative_doc_links: bool = False, no_test: bool = False, no_mkdocs_build: bool = False) -> None","text":"

Prepare mkdocs for serving

Parameters:

Name Type Description Default root_path str

The root path of the project

required use_relative_doc_links bool

If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview.

False no_test bool

If set to False, the unit tests will be run, else they will be skipped

False no_mkdocs_build bool

If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview

False

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
def prepare(\n    root_path: str,\n    use_relative_doc_links: bool = False,\n    no_test: bool = False,\n    no_mkdocs_build: bool = False,\n) -> None:\n    \"\"\"Prepare mkdocs for serving\n\n    Args:\n        root_path: The root path of the project\n        use_relative_doc_links: If set to True, relative links are added to symbol references in generated\n            documentation. Else, the value set in doc_host in settings.ini is added to symbol references in\n            generated documentation. This flag should be set to `False` if this function is called directly\n            without calling preview.\n        no_test: If set to False, the unit tests will be run, else they will be skipped\n        no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag\n            should be set to `False` if this function is called directly without calling preview\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    with set_cwd(root_path):\n        if no_test:\n            nbdev_export.__wrapped__()\n            refresh_quarto_yml()\n        else:\n            nbdev_export.__wrapped__()\n            nbdev_test.__wrapped__()\n            nbdev_clean.__wrapped__()\n            refresh_quarto_yml()\n\n    nbdev_mkdocs_docs(\n        root_path=root_path,\n        use_relative_doc_links=use_relative_doc_links,\n        no_mkdocs_build=no_mkdocs_build,\n    )\n
"},{"location":"api/nbdev_mkdocs/mkdocs/preview/","title":"preview","text":""},{"location":"api/nbdev_mkdocs/mkdocs/preview/#nbdev_mkdocs.mkdocs.preview","title":"nbdev_mkdocs.mkdocs.preview(root_path: str, use_relative_doc_links: bool, port: Optional[int] = None) -> None","text":"

Preview the mkdocs documentation.

Parameters:

Name Type Description Default root_path str

The root path of the documentation.

required use_relative_doc_links bool

If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation.

required port Optional[int]

The port to serve the documentation on.

None

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
def preview(\n    root_path: str, use_relative_doc_links: bool, port: Optional[int] = None\n) -> None:\n    \"\"\"Preview the mkdocs documentation.\n\n    Args:\n        root_path: The root path of the documentation.\n        use_relative_doc_links: If set to True, relative links are added to symbol references in generated\n            documentation. Else, the value set in doc_host in settings.ini is added to symbol references in\n            generated documentation.\n        port: The port to serve the documentation on.\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    with set_cwd(root_path):\n        prepare(\n            root_path=root_path,\n            use_relative_doc_links=use_relative_doc_links,\n            no_test=True,\n            no_mkdocs_build=True,\n        )\n\n        cmd = f\"mkdocs serve -f {root_path}/mkdocs/mkdocs.yml -a 0.0.0.0\"\n        if port:\n            cmd = cmd + f\":{port}\"\n\n        with subprocess.Popen(  # nosec B603:subprocess_without_shell_equals_true\n            shlex.split(cmd),\n            stdout=subprocess.PIPE,\n            bufsize=1,\n            text=True,\n            universal_newlines=True,\n        ) as p:\n            for line in p.stdout:  # type: ignore\n                print(line, end=\"\")\n\n        if p.returncode != 0:\n            typer.secho(\n                f\"Command cmd='{cmd}' failed!\",\n                err=True,\n                fg=typer.colors.RED,\n            )\n            raise typer.Exit(6)\n
"},{"location":"api/nbdev_mkdocs/social_image_generator/generate_social_image/","title":"generate_social_image","text":""},{"location":"api/nbdev_mkdocs/social_image_generator/generate_social_image/#nbdev_mkdocs.social_image_generator.generate_social_image","title":"nbdev_mkdocs.social_image_generator.generate_social_image(root_path: str, generator: str = 'file', prompt: str = 'Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render', image_path: Optional[str] = None) -> None async","text":"

Generate a custom image for social card using the OpenAI Image API.

Parameters:

Name Type Description Default root_path str

The root path of the project.

required generator str

Generator to use to create the social image. Valid options are: 'file' and 'dall_e'.

'file' prompt str

The prompt to use for generating the image.

'Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render' image_path Optional[str]

Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used.

None

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/social_image_generator.py
async def generate_social_image(\n    root_path: str,\n    generator: str = \"file\",\n    prompt: str = \"Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render\",\n    image_path: Optional[str] = None,\n) -> None:\n    \"\"\"Generate a custom image for social card using the OpenAI Image API.\n\n    Args:\n        root_path: The root path of the project.\n        generator: Generator to use to create the social image. Valid options are: 'file' and 'dall_e'.\n        prompt: The prompt to use for generating the image.\n        image_path: Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used.\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    image_url = _generate_image_url(root_path, generator, prompt, image_path)\n\n    await _create_social_image(root_path, image_url)\n\n    _update_social_image_in_mkdocs_yml(root_path, image_url)\n\n    _update_social_image_in_site_overrides(root_path)\n
"},{"location":"cli/nbdev_mkdocs/","title":"nbdev_mkdocs","text":"

Usage:

$ nbdev_mkdocs [OPTIONS] COMMAND [ARGS]...\n

Options:

  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

Commands:

  • delete-pre-release-docs: Deletes deployed pre-release documentation...
  • docs: Prepares files in 'mkdocs/docs' and then...
  • docstring: Command for adding docstrings to classes...
  • new: Creates files in 'mkdocs' subdirectory...
  • prepare: Runs tests and prepares files in...
  • preview: Prepares files in 'mkdocs/docs' and then...
  • readme: Updates the README.md file from the...
  • social-image: Command for generating a custom social...
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-delete-pre-release-docs","title":"nbdev_mkdocs delete-pre-release-docs","text":"

Deletes deployed pre-release documentation versions.

Usage:

$ nbdev_mkdocs delete-pre-release-docs [OPTIONS]\n

Options:

  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-docs","title":"nbdev_mkdocs docs","text":"

Prepares files in 'mkdocs/docs' and then runs 'mkdocs build' command on them.

Usage:

$ nbdev_mkdocs docs [OPTIONS]\n

Options:

  • --root-path TEXT: Project's root path. [default: .]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-docstring","title":"nbdev_mkdocs docstring","text":"

Command for adding docstrings to classes and methods that don't have one using docstring-gen library.

Usage:

$ nbdev_mkdocs docstring [OPTIONS] COMMAND [ARGS]...\n

Options:

  • --help: Show this message and exit.

Commands:

  • generate: Add docstring to classes and methods that...
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-docstring-generate","title":"nbdev_mkdocs docstring generate","text":"

Add docstring to classes and methods that don't have one using docstring-gen library.

Usage:

$ nbdev_mkdocs docstring generate [OPTIONS]\n

Options:

  • -p, --path TEXT: The path to the directory containing Jupyter notebooks. If None, then the \"nbs_path\" from the settings.ini will be used.
  • --include-auto-gen-txt / --no-include-auto-gen-txt: If set to True, a note indicating that the docstring was autogenerated by docstring-gen library will be added to the end. [default: include-auto-gen-txt]
  • -f, --force-recreate-auto-generated: If set to True, the autogenerated docstrings from the previous runs will be replaced with the new one.
  • --model TEXT: The name of the OpenAI model that will be used to generate docstrings. [default: gpt-3.5-turbo]
  • --temperature FLOAT RANGE: Setting the temperature close to zero produces better results, whereas higher temperatures produce more complex, and sometimes irrelevant docstrings. [default: 0.2; 0.0<=x<=2.0]
  • --max-tokens INTEGER: The maximum number of tokens to be used when generating a docstring for a function or class. Please note that a higher number will deplete your token quota faster. [default: 250]
  • --top-p FLOAT RANGE: You can also specify a top-P value from 0-1 to achieve similar results to changing the temperature. According to the Open AI documentation, it is generally recommended to change either this or the temperature but not both. [default: 1.0; 0.0<=x<=1.0]
  • --n INTEGER: The number of docstrings to be generated for each function or class, with the best one being added to the source code. Please note that a higher number will deplete your token quota faster. [default: 3]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-new","title":"nbdev_mkdocs new","text":"

Creates files in 'mkdocs' subdirectory needed for other 'nbdev_mkdocs' subcommands.

Usage:

$ nbdev_mkdocs new [OPTIONS]\n

Options:

  • --root-path TEXT: [default: .]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-prepare","title":"nbdev_mkdocs prepare","text":"

Runs tests and prepares files in 'mkdocs/docs' and then runs 'mkdocs build' command on them.

Usage:

$ nbdev_mkdocs prepare [OPTIONS]\n

Options:

  • --root-path TEXT: [default: .]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-preview","title":"nbdev_mkdocs preview","text":"

Prepares files in 'mkdocs/docs' and then runs 'mkdocs serve' command on them.

Usage:

$ nbdev_mkdocs preview [OPTIONS]\n

Options:

  • --root-path TEXT: path under which mkdocs directory will be created [default: .]
  • --use-relative-doc-links / --use-host-doc-links: If set to --use-relative-doc-links, relative links are added to symbol references in generated documentation. If set to --use-host-doc-links, the value set in doc_host in settings.ini is added to symbol references in generated documentation. [default: use-relative-doc-links]
  • --port INTEGER: port to use [default: 4000]
  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-readme","title":"nbdev_mkdocs readme","text":"

Updates the README.md file from the 'readme_nb' notebook. Unless explicitly changed in the settings.ini file, the 'readme_nb' points to the 'index.ipynb' notebook in the 'nbs_path' directory.

Usage:

$ nbdev_mkdocs readme [OPTIONS]\n

Options:

  • --help: Show this message and exit.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-social-image","title":"nbdev_mkdocs social-image","text":"

Command for generating a custom social share image.

Usage:

$ nbdev_mkdocs social-image [OPTIONS] COMMAND [ARGS]...\n

Options:

  • --help: Show this message and exit.

Commands:

  • generate: Generate a custom social share image.
"},{"location":"cli/nbdev_mkdocs/#nbdev_mkdocs-social-image-generate","title":"nbdev_mkdocs social-image generate","text":"

Generate a custom social share image.

Usage:

$ nbdev_mkdocs social-image generate [OPTIONS]\n

Options:

  • --root-path TEXT: Project's root path. [default: .]
  • --generator [file|dall_e]: Generator to use to create the social image. Valid options are: 'file' and 'dall_e'. Choose 'file' if you want to use an existing image from your local machine in the social share image. [default: file]
  • --prompt TEXT: The prompt to use for generating the image. Please pass this option only when using 'dall_e' as the generator. [default: Cute animal wearing hoodie sitting in high chair in purple room, browsing computer, 3d render]
  • --image-path TEXT: Image file path to use in the social share image. Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results. If None, then the default image will be used. Please pass this option only when using 'file' as the generator.
  • --help: Show this message and exit.
"},{"location":"guides/Adding_Guides/","title":"Adding guides","text":"

With Material for nbdev, you can easily add a step-by-step tutorial or comprehensive how-to guide in your documentation.

All you need to do is add the new notebooks to your notebook directory (The directory set in nbs_path in your project\u2019s settings.ini file) and run nbdev_mkdocs preview to preview the documentation. The information from the newly added notebooks will automatically populate in the navigation, making it easily accessible to your audience.

Note

If you have set the custom_sidebar=True your project's settings.ini file, the newly added guide or tutorial will not appear in navigation automatically. To make it appear, manually edit the project's sidebar.yml or _quarto.yml file and include the sections and contents.

"},{"location":"guides/Adding_Guides/#adding-a-new-guide","title":"Adding a new guide","text":"

Now, let\u2019s add a new guide to our nbdev_mkdocs_tutorial project. Run the following command from the project\u2019s root directory to create a new guides directory:

mkdir nbs/guides\n

From the Jupyter home tab, navigate to the guides directory and create a new notebook by clicking on the New dropdown menu. Rename the notebook as Guide_01_Hello_World and create a new markdown cell with the following contents. This will be the title of the guide:

# Hello World\n

If everything is done correctly, the guides directory will look like this:

Now, run the following command in the terminal to preview the changes in the browser:

nbdev_mkdocs preview\n

The sidebar will now have a new menu called Guides, and when you click on it, the documentation should look like this:

Now, add another markdown cell just below the title cell and paste the following content:

This is an example of a guide.\n

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview the changes.

Click on Guides menu in the sidebar, and the documentation should look like this:

"},{"location":"guides/Adding_Guides/#adding-images-to-the-guide","title":"Adding images to the guide","text":"

In the guides, you can include images from your computer as well as images from the internet.

"},{"location":"guides/Adding_Guides/#adding-an-external-image","title":"Adding an external image","text":"

Let\u2019s add an image from the internet to our guide. To keep things simple, we\u2019ll add the nbdev_mkdocs_tutorial repo\u2019s GitHub CI badge to our guide.

Copy and paste the below URL in your preferred browser to view the CI status badge for the nbdev_mkdocs_tutorial repo:

Note

In the following URL:

  • Replace {user} with your github username
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
https://github.com/{user}/nbdev_mkdocs_tutorial/actions/workflows/test.yaml/badge.svg\n

Make a new markdown cell at the bottom of the Guide_01_Hello_World.ipynb notebook and paste the below content

Note

In the following URL:

  • Replace {user} with your github username
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
From internet:\n![](https://github.com/{user}/nbdev_mkdocs_tutorial/actions/workflows/test.yaml/badge.svg)\n

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Click on Guides menu in the sidebar, and the documentation should look like this:

"},{"location":"guides/Adding_Guides/#adding-a-local-image","title":"Adding a local image","text":"

For adding images from your computer, the images must be saved within your notebook directory (The directory set in nbs_path in your project\u2019s settings.ini file). Let\u2019s make a directory called images within the guides directory and save the CI status badge image as badge.svg.

Note

The directory name images is used as an example. You can refer to images located in any directory as long as they are inside your project's notebook directory (The directory set in nbs_path in your project's settings.ini file).

Duplicate the above cell and replace From internet: text with From local: and http url with images/badge.svg

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Click on Guides menu in the sidebar, and the documentation should look like this:

"},{"location":"guides/Adding_Release_Notes/","title":"Adding release notes","text":"

Material for nbdev uses CHANGELOG.md as release notes in the documentation. If the CHANGELOG.md file is not found in the project root directory, a default page under the Releases tab will be displayed, explaining how to generate the CHANGELOG.md, as shown below:

Let\u2019s follow the above steps and create a CHANGELOG.md file for our nbdev_mkdocs_tutorial project.

Note

You'll need a GitHub personal access token to generate the changelog. Please see the nbdev documentation for more information on how to create and configure a new token.

Now, copy your GitHub personal access token and paste it into a file called token in the root of your repository. To do so, run the following command from the project root directory:

Note

  • In the following command replace {XXX} with your GitHub personal access token.
echo {XXX} > token\n

Also, ensure that the token file isn\u2019t added to git, by running this in your terminal

echo token >> .gitignore\n

Now, run the following command from the project root directory to generate the changelog:

nbdev_changelog\n

The above command will generate the files CHANGELOG.md and CHANGELOG.bak in the project root directory. Run the following commands in the terminal to preview the changes in the browser:

nbdev_mkdocs preview\n

Now, please click on the Releases menu and the documentation should look like this:

"},{"location":"guides/Advanced_Customization_Options/","title":"Advanced customization options","text":"

Material for nbdev uses mkdocs.yml configuration file for generating documentation. This file is located in mkdocs/mkdocs.yml and is pre-configured with reasonable default settings. You can easily customize the documentation by modifying the mkdocs.yml file, such as changing the theme, adding new markdown extensions, and adjusting other settings.

"},{"location":"guides/Advanced_Customization_Options/#editing-pre-configured-css-file","title":"Editing pre-configured CSS file","text":"

In addition to changing the settings, you can make minor changes to the documentation by writing your own CSS and JavaScript.The easiest way is by editing the pre-configured CSS and JavaScript files inside mkdocs/docs_overrides directory:

.\n\u2514\u2500\u2500 mkdocs/\n    \u2514\u2500\u2500 docs_overrides/\n        \u251c\u2500\u2500 css/\n        \u2502   \u2514\u2500\u2500 extra.css\n        \u251c\u2500\u2500 js/\n        \u2502   \u2514\u2500\u2500 extra.js\n        \u2514\u2500\u2500 images/\n            \u2514\u2500\u2500 compass-outline.png\n

Note

The docs_overrides directory will be created only once when you run the nbdev_mkdocs new command; please ensure that you add this folder to git to preserve your changes.

"},{"location":"guides/Advanced_Customization_Options/#changing-the-favicon","title":"Changing the favicon","text":"

You can easily change the default favicon by adding the new image to the mkdocs/docs_overrides/images directory and referencing it in the mkdocs.yml file.

In mkdocs.yml, replace the default image name compass-outline.png with the new favicon image name:

favicon: images/{new_fav_icon_name}\n
"},{"location":"guides/Advanced_Customization_Options/#adding-a-new-css-file","title":"Adding a new CSS file","text":"

If you want to change the colours or spacing of certain elements, edit the extra.css file in the mkdocs/docs_overrides/css directory. The file is already configured in the mkdocs.yml file, and after making the changes, save the file, stop the server and re-run the nbdev_mkdocs preview command to preview your changes in the browser.

"},{"location":"guides/Advanced_Customization_Options/#adding-a-new-javascript-file","title":"Adding a new JavaScript file","text":"

If you want to integrate another syntax highlighter or add some custom logic to your theme, edit the extra.js file in the mkdocs/docs_overrides/js directory. The file is already configured in the mkdocs.yml file, and after making the changes, save the file, stop the server and re-run the nbdev_mkdocs preview command to preview your changes in the browser.

Please refer to the Material for Mkdocs documentation for more customization options.

"},{"location":"guides/Advanced_Customization_Options/#using-mathematical-formulas","title":"Using Mathematical formulas","text":"

MathJax is being already set up as described here.

"},{"location":"guides/Advanced_Customization_Options/#using-the-block-syntax","title":"Using the block syntax","text":"

Blocks must be enclosed in $$...$$ or \\[...\\] on separate lines:

$$\n\\operatorname{ker} f=\\{g\\in G:f(g)=e_{H}\\}{\\mbox{.}}\n$$\n
\\[ \\operatorname{ker} f=\\{g\\in G:f(g)=e_{H}\\}{\\mbox{.}} \\]"},{"location":"guides/Advanced_Customization_Options/#using-the-inline-block-syntax","title":"Using the inline block syntax","text":"

Inline blocks must be enclosed in $...$ or \\(...\\):

The homomorphism $f$ is injective if and only if its kernel is only the \nsingleton set $e_G$, because otherwise $\\exists a,b\\in G$ with $a\\neq b$ such \nthat $f(a)=f(b)$.\n

The homomorphism \\(f\\) is injective if and only if its kernel is only the singleton set \\(e_G\\), because otherwise \\(\\exists a,b\\in G\\) with \\(a\\neq b\\) such that \\(f(a)=f(b)\\).

"},{"location":"guides/Auto_Generating_Docstrings/","title":"Auto-generating docstrings","text":"

Documenting existing code can be difficult and time-consuming because it requires understanding the code\u2019s intent and purpose, which may not always be clear or immediately obvious.

Material for nbdev simplifies the task of documenting existing code by automatically creating Google-style docstrings for classes and methods which don\u2019t have one. Material for nbdev internally uses the docstring-gen library and OpenAI\u2019s Codex AI model for generating clear and informative docstrings.

"},{"location":"guides/Auto_Generating_Docstrings/#adding-docstring","title":"Adding docstring","text":"

By running the following CLI command, you can add docstrings to a single Python file, a Jupyter notebook, or a directory containing these files.

Note

The OpenAI API uses API keys for authentication. Please create one and set it in the OPENAI_API_KEY environment variable before running the below command.

nbdev_mkdocs docstring generate -p {source_file_or_directory}\n

For example, a function like below without the docstring:

def concatenate_strings(s1: str, s2: str) -> str:\n    if not isinstance(s1, str) or not isinstance(s2, str):\n        raise TypeError(\"Both arguments should be strings.\")\n    return s1 + s2\n

will become similar to:

def concatenate_strings(s1: str, s2: str) -> str:\n    \"\"\"Concatenate two strings.\n\n    Args:\n        s1: First string\n        s2: Second string\n\n    Returns:\n        The concatenated string\n\n    Raises:\n        TypeError: If s1 or s2 is not a string\n\n    !!! note\n\n        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n    \"\"\"\n    if not isinstance(s1, str) or not isinstance(s2, str):\n        raise TypeError(\"Both arguments should be strings.\")\n    return s1 + s2\n
"},{"location":"guides/Auto_Generating_Docstrings/#regenerating-the-docstring","title":"Regenerating the docstring","text":"

If you wish to regenerate the docstrings, you can re-run the command with the -f flag, which will remove the previous auto-generated docstrings and replace them with new ones.

nbdev_mkdocs docstring generate -p {source_file_or_directory} -f\n

Note

By default, the command only adds docstrings to missing functions and classes. It won't overwrite previously generated docstrings if the -f flag is not provided during re-run.

"},{"location":"guides/Auto_Generating_Docstrings/#regenerating-the-docstring-without-note","title":"Regenerating the docstring without note","text":"

If you prefer not to include the text \u201cautogenerated by docstring-gen library\u201d in the generated docstrings, you can use the --no-include-auto-gen-txt flag when running the command.

nbdev_mkdocs docstring generate -p {source_file_or_directory} -f --no-include-auto-gen-txt\n

Now the docstring for the above function will look similar to:

def concatenate_strings(s1: str, s2: str) -> str:\n    \"\"\"Concatenate two strings.\n\n    Args:\n        s1: First string\n        s2: Second string\n\n    Returns:\n        The concatenated string\n\n    Raises:\n        TypeError: If s1 or s2 is not a string\n    \"\"\"\n    if not isinstance(s1, str) or not isinstance(s2, str):\n        raise TypeError(\"Both arguments should be strings.\")\n    return s1 + s2\n

Note

The text \u201cautogenerated by docstring-gen library\u201d is used to identify which docstrings were generated by the library. When the --no-include-auto-gen-txt flag is used, this text will not be included in the generated docstrings. As a result, when re-running the command with the -f flag, these docstrings will not be replaced.\u201d

Alternatively, you can manually delete the \u201cautogenerated by docstring-gen library\u201d (starting from the !!! note until the end) text from the classes and functions for which you think the auto-generated docstring is appropriate, and then re-run the command using the -f flag to update the remaining auto-generated docstrings.

"},{"location":"guides/Auto_Generating_Docstrings/#additional-settings","title":"Additional settings","text":"

In addition to the -f and --no-include-auto-gen-txt flags, you can also customize the behavior of the CLI command by adjusting other parameters such as --model, --temperature, etc., For more information on these options and how to use them, please refer to the OpenAI\u2019s documentation.

"},{"location":"guides/Auto_Generating_Docstrings/#jupyter-notebook-extension","title":"Jupyter notebook extension","text":"

We have created a user-friendly notebook extension for the docstring-gen library. This extension provides a convenient way to document your code cell-by-cell, rather than having to document the entire notebook all at once. To install the extension, simply run the following commands in your terminal:

Note

Please ensure jupyter-contrib-nbextensions is installed before installing the docstring-gen library extension

jupyter nbextension install https://github.com/airtai/jupyter-docstring-gen/archive/main.zip --user\njupyter nbextension enable jupyter-docstring-gen-main/jupyter-docstring-gen\n

After successful installation, you will see a new button on your jupyter notebook toolbar. This button allows you to easily generate docstrings for your Python code and improve your documentation.

For more detailed information, please refer to this link.

"},{"location":"guides/Basic_User_Guide/","title":"Basic User Guide","text":"

This guide will walk you through the process of creating documentation for nbdev projects using Material for nbdev.

"},{"location":"guides/Basic_User_Guide/#quick-summary","title":"Quick summary","text":"

Here\u2019s a quick comparison of Quarto and Material for nbdev development workflows:

Quarto workflow Material for nbdev workflow Install:
$ pip install notebook nbdev\n$ nbdev_install_quarto\n
Install:
$ pip install notebook nbdev\n$ nbdev_install_quarto\n$ pip install nbdev-mkdocs\n
Setup:
$ nbdev_new\n$ nbdev_install_hooks\n$ vi settings.ini\n$ pip install -e '.[dev]'\n
Setup:
$ nbdev_new\n$ nbdev_install_hooks\n$ vi settings.ini\n$ pip install -e '.[dev]'\n$ nbdev_mkdocs new\n$ vi mkdocs/mkdocs.yml\n
Development:
# Edit files\n$ nbdev_preview\n
Development:
# Edit files\n$ nbdev_mkdocs preview\n
Commit changes:
$ nbdev_prepare\n$ git commit -am \u201cCommit message\u201d\n$ git push\n
Commit changes:
$ nbdev_mkdocs prepare\n$ git commit -am \u201cCommit message\u201d\n$ git push\n
"},{"location":"guides/Basic_User_Guide/#installation","title":"Installation","text":"

To complete this tutorial, you will need the following software and Python library:

  1. Python
  2. pip Python package manager
  3. Jupyter Notebook
  4. nbdev
  5. Quarto
  6. nbdev-mkdocs

It is recommended to use a virtual environment for your Python projects. Virtual environments are a common and effective Python development technique that helps to keep dependencies required by different projects separate by creating isolated Python environments for them.

In this tutorial, we will be using Python\u2019s venv module to create a virtual environment.

Note

There are other great third-party tools for creating virtual environments, such as conda and virtualenv, For basic usage, venv is an excellent choice because it already comes packaged with your Python installation. Any of these tools can help you set up a Python virtual environment.

"},{"location":"guides/Basic_User_Guide/#creating-and-activating-a-new-python-virtual-environment","title":"Creating and activating a new Python virtual environment","text":"

To create a new virtual environment with venv, open a new terminal session in the root directory of your new project and run the command below:

python3 -m venv venv\n

The above command creates a new virtual environment called venv. Please feel free to change the name if necessary.

Now your project has its own virtual environment. Generally, before you start using it, you\u2019ll first need to activate the environment. Run the below command to activate your new virtual environment:

source venv/bin/activate\n
"},{"location":"guides/Basic_User_Guide/#installing-the-packages","title":"Installing the packages","text":"

Before we begin installing our project dependencies, let us first upgrade pip to ensure we are using the most recent packages by running the following command:

python3 -m pip install --upgrade pip\n

Now, install the Python packages required for our project by running the following command:

pip install notebook nbdev nbdev-mkdocs\n

Enter y (for yes) if prompted. Installation should take a few seconds, during which text will be printed in the terminal.

After installing the Python packages, run the following command in the terminal to install Quarto via nbdev\u2019s CLI command:

nbdev_install_quarto\n

If prompted, enter your password in the terminal to continue installing Quarto. You can read\u00a0the source code of the nbdev_install_quarto command for more information. Alternatively, you can follow the Quarto\u2019s official installation instructions.

"},{"location":"guides/Basic_User_Guide/#first-steps","title":"First steps","text":"

In this section, we will use the nbdev and nbdev-mkdocs commands to configure our new project with tests, continuous integration, and a documentation website built with Material for Mkdocs.

"},{"location":"guides/Basic_User_Guide/#creating-a-new-github-repo","title":"Creating a new GitHub repo","text":"

Create an empty GitHub repo using the convenient link github.com/new. If you get stuck, you might find GitHub\u2019s Create a repo page helpful.

For this example, let\u2019s name our repo nbdev_mkdocs_tutorial (feel free to change it) and add a nice description, as nbdev will use it later.

Note

Don\u2019t add a README file, .gitignore, or license file just yet. nbdev will create necessary files when we Initialise the repo with nbdev new command

If you\u2019re using the web interface, it should look something like this before you click Create Repository:

Now, click the Create Repository button to create a new repo.

You should then be redirected to your new repo:

Before we continue, there is one last step we need to do. Go to the Settings tab and click on Actions -> General on the left side. Scroll down to the bottom of the screen and find the Workflow Permissions section. Make sure the Read and Write permissions is selected. If it is not, change it and then click Save button.

Note

Please ensure that the Read and Write permissions is selected under the Workflow Permissions section or the deploy action will fail.

"},{"location":"guides/Basic_User_Guide/#initialising-your-repo-with-nbdev","title":"Initialising your repo with nbdev","text":"

Now clone your repo from the same terminal window. If you get stuck here, you might find GitHub\u2019s Cloning a repository page helpful.

Since we created a repo named nbdev_mkdocs_tutorial, we can clone it as follows:

Note

In the following command:

  • Replace {user} with your github username
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
git clone https://github.com/{user}/nbdev_mkdocs_tutorial.git\n

Then cd (change directory) to our repo:

Note

In the following command:

  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
cd nbdev_mkdocs_tutorial\n

nbdev provides the nbdev_new command to initialise an empty git repository. It\u2019ll infer information about your project from git and GitHub, and ask you to input anything remaining.

Let\u2019s initialise our repo with nbdev by entering the following command:

nbdev_new\n

It may ask you to enter information that it couldn\u2019t infer from git or GitHub.

Note

nbdev_new assumes that your package name is the same as your repo name (with - replaced by _). Use the --lib_name option if that isn\u2019t the case.

"},{"location":"guides/Basic_User_Guide/#initialising-your-repo-with-nbdev-mkdocs","title":"Initialising your repo with nbdev-mkdocs","text":"

After you\u2019ve installed nbdev-mkdocs, you can bootstrap your project documentation using the nbdev_mkdocs executable. From the project root directory and run the following command:

nbdev_mkdocs new\n

Using information from the project\u2019s settings.ini file, the above command creates files and directories required to build the documentation and saves it in the mkdocs subdirectory.

"},{"location":"guides/Basic_User_Guide/#previewing-the-docs-locally","title":"Previewing the docs locally","text":"

To preview the Mkdocs for Material documentation locally, we must first install our library. To do so, execute the following command from the project\u2019s root directory:

pip install -e '.[dev]'\n

Now, run the following command to preview your documentation:

nbdev_mkdocs preview\n

Note

If you encounter the error No module named nbdev_mkdocs_tutorial while executing the above command, please add your project root directory to the PYTHONPATH environment variable. One way to do this is by executing the following command from the project root directory.

    export PYTHONPATH=$PYTHONPATH:`pwd`\n

In our example, the documentation will be served at the following URL:

Note

  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it in the below command.
  • By default, the documentation will be served on port 4000. However, you can change the port by passing the --port argument to the nbdev_mkdocs preview command. For more information, please run the nbdev_mkdocs preview --help.
http://0.0.0.0:4000/nbdev_mkdocs_tutorial/\n

Now, copy and paste the above URL into your preferred browser, and the documentation should look something like this:

When you switch to the black theme, the page will look like this:

The website\u2019s navigation structure can be divided into two parts. The first section is built by reading the sidebar.yml or _quarto.yml file from the nbs directory. The second part of the navigation structure includes specific sections for the API, CLI, and Releases.

Now it\u2019s time to commit your changes to git and publish the documentation to GitHub Pages. We recommend running the nbdev_mkdocs prepare command in the terminal before committing to Git, which exports the library, tests and cleans notebooks, and generates the README file if necessary.

nbdev_mkdocs prepare\n

Finally, double-check your settings.ini file and push your changes to GitHub

Note

Before pushing to GitHub, please ensure that the latest version of nbdev-mkdocs is included in the dev_requirements section of the settings.ini file.

git add .\ngit commit -m'Initial commit'\ngit push\n
"},{"location":"guides/Basic_User_Guide/#checking-out-your-workflows-and-docs","title":"Checking out your workflows and docs","text":"

From the GitHub web interface, open GitHub Actions by clicking the Actions tab near the top of your repo page. You should see two workflow runs:

  1. CI - The CI workflow clears the unwanted metadata from notebook and runs the tests.
  2. Deploy to GitHub Pages \u2013 Builds your docs with Material for Mkdocs and deploys it to GitHub Pages.

Note that you\u2019ll need to enable GitHub Pages for your repo before you can access your docs website. We\u2019ll do that now.

Once the above two actions are completed successfully, you can enable it for your repo by clicking on the Settings tab near the top-right of your repo page, then Pages on the left, then setting the Branch to gh-pages, and finally clicking Save.

It should look similar to this after you click Save:

Head back to GitHub Actions and you should see a new workflow run: pages build and deployment. As the name says, this workflow deploys your website contents to GitHub Pages.

Wait for the workflow run to complete, then open your website. By default it should be available at:

Note

In the following URL:

  • Replace {user} with your github username.
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
https://{user}.github.io/nbdev_mkdocs_tutorial\n
"},{"location":"guides/Basic_User_Guide/#recap","title":"Recap","text":"

You now have a base nbdev repo with continuous integration and hosted documentation! Here\u2019s a recap of the steps you took:

  • Created a GitHub repo.
  • Initialised your repo with nbdev_new.
  • Initialised your repo with nbdev_mkdocs new.
  • Installed the package with pip install \u2018.[dev]\u2019.
  • Previewed the documentation with nbdev_mkdocs preview.
  • Exported the library, tested it, and cleaned the notebooks using nbdev_mkdocs prepare.
  • Pushed to GitHub.
"},{"location":"guides/Basic_User_Guide/#adding-documentation","title":"Adding documentation","text":"

In this section, you\u2019ll will learn how to add documentation for functions, classes, and CLI commands.

"},{"location":"guides/Basic_User_Guide/#installing-hooks-for-git-friendly-notebooks","title":"Installing hooks for git-friendly notebooks","text":"

When working with Jupyter notebooks in a new repo, the first step is to install nbdev\u2019s hooks. See Git-friendly Jupyter for more information.

Install the nbdev\u2019s hooks by running the following command into your terminal:

nbdev_install_hooks\n

Note

You can also add new requirements to your project by editing the settings.ini file. When you do so, please make sure to install the library locally by running pip install -e '.[dev]' command. Otherwise, you will not have the new requirements installed in your environment.

Now, let\u2019s start the Jupyter notebooks by executing the command below:

jupyter notebook\n

Note: Before continuing, please ensure that the jupyter notebook is running on the newly created virtual environment.

This should open the Jupyter home page in a new browser tab:

"},{"location":"guides/Basic_User_Guide/#documenting-a-function","title":"Documenting a function","text":"

Now, let\u2019s add a sample docstring to an existing function in 00_core.ipynb notebook. Please open the 00_core.ipynb notebook present inside the nbs directory and add the docstring Docstring for foo to the function foo, or copy and replace the cell contents with the below sample code:

#| export\ndef foo(): \n    \"\"\"Docstring for `foo`\"\"\"\n    pass\n

After adding the docstring, save the notebook and run the following command in the terminal to preview the changes in the browser:

nbdev_mkdocs preview\n

Click on the API menu in the sidebar, and the documentation should look like:

Now let\u2019s add a new function in the same notebook, create a new code cell below the foo function cell and paste the following code:

#| export\ndef say_hello(to: str) -> str:\n    \"\"\"Say hello to somebody\n\n    Args:\n        to: Name to say `hello`\n\n    Returns:\n        A string with `Hello` prepended to the `to`\n    \"\"\"\n    return f'Hello {to}'\n

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Click on the API menu in the sidebar, and the documentation should look like:

"},{"location":"guides/Basic_User_Guide/#documenting-a-class","title":"Documenting a class","text":"

Now, in the same notebook, create a new code cell below the say_hello function cell and paste the following code:

#| export\nclass HelloSayer:\n    \"\"\"Say hello to `to` using `say_hello`\"\"\"\n    def __init__(self, to): self.to = to\n\n    def say(self):\n        \"\"\"Do the saying\"\"\"\n        return say_hello(self.to)\n

Save the notebook, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Click on the API menu in the sidebar, and the documentation should look like:

"},{"location":"guides/Basic_User_Guide/#documenting-a-cli-command","title":"Documenting a CLI command","text":"

Before we get started writing documentation for our first CLI command, let\u2019s take a look at what we already have in the CLI documentation. Just click on the CLI menu in the sidebar to view it. The documentation should look like:

This default page will be displayed when the console_scripts section of the settings.ini file does not include any command line executables.

Now let\u2019s move on to writing our first CLI command and adding it to the documentation.

Let\u2019s now convert our say_hello function into a command-line script and generate documentation for it by following the steps below:

Create a new code cell above the say_hello function cell and copy paste the below code to import the call_parse from fastcore:

#| export\nfrom fastcore.script import call_parse\n

Add the call_parse decorator to our say_hello function. After adding the decorator, the say_hello function should look like:

#| export\n@call_parse\ndef say_hello(to: str) -> str:\n    \"\"\"Say hello to somebody\n\n    Args:\n        to: Name to say `hello`\n\n    Returns:\n        A string with `Hello` prepended to the `to`\n    \"\"\"\n    return f'Hello {to}'\n

Save the notebook and run the following command from the project root directory to add the console script to the settings.ini file:

echo \"console_scripts = say_hello=nbdev_mkdocs_tutorial.core:say_hello\" >> settings.ini\n

Finally, run the following commands in the terminal to build the library and preview the changes in the browser:

pip install '.[dev]' && nbdev_mkdocs preview\n

Click on the CLI menu in the sidebar, and the documentation should look like:

nbdev-mkdocs will also generate documentation for CLI commands created using Typer and populates the same under the CLI tab.

"},{"location":"guides/Customizing_The_Sidebar/","title":"Customizing the sidebar","text":"

Material for nbdev makes it easy to customize the navigation in your project. You can modify the menu items by adding, deleting, or renaming them.

"},{"location":"guides/Customizing_The_Sidebar/#renaming-menu-items","title":"Renaming menu items","text":"

You can change the names of the API, CLI, and Releases menu items by editing the mkdocs/summary_template.txt file. This file is used to define the structure of your project\u2019s documentation.

Now, lets change navigation structure of our nbdev_mkdocs_tutorial project. We are going to rename the API menu to Reference in the sidebar. Please run the following command from the root directory of your project to open the file:

vi mkdocs/summary_template.txt\n

and replace the below line from - API to - Reference.

After making the change, the file will look like this:

{sidebar}\n- Reference\n{api}\n- CLI\n{cli}\n- [Releases]{changelog}\n

Save the file, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Now, the documentation should look like this:

"},{"location":"guides/Customizing_The_Sidebar/#removing-menu-items","title":"Removing menu items","text":"

You can also remove items from the side navigation in your project documentation. For example, let\u2019s say you want to remove the CLI menu. You can do this by modifying the same file.

Please run the following command from the root directory of your project to open the file:

vi mkdocs/summary_template.txt\n

and delete the below lines

- CLI\n{cli}\n

After making the change, the file will look like this:

{sidebar}\n- Reference\n{api}\n- [Releases]{changelog}\n

Save the file, stop the server and re-run the nbdev_mkdocs preview command to preview your changes.

Now, the documentation should look like this:

"},{"location":"guides/Handling_Pandas_In_The_Output/","title":"Handling pandas in the output","text":"

Pandas is a widely used data manipulation library in the data science community. One common use case is to display the results of a data analysis in a Pandas DataFrame.

By default, the Pandas DataFrame output will appear unformatted in the documentation. For example, take a look at the sample below which displays the head of a dataframe.

import pandas as pd\n\ndf = pd.util.testing.makeDataFrame()\ndf.head()\n
| | A | B | C | D | |------------|-----------|-----------|-----------|----------| | vtQ4AqzUmR | -0.366719 | 0.728404 | 0.625120 | 2.480765 | | qiHhTHAHNH | -0.359968 | -0.599540 | 1.594778 | 0.921716 | | LOqytDK7SY | -0.627586 | 0.935781 | -1.592791 | 0.024485 | | WOG0u390DM | 0.105248 | -0.062309 | 0.878165 | 1.072234 | | eOrtbW98MM | -1.400879 | -0.260574 | -0.369980 | 1.760192 |"},{"location":"guides/Handling_Pandas_In_The_Output/#material-styled-table","title":"Material styled table","text":"

A simple solution to enhance the appearance of the Pandas DataFrame table is to use the DataFrame.style attribute while displaying the output.

df.head().style\n
| \u00a0 | A | B | C | D | |------------|-----------|-----------|-----------|----------| | vtQ4AqzUmR | -0.366719 | 0.728404 | 0.625120 | 2.480765 | | qiHhTHAHNH | -0.359968 | -0.599540 | 1.594778 | 0.921716 | | LOqytDK7SY | -0.627586 | 0.935781 | -1.592791 | 0.024485 | | WOG0u390DM | 0.105248 | -0.062309 | 0.878165 | 1.072234 | | eOrtbW98MM | -1.400879 | -0.260574 | -0.369980 | 1.760192 |"},{"location":"guides/Setting_Up_Document_Versioning/","title":"Setting up document versioning","text":"

Material for nbdev makes deploying multiple versions of your project documentation simple and convenient. It comes equipped with mike, a Python tool that helps deploy multiple versions of your MkDocs docs to a Git branch, ideal for hosting on Github Pages.

"},{"location":"guides/Setting_Up_Document_Versioning/#enabling-document-versioning","title":"Enabling document versioning","text":"

Enabling document versioning in Material for nbdev is easy. Just add the docs_versioning flag to your settings.ini file with one of the following values:

  1. docs_versioning=None disables versioning.
  2. docs_versioning=minor deploys document in <major>.<minor> format and reads the version from the settings.ini file. Newer patch versions will replace previous minor versions (e.g.\u00a01.0.1 replaces 1.0 and becomes the new 1.0 version).
  3. docs_versioning=patch deploys document in <major>.<minor>.<patch> format (e.g.\u00a01.0.0, 1.0.1) and reads the version from the settings.ini file.

We recommend setting docs_versioning=minor to limit the number of deployments while keeping all patch version changes. This also helps to keep your Git repository small.

Note

Regardless of whether docs_versioning is set to minor or patch, the documentation for the pre-release versions such as 1.0.0rc0 or 1.0.0dev will be deployed as-is.

Push the change to Git and wait for the pages build and deployment GitHub action to complete. After that, view the project documentation URL to see the latest changes. To access different versions, use the version selector in the header (a reference screenshot is provided below).

"},{"location":"guides/Setting_Up_Document_Versioning/#deleting-deployed-pre-release-documents","title":"Deleting deployed pre-release documents","text":"

To delete all the deployed pre-release document versions, run the following CLI command from the project root directory and follow the on-screen instructions:

nbdev_mkdocs delete-pre-release-docs\n

For additional configurations for managing the deployed document versions, please check mike\u2019s documentation.

"},{"location":"guides/Setting_up_social_cards/","title":"Setting up social cards","text":"

Social cards, also known as social sharing image, are images that are displayed when a link to your project documentation is shared on social media. Material for nbdev enables you to easily create attractive social media share images for your project.

By default, mkdocs.yml is configured to use the social sharing image generated by GitHub\u2019s Open Graph image service for your project.

For viewing the default social share image for our project nbdev_mkdocs_tutorial, navigate to the URL below in your preferred browser.

Note

In the following URL:

  • Replace {user} with your github username
  • If you have used a different name for your repo, replace nbdev_mkdocs_tutorial with it.
https://opengraph.githubassets.com/some-random-stuff-to-refresh-or-timestamp/{user}/nbdev_mkdocs_tutorial\n
"},{"location":"guides/Setting_up_social_cards/#generating-new-social-cards","title":"Generating new social cards","text":"

For customizing and generating a new social share image for your project, you can use the nbdev_mkdocs social-image generate CLI command. For viewing the current configuration options, please run the following command in the terminal.

nbdev_mkdocs social-image generate --help\n
 Usage: nbdev_mkdocs social-image generate [OPTIONS]\n\n Generate a custom social share image\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --root-path         TEXT           Project's root path. [default: .]         \u2502\n\u2502 --generator         [file|dall_e]  Generator to use to create the social     \u2502\n\u2502                                    image. Valid options are: 'file' and      \u2502\n\u2502                                    'dall_e'. Choose 'file' if you want to    \u2502\n\u2502                                    use an existing image from your local     \u2502\n\u2502                                    machine in the social share image.        \u2502\n\u2502                                    [default: file]                           \u2502\n\u2502 --prompt            TEXT           The prompt to use for generating the      \u2502\n\u2502                                    image. Please pass this option only when  \u2502\n\u2502                                    using 'dall_e' as the generator.          \u2502\n\u2502                                    [default: Cute animal wearing hoodie      \u2502\n\u2502                                    sitting in high chair in purple room,     \u2502\n\u2502                                    browsing computer, 3d render]             \u2502\n\u2502 --image-path        TEXT           Image file path to use in the social      \u2502\n\u2502                                    share image. Use images with a 1:1 aspect \u2502\n\u2502                                    ratio and at least 512x512 pixels for the \u2502\n\u2502                                    best results. If None, then the default   \u2502\n\u2502                                    image will be used. Please pass this      \u2502\n\u2502                                    option only when using 'file' as the      \u2502\n\u2502                                    generator.                                \u2502\n\u2502                                    [default: None]                           \u2502\n\u2502 --help                             Show this message and exit.               \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n

The above command generates the custom social share image using the playwright library. Please run the following command to install the required browser for the playwright plugin before generating a custom social share image:

playwright install chromium\n
"},{"location":"guides/Setting_up_social_cards/#generating-using-ai","title":"Generating using AI","text":"

The nbdev_mkdocs social-image generate CLI command can be configured to use DALL-E, an OpenAI model to create stunning social share images for your project.

Here\u2019s an example of how to use DALL-E to create a custom social share image based on a description.

Note

The OpenAI API uses API keys for authentication. Please create one and set it in the OPENAI_API_KEY environment variable before running the below command.

nbdev_mkdocs social-image generate \\\n    --generator \"dall_e\" \\\n    --prompt \"Cute panda browsing computer in purple room. 3d render.\"\n

The generated image will be saved as social_image.png in the mkdocs/docs_overrides/images directory. You can make multiple versions of the image by experimenting with the text prompts. Each version will be saved to the same directory, with a version number added to the suffix. For example, the most recently generated image is saved as social_image.png, the first version will be saved as social_image_1.png, the second version will be saved as social_image_2.png, and so on. This allows you to easily experiment and compare different versions of the image to find the one that looks best.

"},{"location":"guides/Setting_up_social_cards/#generating-from-an-existing-image","title":"Generating from an existing image","text":"

You can also make a custom social share image from an existing image. This can be an excellent way to maintain your brand\u2019s visual style while also making it stand out on social media. Here\u2019s an example of how to do so:

Tip

Use images with a 1:1 aspect ratio and at least 512x512 pixels for the best results.

Note

Replace {path-to-image} in the following command with the image path you want to use in the social share image

nbdev_mkdocs social-image generate \\\n    --image-path {path-to-image}\n

You can also choose not to pass the --image-path parameter in the above command, in which case the default image will be used.

"}]} \ No newline at end of file diff --git a/0.6/sitemap.xml.gz b/0.6/sitemap.xml.gz index ba69e78328c7ae893106ae69d20746b49dd389ef..4106aa688341b8d55abdc090f5136baf853e1997 100644 GIT binary patch delta 15 WcmX@ia+rlpzMF%?tau}vEfWAEa|7-G delta 15 WcmX@ia+rlpzMF$XH)kW8EfWAE8Ux+{