ipypublish.utils module

ipypublish.utils.find_entry_point(name, group, logger, preferred=None)[source]

find an entry point by name and group

Parameters
  • name (str) – name of entry point

  • group (str) – group of entry point

  • preferred (str) – if multiple matches are found, prefer one from this module

ipypublish.utils.get_module_path(module)[source]

return a directory path to a module

ipypublish.utils.get_valid_filename(s)[source]

Return the given string converted to a string that can be used for a clean filename. Remove leading and trailing spaces; convert other spaces to underscores; and remove anything that is not an alphanumeric, dash, underscore, or dot. >>> get_valid_filename(“john’s portrait in 2004.jpg”) ‘johns_portrait_in_2004.jpg’

ipypublish.utils.handle_error(msg, err_type, logger, raise_msg=None, log_msg=None)[source]

handle an error, by logging it, then raising an exception

ipypublish.utils.read_file_from_directory(dir_path, file_name, jtype, logger, interp_ext=False, ext_types='json', '.json', 'yaml', '.yaml', '.yaml.j2')[source]

load a file situated in a directory

if interp_ext=True: interpret the file extension via ext_types and load file in a suitable manner

ipypublish.utils.read_file_from_module(module_path, file_name, jtype, logger, interp_ext=False, ext_types='json', '.json', 'yaml', '.yaml', '.yaml.j2', 'yaml.tex.j2')[source]

load a file situated in a python module

if interp_ext=True: interpret the file extension via ext_type and load file in a suitable manner