libscifig API — scifig 0.1 documentation

# libscifig API

## Tasks

A `Task` is composed of the following steps:

> 1. Transform the source files to a tex file
> 2. convert tex to pdf with `_tex_to_pdf()`
> 3. convert pdf to svg with `_pdf_to_svg()`
> 4. convert pdf to eps with `_pdf_to_eps()`
> 5. convert pdf to png with `_pdf_to_png()`

Step 1 can be complex and could require several sub-steps. Thus, the role of `_pre_make()` is to do all these sub-steps.

Steps 2 to 5 usually do not depend on the initial type of the task. The function `make()` do all of them.

Each format has its own export function. The function `export()` exports all of them.

class `task.` `GnuplotTask`(filepath, datafiles=[], tikzsnippet=False, tikzsnippet1=False, tikzsnippet2=False, build='build', db='db.db')

  Bases: `task.Task`

  Gnuplot Task manager.

  `check`()

    Check if the task needs to be done.

  `export`(dst='/tmp')

    Export built files.

    Parameters: | dst – filepath of the destination directory

  `export_eps`(dst='/tmp')

    Export built EPS files.

    Parameters: | dst – filepath of the destination directory

  `export_pdf`(dst='/tmp')

    Export built PDF files.

    Parameters: | dst – filepath of the destination directory

  `export_png`(dst='/tmp')

    Export built png files.

    Parameters: | dst – filepath of the destination directory

  `export_svg`(dst='/tmp')

    Export built SVG files.

    Parameters: | dst – filepath of the destination directory

  `export_tex`(dst='/tmp')

    Export TEX files.

    Parameters: | dst – filepath of the destination directory

  `get_name`()

    Return the name of the task.

  `make`()

    Compile the figure in all formats.

class `task.` `Task`(filepath, build='build', db='db.db')

  Bases: `object`

  Parent Task manager.

  Parameters: | filepath – filepath of the main file build – relative filepath of the build dir db – relative filepath of the db file

  `check`()

    Check if the task needs to be done.

  `export`(dst='/tmp')

    Export built files.

    Parameters: | dst – filepath of the destination directory

  `export_eps`(dst='/tmp')

    Export built EPS files.

    Parameters: | dst – filepath of the destination directory

  `export_pdf`(dst='/tmp')

    Export built PDF files.

    Parameters: | dst – filepath of the destination directory

  `export_png`(dst='/tmp')

    Export built png files.

    Parameters: | dst – filepath of the destination directory

  `export_svg`(dst='/tmp')

    Export built SVG files.

    Parameters: | dst – filepath of the destination directory

  `export_tex`(dst='/tmp')

    Export TEX files.

    Parameters: | dst – filepath of the destination directory

  `get_name`()

    Return the name of the task.

  `make`()

    Compile the figure in all formats.

class `task.` `TikzTask`(filepath, datafiles=[], build='build', db='db.db')

  Bases: `task.Task`

  Tikz Task manager.

  `check`()

    Check if the task needs to be done.

  `export`(dst='/tmp')

    Export built files.

    Parameters: | dst – filepath of the destination directory

  `export_eps`(dst='/tmp')

    Export built EPS files.

    Parameters: | dst – filepath of the destination directory

  `export_pdf`(dst='/tmp')

    Export built PDF files.

    Parameters: | dst – filepath of the destination directory

  `export_png`(dst='/tmp')

    Export built png files.

    Parameters: | dst – filepath of the destination directory

  `export_svg`(dst='/tmp')

    Export built SVG files.

    Parameters: | dst – filepath of the destination directory

  `export_tex`(dst='/tmp')

    Export TEX files.

    Parameters: | dst – filepath of the destination directory

  `get_name`()

    Return the name of the task.

  `make`()

    Compile the figure in all formats.

## database

`database.` `check_modification`(name, dependencies, db_path)

  Check if at least one dependency changed.

  Parameters: | name – name of the figure dependencies – list of dependencies db_path – path of the database
  Returns: | boolean

`database.` `erase_db`(db_path)

  Erase a database.

  Parameters: | db_path – path of the database

`database.` `store_checksum`(name, dependencies, db_path)

  Store the checksum in the db.

  Parameters: | name – name of the figure dependencies – list of dependencies db_path – path of the database

## detector

`detector.` `detect_datafile`(plt, root)

  Detect datafiles associated with a plt file.

  Parameters: | plt – plt filepath root – root filepath
  Returns: | list of filepath starting at root

`detector.` `detect_task`(directory, root_path)

  Detect the task to do depending on file extensions.

  Parameters: | directory – directory to look at
  Returns: | list of tasks

`detector.` `detect_tikzsnippets`(plt)

  Detect tikzsnippets associated with a plt file.

  Parameters: | plt – plt filepath
  Returns: | tuple of 2 booleans

## collogging