module helpgen.sphinx_main_helper

Short summary

module pyquickhelper.helpgen.sphinx_main_helper

Contains helpers for the main function generate_help_sphinx().

source on GitHub

Functions

function

truncated documentation

compile_latex_output_final

Compiles the latex documents.

enumerate_copy_images_for_slides

Copies images, initial intent was for slides, once converted into html, link to images are relative to the folder …

format_history

Formats history based on module releases.

generate_changes_repo

Generates a RST tables containing the changes stored by a SVN or GIT repository, the outcome …

get_executables_path

Returns the paths to Python, Python Scripts.

my_date_conversion

Converts a date into a datetime.

produce_code_graph_changes

Returns the code for a graph which counts the number of changes per week over the last year.

replace_placeholder_by_recent_blogpost

Replaces a place holder by a list of blog post.

setup_environment_for_help

Modifies environment variables to be able to use external tools such as Inkscape.

Documentation

Contains helpers for the main function generate_help_sphinx.

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.compile_latex_output_final(root, latex_path, doall, afile=None, latex_book=False, fLOG=<function fLOG>, custom_latex_processing=None, remove_unicode=False)[source][source]

Compiles the latex documents.

Parameters
  • root – root

  • latex_path – path to the compiler

  • doall – do more transformation of the latex file before compiling it

  • afile – process a specific file

  • latex_book – do some customized transformation for a book

  • fLOG – logging function

  • custom_latex_processing – function which does some post processing of the full latex file

  • remove_unicode – remove unicode characters before compiling it

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.enumerate_copy_images_for_slides(src, dest, pattern='.*(([.]png)|([.]gif])|([.]jpeg])|([.]jpg])|([.]svg]))$')[source][source]

Copies images, initial intent was for slides, once converted into html, link to images are relative to the folder which contains them, we copy the images from _images to _downloads.

Parameters
Returns

enumerator of copied files

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.format_history(src, dest, format='basic')[source][source]

Formats history based on module releases.

Parameters
  • src – source history (file)

  • dest – destination (file)

Changed in version 1.7: Parameter format was added. Sphinx extension release is no longer used but the formatting is still available.

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.generate_changes_repo(chan, source, exception_if_empty=True, filter_commit=<function <lambda>>, fLOG=<function fLOG>, modify_commit=None)[source][source]

Generates a RST tables containing the changes stored by a SVN or GIT repository, the outcome is stored in a file. The log comment must start with * to be taken into account.

Parameters
  • chan – filename to write (or None if you don’t need to)

  • source – source folder to get changes for

  • exception_if_empty – raises an exception if empty

  • filter_commit – function which accepts a commit to show on the documentation (based on the comment)

  • fLOG – logging function

  • modify_commit – function which rewrite the commit text (see below)

Returns

string (rst tables with the changes)

pandas is not imported in the function itself but at the beginning of the module. It seemed to cause soe weird exceptions when generating the documentation for another module:

File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked

Doing that helps. The cause still remains obscure. If not None, function modify_commit is called the following way (see below). nbch is the commit number. date can be returned as a datetime or a string.

nbch, date, author, comment = modify_commit(nbch, date, author, comment)

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.get_executables_path()[source][source]

Returns the paths to Python, Python Scripts.

Returns

a list of paths

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.my_date_conversion(sdate)[source][source]

Converts a date into a datetime.

Parameters

sdate – string

Returns

date

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.produce_code_graph_changes(df)[source][source]

Returns the code for a graph which counts the number of changes per week over the last year.

Parameters

df – dataframe (has a column date with format YYYY-MM-DD)

Returns

graph

The call to datetime.datetime.strptime introduced exceptions:

File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked

when generating the documentation for another project. The reason is still unclear. It was replaced by a custom function.

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.replace_placeholder_by_recent_blogpost(all_tocs, plist, placeholder, nb_post=5, fLOG=<function fLOG>)[source][source]

Replaces a place holder by a list of blog post.

Parameters
  • all_tocs – list of files to look into

  • plist – list of blog post

  • placeholder – place holder to replace

  • nb_post – number of blog post to display

  • fLOG – logging function

source on GitHub

pyquickhelper.helpgen.sphinx_main_helper.setup_environment_for_help(fLOG=<function fLOG>)[source][source]

Modifies environment variables to be able to use external tools such as Inkscape.

source on GitHub