Text utilities.

For this project, a map of module to notebook names might look like:

module_index = {"core": "00_core.ipynb",
                "apple": "00a_apple.ipynb",
                "text.core": "10_text_core.ipynb",
                "text.util": "10a_text_utils.ipynb"}

Why write a map of module to notebook names to _nbdev.py?

We can't doc link to our text.core module because we've used a notebook name that does not correspond to the module name:

We have "10_text_core.ipynb"

  • doc_link wants to map "text.core" to "text.core.html" but
  • _nb2htmlfname maps "10_text_core.ipynb" to "text_core.html"

nbdev allows module names to be different to notebook names via %nbdev_default_export but ... doc_link forces them to be the same (if you want backtick links to your modules).

Notice how the link to core_text_fn finds it's way to "text_core.html" - because it uses _nbdev#index to map function names to notebook names.

So you don't need your project to be in sys.path

When doc_link checks is_lib_module we:

importlib.import_module(f'{Config().lib_name}.{name}')

Building docs for this new project in a conda env means no module links are created - I'm not sure why importlib.import_module fails when show_doc still finds functions etc to display - but ...

pip install -e . adds the project to sys.path and is_lib_module can import them.

I'd like to fix this by changing is_lib_module to use module_index (or _nbdev#modules if you don't want to introduce module_index).

text_util_fn[source]

text_util_fn()

Adds some behaviour to core_text_fn