hkjournalist package


hkjournalist.journalist module

class hkjournalist.journalist.Journalist(template_file=None, fig_width=None, fig_height=None, tmp_path='./temp', zh=False)[source]

Bases: object

Class to record and generate reports

  • template_file (str) – file path of md template
  • fig_width (None, int) – figure width (percentage of whole page width), prior to fig_height settings
  • fig_height (None, int) – figure height (percentage of whole page width)`
  • tmp_path (str) – temporary directory path to store temporary files (such as figures)
  • zh (bool) – if it supports chinese (zh_CN) usage
generate_template(template_file='./', title='template', author='Author', append=False)[source]

Generate a md template according to mappings which previously passed to.

The output template will be structed as each variable on a single slide with variable name as its title

Note:it may overwrite the file with the address

  • template_file (str) – output template file path
  • title (str) – report title
  • author (str) – author name
  • append (bool) – If use append mode to add new contents of report


Return type:



hear(config_dict: dict)[source]

Pass your variables mappings to the reporter

Parameters:config_dict (dict) – variable mappings such as {‘var_name’:value}
Return type:None
report(output_file='./final_report.pdf', beamer=True, theme='default', color_theme='seagull', use_template_config=False, overwrite=True, aspectratio=43)[source]

Generate final pdf (or other format) report using previously heard config dict

  • output_file (str) – final output file path
  • beamer (bool) – whether the output pdf will be a beamer slides ?
  • theme (str) – the theme used to create beamer (see
  • color_theme (str) – the color theme used to create beamer (see
  • use_template_config (bool) – whether use metadata params of format in your custom template, if false, just use params in this function to produce a report. otherwise, please ref to to write a fine md template
  • overwrite (bool) – whether use a timestamp of current time as a postfix for the final output filename. if false, a new file will occur every time the method call without overwriting previouly ones.
  • aspectratio (int) – aspect ratio of slide page. only valid when beamer is turn on and output format is pdf

execution return code (0 if succeed)

Return type:


Module contents