DocLinks
DocLinks (mod_fn, doc_func, dest_fn, mod_name=None)
Create a module symbol index from a python source file
DocLinks (mod_fn, doc_func, dest_fn, mod_name=None)
Create a module symbol index from a python source file
The doc index has to be stored in a file. Usually we call it _modidx.py
. For testing, we’ll delete any existing file first.
A link to docs is created by a doc_func
. We’ll use a dummy one for testing.
We’re now ready to instantiate DocLinks for our test module.
'tmp.everything'
DocLinks.write_nbprocess_idx ()
Create nbprocess documentation index file`
Initially the index file will contain empty syms
and settings
:
tmp_path = Path('tmp')
tmp_path.mkdir(exist_ok=True)
link.write_nbprocess_idx()
assert "Autogenerated" in dest_fn.read_text()
print(Path('tmp/_modidx.py').read_text())
# Autogenerated by nbprocess
d = {'settings': {}, 'syms': {}}
get_patch_name (o)
DocLinks.update_syms ()
g = exec_new('import tmp._modidx')
d = g['tmp']._modidx.d
symn = 'tmp.everything.a_y'
mod_name = 'tmp.everything'
test_eq(d['syms'][mod_name][symn], _help(mod_name,symn))
test_eq(set(d['syms'][mod_name].keys()),
set(L('m_y', 'n_y', 'q_y', 'a_y', 'b_y', 'd_y', 'e_y', 'o_y', 'p_y', 'd_y.di_n', 'd_y.d3i_n', 'd_y.d4i_n'
).map('tmp.everything.{}')))
DocLinks.build_index ()
build_modidx ()
Create _modidx.py
nbglob (path=None, skip_folder_re='^[_.]', file_glob='*.ipynb', recursive=True, key='nbs_path', as_path=False, symlinks:'bool'=True, file_re:'str'=None, folder_re:'str'=None, skip_file_glob:'str'=None, skip_file_re:'str'=None, func:'callable'=<functionjoinat0x7f1f3351ea70>)
Find all files in a directory matching an extension given a config_key
.
Type | Default | Details | |
---|---|---|---|
path | NoneType | None | path to start searching passed to globtastic |
skip_folder_re | str | 1 | Skip folders matching regex, passed to globtastic |
file_glob | str | *.ipynb | Only include files matching glob passed to globtastic |
recursive | bool | True | search subfolders passed to globtastic |
key | str | nbs_path | |
as_path | bool | False | |
symlinks | bool | True | follow symlinks? passed to globtastic |
file_re | str | None | Only include files matching regex passed to globtastic |
folder_re | str | None | Only enter folders matching regex passed to globtastic |
skip_file_glob | str | None | Skip files matching glob passed to globtastic |
skip_file_re | str | None | Skip files matching regex passed to globtastic |
func | callable | join | function to apply to each matched file passed to globtastic |
nbprocess_export (path:str=None, recursive:bool=None, symlinks:bool=True, file_re:str=None, folder_re:str=None, skip_file_glob:str=None, skip_file_re:str=None)
Export notebooks in path
to python modules
Type | Default | Details | |
---|---|---|---|
path | str | None | path or filename |
recursive | bool | None | search subfolders |
symlinks | bool | True | follow symlinks? |
file_re | str | None | Only include files matching regex |
folder_re | str | None | Only enter folders matching regex |
skip_file_glob | str | None | Skip files matching glob |
skip_file_re | str | None | Skip files matching regex |
NbdevLookup (strip_libs=None, incl_libs=None, skip_mods=None)
Mapping from symbol names to URLs with docs
Symbol names are taken from libraries registered using the ‘nbprocess’ entry point. By default, all libraries with this entry point are searched, but full symbol names (including module prefix) are required.
Pass strip_libs
to list libraries which should be available without requiring a module prefix.
nbprocess itself includes nbdev_lookup
, an instantiated NbdevLookup with strip_libs=nbprocess
.
NbdevLookup.linkify (md)
NbdevLookup.link_line (l)
md = """This is a link to `numpy.array` and to `get_config` but not a link to `foobar`.
And not a link to <code>dict2nb</code>.
This is not a link to `get_config`
This isn’t a link to get_config
either
This is a link to numpy.array and to get_config but not a link to foobar
. And not a link to dict2nb
.
This is not a link to [get_config](https://nbprocess.fast.ai/read#get_config)
This isn't a link to [get_config](https://nbprocess.fast.ai/read#get_config) either
_.↩︎