Professional Documents
Culture Documents
TSC Sphinx Doc Manual V4.0
TSC Sphinx Doc Manual V4.0
TSC Sphinx Doc Manual V4.0
ID: tsc_sphinx_doc_manual
Version: V4.0
Status: Published
Author: Alexandre Betis
Date: 28/07/2022
Review: !960
Authorized by: Alexandre Betis
Configuration Management
Commit: 396671d2
Document signature
05a0a6b4abdd927fe30de7643a36765158c9b1bc
CONTENTS
2 Introduction 4
3 Getting started 6
4 Installation 8
5 Training ground 11
6 Basic documentation 12
7 Generalities 30
8 Artifacts 33
9 Configuration items 40
11 Parts 44
12 Requirements 47
13 Functions 53
14 RAMS 57
18 Quality Assurance 70
19 Utilities 71
20 Building documentation 73
21 Spell checking 76
22 Experimental features 77
23 Directives reference 78
Index 100
2 of 101 CONTENTS
05a0a6b4abdd927fe30de7643a36765158c9b1bc
CHAPTER
ONE
TWO
INTRODUCTION
2.1 Context
Within the context of its iEVC project, TSC developed the TSC Sphinx tool in order to manage the complex
technical documentation tool generated by this project.
2.2 Purpose
The purpose of this manual is to provide the necessary knowledge to use the TSC Sphinx tool.
2.3 Contents
4 of 101 2. Introduction
05a0a6b4abdd927fe30de7643a36765158c9b1bc
TSC Sphinx Extension User Manual
Refer to [TSC-SPHINX-MANUAL-R0-GLOSSARY] .
Artifact
TSC Sphinx Extension User Manual [artifact]
THREE
GETTING STARTED
Sphinx is a tool for that simplifies the production and maintenance of a technical documentation.
Sphinx is able to generate the documentation in html and latex format. It can also perform a spelling check of the
content.
It was originally created for the Python documentation, and it has excellent facilities for the documentation of
software projects in a range of languages.
The TSC Sphinx extension extends the capability of Sphinx with the ability to manage systems engineering topics
such as:
• Requirements management
• Configuration management
• Documentation versioning
Furthermore, the TSC Sphinx extension is able to extract a JSON database of items of interest from the documen-
tation.
Sphinx uses reStructuredText as its markup language. It is a text-based markup language were items of interests
are identified using directives. These are simple keywords, prefixed with .. and suffixed with ::. The TSC
extension defines additional directives that enrich this markup language. For example, it defines a tsc_req
directive that can be used in the documentation to document a requirement:
.. toctree::
:maxdepth: 1
Options are given after the arguments, in form of a “field list”. The maxdepth is such an option for the toctree
directive.
Content follows the options or arguments after a blank line. Each directive decides whether to allow content, and
what to do with it.
A common gotcha with directives is that the first line of the content must be indented to the same level as the
options are.
The main purpose of the TSC Sphinx extension is to provide additional directives.
.. toctree::
:maxdepth: 1
doc_structure
installation
training
This is exactly how the toctree for this documentation looks. The documents to include are given as document
names, which in short means that you leave off the file name extension and use forward slashes (/) as directory
separators.
You can now create the files you listed in the toctree and add content, and their section titles will be inserted
(up to the maxdepth level) at the place where the toctree directive is placed. Also, Sphinx now knows about
the order and hierarchy of your documents. (They may contain toctree directives themselves, which means
you can create deeply nested hierarchies if necessary.)
7 of 101
05a0a6b4abdd927fe30de7643a36765158c9b1bc
CHAPTER
FOUR
INSTALLATION
The TSC Sphinx extension is delivered as an integral part of the iEVC source code.
4.1 Pre-requisites
Important: Some of the features of the TSC Sphinx extension assume that the documentation is under GIT
source control.
To check if Git is installed on your machine, open a command prompt and type the following command:
git --version
Note: Git can be tedious to operate if you have to type your gitlab username and password for each
pull/push/clone.
Username and password typing issue can be solved by configuring SSH keys to be used, as explained here:
https://docs.gitlab.com/ee/gitlab-basics/create-your-ssh-keys.html
Sphinx is a tool developed in Python. It is assumed that Python3 is installed on your machine.
To check if Python3 is installed on your machine, open a command prompt and type the following command:
python --version
Python 3.9.6
8 of 101 4. Installation
05a0a6b4abdd927fe30de7643a36765158c9b1bc
TSC Sphinx Extension User Manual
4.2 On Linux
sudo apt install make cmake enchant aspell-en texlive texmf-dist texmf-dist-
˓→latexextra zip
Note: In the TSC repository, look into the file .gitlab-ci.yml for the up-to-date list of dependencies. The
tsc_docker directory provides a working environment based on docker.
cmake .
make
The full build not only builds HTML, Latex, PDF and JSON doc, but it also looks for spelling mistakes and broken
links in the doc.
If you want to just generate the doc in HTML:
make tsc_doc_html
Note: In the TSC repository, look into the file, look into the CMake configuration file CMakeLists.txt to know all
available targets.
The build targets are produced in a _build directory. In order to reset the build:
make clean
4.3 On Windows
In order to use all the above on Windows, follow the following steps.
1. If you plan on generating documentation in PDF, install TexLive: https://tug.org/texlive/acquire-netinstall.
html. If you are happy with only HTML and other formats, skip this step. You can do it later.
2. After that, ensure that you have Python installed, version 3.8.X or newer. If not, download from https:
//www.python.org/downloads/
Note: Make sure to uninstall previous python versions before installing the new one
Ensure that the python installation directory is simple (like c:/python) and not too complicated a path. Ideally, it
should be accessible on the command line directly.
3. Ensure that you have git for Windows installed (from https://git-scm.com/download/win)
4. run the following command:
cd tsc
pip install -r .\requirements.txt
make_html.bat
Important: The windows scripts must be run as Administrator. The scripts will emit a suitable warning in case
it is not done.
8. To clean:
make_clean.bat
make_json.bat
make_pdf.bat
Warning: Building the doc in PDF is actually a multiple stage process. First, a JSON version is built, then
latex, then PDF. Refer to Building documentation, for an in-depth explanation.
FIVE
TRAINING GROUND
The iEVC source code contains a properly configured root directory with an empty documentation. The folder is:
tsc_sphinx/training/. The folder contains also the same windows .bat files that can be used to build
the documentation in a Windows environment.
This empty documentation can be used for training purposes.
Under Windows, to generate the training documentation, starting from the root of the iEVC source code:
cd tsc_sphinx
cd tsc_training
.\make_html.bat
Under Linux, use the sphinx-build command directly to generate your documentation:
cd tsc_sphinx
cd tsc_training
sphinx-build -b html . _build/doc/html
SIX
BASIC DOCUMENTATION
reStructuredText (reST) is the default plain text markup language used by Sphinx. This language was initially
developed as part of the Docutils project.
Docutils provides the basic reStructuredText syntax, while Sphinx extends this to support additional functionality.
Finally, the TSC Sphinx extension adds yet additional functionality.
This section provides the basics of reStructuredText for writing documentation. It is a compressed version of the
equivalent section in the Sphinx reference documentation.
It does not cover the TSC-specific extensions.
To get started, this is an example of what a minimal Sphinx document looks like:
===========
Hello World
===========
Chapter 1
*********
Chapter 1.1
###########
Chapter 2
*********
6.1.2 Roles
A role or “custom interpreted text role” (role) is an inline piece of explicit markup. It signifies that the enclosed
text should be interpreted in a specific way.
Roles are introduced between two ‘:’, and the text to interpret follows between two ‘`’.
This will look like this:
The most useful roles are presented in Inline markup (a.k.a. roles) below, while the Sphinx roles documentation
provides the full list.
6.1.3 Directives
Directives can be used to highlight a very large range of items of interest in the text. This is used heavily by the
Sphinx and the TSC extension (for example, to highlight requirements, activities, artifacts, etc).
A directive is a generic block of explicit markup. Along with roles, it is one of the extension mechanisms of reST,
and Sphinx makes heavy use of it.
Basically, a directive consists of a name, arguments, options and content (keep this terminology in mind, it is used
in the next chapters describing custom directives). Let’s look at this example,
.. function:: foo(x)
foo(y, z)
:module: some.module.name
function is the directive name. It is given two arguments here, the remainder of the first line and the second
line, as well as one option module (as you can see, options are given in the lines immediately following the
arguments and indicated by the colons). Options must be indented to the same level as the directive content.
The directive content follows after a blank line and is indented relative to the directive start or if options are
present, by the same amount as the options.
Be careful as the indent is not a fixed number of whitespace, e.g. three, but any number whitespace. This can be
surprising when a fixed indent is used throughout the document and can make a difference for directives which
are sensitive to whitespace. Compare:
.. code-block::
:caption: A cool example
.. code-block::
In the first code block, the indent for the content was fixated by the option line to three spaces, consequently the
content starts with four spaces. In the latter the indent was fixed by the content itself to seven spaces, thus it does
not start with a space.
Sphinx adds additional directives. This document presents the most useful ones.
6.2 Paragraphs
The paragraph is the most basic block in a reST document. Paragraphs are simply chunks of text separated by one
or more blank lines. As in Python, indentation is significant in reST, so all lines of the same paragraph must be
left-aligned to the same level of indentation.
List markup is natural: just place an asterisk at the start of a paragraph and indent properly. The same goes for
numbered lists; they can also be auto-numbered using a # sign:
Nested lists are possible, but be aware that they must be separated from the parent list items by blank lines:
* this is
* a list
next term
Description.
Note that the term cannot have more than one line of text.
Quoted paragraphs are created by just indenting them more than the surrounding paragraphs.
Literal code blocks are introduced by ending a paragraph with the special marker ::. The literal block must be
indented (and, like all paragraphs, separated from the surrounding ones by blank lines):
6.6 Tables
.. list-table:: Title
:widths: 25 25 50
:header-rows: 1
It’s often easier to create tables in a program like Excel than with RST syntax. You can then save the table as a
CSV file, and reference the CSV file in your RST file where you want the table to go.
When you have a CSV file, reference it with the .. csv-table:: directive. For widths, use the percentage
width of each column (without the % sign). For header rows, typically use 1.
Make sure the parameters match the content of the CSV file.
Within the CSV file, you can use RST markup just as you would if writing in directly in the RST file.
Some tables may be very long and span multiple pages when generating the documentation in a paginated format
such as PDF. In this case, it is necessary to use the class option and set it to the value longtable as in the
following example. This instructs the builders to split the table over multiple pages.
It is also possible to use grid tables (grid-tables) and simple tables (simple-tables).
6.7 Hyperlinks
Use `Link text <https://domain.invalid/>`_ for inline web links. If the link text should be the
web address, you don’t need special markup at all, the parser finds links and mail addresses in ordinary text.
Important: There must be a space between the link text and the opening < for the URL.
Internal linking is done via a special reST role provided by Sphinx, see the section on specific markup, Cross-
referencing arbitrary locations.
6.8 Sections
Section headers (sections) are created by underlining (and optionally overlining) the section title with a punctua-
tion character, at least as long as the text:
=================
This is a heading
=================
Normally, there are no heading levels assigned to certain characters as the structure is determined from the suc-
cession of headings. However, this convention is used in Python’s Style Guide for documenting which you may
follow:
• # with overline, for parts
• * with overline, for chapters
• =, for sections
• -, for subsections
• ^, for sub subsections
• ", for paragraphs
Of course, you are free to use your own marker characters (see the reST documentation), and use a deeper nesting
level, but keep in mind that most target formats (HTML, LaTeX) have a limited supported nesting depth.
A role or “custom interpreted text role” (role) is an inline piece of explicit markup. It signifies that the enclosed
text should be interpreted in a specific way. Sphinx uses this to provide semantic markup and cross-referencing of
identifiers, as described in the appropriate section. The general syntax is :rolename:`content`.
Docutils supports the following roles:
• emphasis – equivalent of *emphasis*
• strong – equivalent of **strong**
• literal – equivalent of ``literal``
• subscript – subscript text
• superscript – superscript text
• title-reference – for titles of books, periodicals, and other materials
Sphinx adds additional roles. We present here the most useful ones.
:ref:
To support cross-referencing to arbitrary locations in any document, the standard reST labels are used. For
this to work label names must be unique throughout the entire documentation. There are two ways in which
you can refer to labels:
• If you place a label directly before a section title, you can reference to it with :ref:`label-name`.
For example:
.. _my-reference-label:
Section to cross-reference
--------------------------
The :ref: role would then generate a link to the section, with the link title being “Section to cross-
reference”. This works just as well when section and reference are in different source files.
Automatic labels also work with figures. For example:
.. _my-figure:
.. figure:: whatever
Figure caption
In this case, a reference :ref:`my-figure` would insert a reference to the figure with link text
“Figure caption”.
The same works for tables that are given an explicit caption using the table directive.
• Labels that aren’t placed before a section title can still be referenced, but you must give the link an
explicit title, using this syntax: :ref:`Link title <label-name>`.
Note: Reference labels must start with an underscore. When referencing a label, the underscore must be
omitted (see examples above).
Using ref is advised over standard reStructuredText links to sections (like `Section title`_) be-
cause it works across files, when section headings are changed, will raise warnings if incorrect, and works
for all builders that support cross-references.
:numref:
Link to the specified figures, tables, code-blocks and sections; the standard reST labels are used. When you
use this role, it will insert a reference to the figure with link text by its figure number like “Fig. 1.1”.
If an explicit link text is given (as usual: :numref:`Image of Sphinx (Fig. %s)
<my-figure>`), the link caption will serve as title of the reference. As placeholders, %s and {num-
ber} get replaced by the figure number and {name} by the figure caption. If no explicit link text is given, the
numfig_format setting is used as fall-back default.
If numfig is False, figures are not numbered, so this role inserts not a reference but the label or the link
text.
:term:
Reference to a term in a glossary. A glossary is created using the glossary directive containing a defini-
tion list with terms and definitions. It does not have to be in the same file as the term markup, for example
the Python docs have one global glossary in the glossary.rst file.
If you use a term that’s not explained in a glossary, you’ll get a warning during build.
6.9.5 Math
:math:
Role for inline math. Use like this:
Refer to the math directive documentation for more information about the math syntax.
.. toctree::
:maxdepth: 2
intro
strings
datatypes
numeric
(many more documents listed here)
.. toctree::
intro
All about strings <strings>
datatypes
The second line above will link to the strings document, but will use the title “All about strings” instead
of the title of the strings document.
You can also add external links, by giving an HTTP URL instead of a document name.
Section numbering
If you want to have section numbers even in HTML output, give the toplevel toctree a numbered option.
For example:
.. toctree::
:numbered:
foo
bar
Numbering then starts at the heading of foo. Sub-toctrees are automatically numbered (don’t give the
numbered flag to those).
Numbering up to a specific depth is also possible, by giving the depth as a numeric argument to numbered.
Additional options
You can use the caption option to provide a toctree caption and you can use the name option to provide
an implicit target name that can be referenced by using ref:
.. toctree::
:caption: Table of Contents
:name: mastertoc
foo
If you want only the titles of documents in the tree to show up, not other headings of the same level, you
can use the titlesonly option:
.. toctree::
:titlesonly:
foo
bar
You can use “globbing” in toctree directives, by giving the glob flag option. All entries are then matched
against the list of available documents, and matches are inserted into the list alphabetically. Example:
.. toctree::
:glob:
intro*
recipe/*
*
This includes first all documents whose names start with intro, then all documents in the recipe folder,
then all remaining documents (except the one containing the directive, of course.)
The special entry name self stands for the document containing the toctree directive. This is useful if you
want to generate a “sitemap” from the toctree.
You can use the reversed flag option to reverse the order of the entries in the list. This can be useful
when using the glob flag option to reverse the ordering of the files. Example:
.. toctree::
:glob:
:reversed:
recipe/*
You can also give a “hidden” option to the directive, like this:
.. toctree::
:hidden:
doc_1
doc_2
This will still notify Sphinx of the document hierarchy, but not insert links into the document at the location
of the directive – this makes sense if you intend to insert these links yourself, in a different style, or in the
HTML sidebar.
In cases where you want to have only one top-level toctree and hide all other lower level toctrees you can
add the includehidden option to the top-level toctree entry:
.. toctree::
:includehidden:
All other toctree entries can then be eliminated by the “hidden” option.
In the end, all documents in the source directory (or sub-directories) must occur in some toctree directive;
Sphinx will emit a warning if it finds a file that is not included, because that means that this file will not be
reachable through standard navigation.
Use exclude_patterns in your configuration file to explicitly exclude documents or directories from
building completely.
The “root document” (selected by the root_doc option in the configuration file) is the “root” of the TOC
tree hierarchy. It can be used as the documentation’s main page, or as a “full table of contents” if you don’t
give a maxdepth option.
Admonitions are used to highlight messages in the text. In most themes, these are rendered as colored boxes. This
is an example of warning admonition directive:
It is rendered as follows:
The possible admonitions are attention, caution, danger, error, hint, important, note, tip,
warning and the generic admonition. Most themes style only “note” and “warning” specially.
6.12.1 Images
.. image::
This directive inserts an image with a label.
The URI for the image source file is specified in the directive argument. For example:
.. image:: picture.jpeg
:height: 100px
:width: 200 px
:scale: 50 %
:alt: alternate text
:align: right
width [length (in px or cm) or percentage of the current line width] The width of the image. Used to
reserve space or scale the image horizontally. As with “height” above, when the “scale” option is also
specified, they are combined.
scale [integer percentage (the “%” symbol is optional)] The uniform scaling factor of the image. The
default is “100 %”, i.e. no scaling.
align [“top”, “middle”, “bottom”, “left”, “center”, or “right”] The alignment of the image, equivalent to
the HTML <img> tag’s deprecated “align” attribute or the corresponding “vertical-align” and “text-
align” CSS properties. The values “top”, “middle”, and “bottom” control an image’s vertical alignment
(relative to the text baseline); they are only useful for inline images (substitutions). The values “left”,
“center”, and “right” control an image’s horizontal alignment, allowing the image to float and have the
text flow around it. The specific behavior depends upon the browser or rendering software used.
target [text (URI or reference name)] Makes the image into a hyperlink reference (“clickable”). The
option argument may be a URI (relative or absolute), or a reference name with underscore suffix (e.g.
`a name`_).
When used within Sphinx, the file name given (here picture.jpeg) must either be relative to the source file, or
absolute which means that they are relative to the top source directory. For example, the file sketch/spam.rst
could refer to the image images/spam.png as ../images/spam.png or /images/spam.png.
Sphinx will automatically copy image files over to a sub-directory of the output directory on building (e.g. the
_static directory for HTML output.)
Interpretation of image size options (width and height) is as follows: if the size has no unit or the unit is pixels,
the given size will only be respected for output channels that support pixels. Other units (like pt for points) will
be used for HTML and LaTeX output (the latter replaces pt by bp as this is the TeX unit such that 72bp=1in).
Sphinx extends the standard docutils behavior by allowing an asterisk for the extension:
.. image:: gnu.*
Sphinx then searches for all images matching the provided pattern and determines their type. Each builder then
chooses the best image out of these candidates. For instance, if the file name gnu.* was given and two files
gnu.pdf and gnu.png existed in the source tree, the LaTeX builder would choose the former, while the HTML
builder would prefer the latter.
6.12.2 Figures
.. figure::
A “figure” consists of image data (including image options), an optional caption (a single paragraph), and
an optional legend (arbitrary body elements). For page-based output media, figures might float to a different
position if this helps the page layout.
.. figure:: picture.png
:scale: 50 %
:alt: map to buried treasure
+-----------------------+-----------------------+
| Symbol | Meaning |
+=======================+=======================+
(continues on next page)
There must be blank lines before the caption paragraph and before the legend. To specify a legend without
a caption, use an empty comment (“..”) in place of the caption.
The “figure” directive supports all of the options of the “image” directive (see Images above). These options
(except “align”) are passed on to the contained image.
align [“left”, “center”, or “right”] The horizontal alignment of the figure, allowing the image to float and
have the text flow around it. The specific behavior depends upon the browser or rendering software
used.
In addition, the following options are recognized:
figwidth [“image”, length, or percentage of current line] width The width of the figure. Limits the
horizontal space used by the figure. A special value of “image” is allowed, in which case the included
image’s actual width is used. If the image file is not found or the required software is unavailable, this
option is ignored.
Sets the “width” attribute of the “figure” directive element.
This option does not scale the included image; use the “width” option for that.
+---------------------------+
| figure |
| |
|<------ figwidth --------->|
| |
| +---------------------+ |
| | image | |
| | | |
| |<--- width --------->| |
| +---------------------+ |
| |
|The figure's caption should|
|wrap at this width. |
+---------------------------+
.. include:: zarathustra.rst
.. literalinclude:: filename
This includes a file as if it were a code sample to be included literally. Use the language option to specify
the language. If Sphinx is able to parse the language, it will highlight the syntax accordingly. Use the
linenos option to display the line numbers.
This is an example:
.. literalinclude:: code.c
:language: c
:linenos:
There are multiple possible options, that are documented in the Sphinx documentation here.
.. only:: <expression>
Include the content of the directive only if the expression is true. The expression should consist of tags, like
this:
Undefined tags are false, defined tags (via the -t command-line option or within conf.py) are true.
Boolean expressions, also using parentheses (like html and (latex or draft)) are supported.
The format and the name of the current builder (html, latex or text) are always set as a tag. To
make the distinction between format and name explicit, they are also added with the prefix format_ and
builder_, e.g. the epub builder defines the tags html, epub, format_html and builder_epub.
These standard tags are set after the configuration file is read, so they are not available there.
All tags must follow the standard Python identifier syntax as set out in the Identifiers and keywords docu-
mentation. That is, a tag expression may only consist of tags that conform to the syntax of Python variables.
In ASCII, this consists of the uppercase and lowercase letters A through Z, the underscore _ and, except for
the first character, the digits 0 through 9.
Warning: This directive is designed to control only content of document. It could not control sections,
labels and so on.
.. code-block:: ruby
The directive’s alias name sourcecode works as well. This directive takes a language name as an ar-
gument. It can be any lexer alias supported by Pygments. If it is not given, the setting of highlight
directive will be used. If not set, highlight_language will be used.
options
.. code-block:: ruby
:linenos:
.. code-block:: ruby
:lineno-start: 10
.. code-block:: python
:emphasize-lines: 3,5
def some_function():
interesting = False
print 'This line is highlighted.'
print 'This one is not...'
print '...but this one is.'
.. code-block:: python
:caption: this.py
:name: this-py
In order to cross-reference a code-block using either the ref or the numref role, it is necessary that
both name and caption be defined. The argument of name can then be given to numref to generate
the cross-reference. Example:
When using ref, it is possible to generate a cross-reference with only name defined, provided an
explicit title is given. Example:
.. code-block:: ruby
:dedent: 4
6.15 Glossary
.. glossary::
This directive must contain a reST definition-list-like markup with terms and definitions. The definitions
will then be referenceable with the term role. Example:
.. glossary::
environment
A structure where information about all documents under the root is
saved, and used for cross-referencing. The environment is pickled
after the parsing stage, so that successive runs only need to read
and parse new and changed documents.
source directory
The directory which, including its subdirectories, contains all
source files for one Sphinx project.
In contrast to regular definition lists, multiple terms per entry are allowed, and inline markup is allowed in
terms. You can link to all of the terms. For example:
.. glossary::
term 1
term 2
Definition of both terms.
(When the glossary is sorted, the first term determines the sort order.)
If you want to specify “grouping key” for general index entries, you can put a “key” as “term : key”. For
example:
.. glossary::
term 1 : A
term 2 : B
Definition of both terms.
Note that “key” is used for grouping key as is. The “key” isn’t normalized; key “A” and “a” become
different groups. The whole characters in “key” is used instead of a first character; it is used for “Combining
Character Sequence” and “Surrogate Pairs” grouping key.
In i18n situation, you can specify “localized term : key” even if original text only have “term” part. In this
case, translated “localized term” will be categorized in “key” group.
6.16 Math
The input language for mathematics is LaTeX markup. This is the generally accepted standard for plain-text math
notation and has the added advantage that no further translation is necessary when building LaTeX output.
For a guide to LaTeX math, the reader may refer to [TSC-SPHINX-MANUAL-R4-MATH].
.. math::
Directive for displayed math (math that takes the whole line for itself).
The directive supports multiple equations, which should be separated by a blank line:
.. math::
In addition, each single equation is set within a split environment, which means that you can have mul-
tiple aligned lines in an equation, aligned at & and separated by \\:
.. math::
When the math is only one line of text, it can also be given as a directive argument:
Normally, equations are not numbered. If you want your equation to get a number, use the label option.
When given, it selects an internal label for the equation, by which it can be cross-referenced, and causes an
equation number to be issued. See eq for an example. The numbering style depends on the output format.
There is also an option nowrap that prevents any wrapping of the given math in a math environment. When
you give this option, you must make sure yourself that the math is properly set up. For example:
.. math::
:nowrap:
\begin{eqnarray}
y & = & ax^2 + bx + c \\
f(x) & = & x^2 + 2xy + y^2
\end{eqnarray}
6.17 Footnotes
For footnotes (footnotes), use [#name]_ to mark the footnote location, and add the footnote body at the bottom
of the document after a “Footnotes” rubric heading, like so:
.. rubric:: Footnotes
You can also explicitly number the footnotes ([1]_) or use auto-numbered footnotes without names ([#]_).
6.18 Citations
Standard reST citations are supported, with the additional feature that they are “global”, i.e. all citations can be
referenced from all files. Use them like so:
Important: The citations are global. Therefore, use different identifiers in each reST source file to avoid refer-
encing citations from another document.
This is bad:
My document
===========
This is good:
My document
===========
Citation usage is similar to footnote usage, but with a label that is not numeric or begins with #.
6.19 Substitutions
reST supports “substitutions”, which are pieces of text and/or markup referred to in the text by |name|. They
are defined like footnotes with explicit markup blocks, like this:
or this:
If you want to use some substitutions for all documents, put them into rst_prolog or rst_epilog or put
them into a separate file and include it into all documents you want to use them in, using the include directive.
(Be sure to give the include file a file name extension differing from that of other source files, to avoid Sphinx
finding it as a standalone document.)
6.20 Comments
Every explicit markup block which isn’t a valid markup construct (like the footnotes above) is regarded as a
comment. For example:
.. This is a comment.
You can indent text after a comment start to form multi-line comments:
..
This whole indented block
is a comment.
SEVEN
GENERALITIES
When you use a TSC directive, the data of the directives (e.g. its argument and options) is captured in a database
in memory, where each type of directive correspond to a table of data.
As an example, if you declare a requirement using the tsc_req directive, like this:
The data of the directive is captured as a row in a table containing all the requirements declared in the documen-
tation.
In this database, Sphinx will automatically create a unique identifier for each TSC directive declared. This identi-
fier will start by the identifier of the directive, followed by a unique identification string.
The identifier string is directive dependent. For most directives, it is built from the argument itself. For some
others it is built from an explicit id field (this is the case for requirements).
Important: Sphinx guarantees unicity of identifiers. If you attempt to create two directives with identical
identifiers, an error will be generated.
Note: Identifiers all start with the name of the directives, are lower-cased and hyphenated. This type of identifier
is known as a Slug. Such identifiers can be used for various technical purposes such as printing or defining web
links related to the directive.
When reporting errors, Sphinx will mention the identifier of the offending directive, as well as the document name
and line number.
It is possible to dump the database of all directives in a JSON format. See tsc_json. This is extremely useful to
perform qualitative analysis on the documentation content.
30 of 101 7. Generalities
05a0a6b4abdd927fe30de7643a36765158c9b1bc
TSC Sphinx Extension User Manual
By default, TSC directive declarations are rendered in boxes. The boxes are split in two sections: a header and a
body. The header contains the directive argument, while the body contains the directive’s body.
The header contains two sub-boxes.
• The Data box contains the directive meta-data.
• The Referenced by box lists all the places where the directive is referenced. This is useful to follow, for
example, traceability links between requirements.
When rendered, the directive argument is post-fixed with a minimal set of meta-data. This allows to spot the
declarations when they are not rendered the standard ways.
In HTML, Data and Referenced by boxes are rendered as buttons. Click on these buttons to read the data. It is
possible to hide these boxes completely by clicking on the “hide all” button that is on the upper right corner of the
screen.
In Latex / PDF, only a subset of Data boxes are rendered. This is defined statically for each directive type. Refer
to Directives reference.
7.3 Cross-referencing
:tsc:
This role provides an inline cross-reference to any arbitrary tsc directive definition. The string should be
composed of the name of the directive (without the tsc_ prefix), a column (‘:’) and the directive argument
or identifier.
This is an example:
.. tsc_role:: Bryan
Where is :tsc:`role:Bryan`?
:tsc_artifact:
This role provides an inline cross-reference to an artifact. In HTML, the role is rendered as an hyperlink
to the corresponding HTML page, while in PDF, if possible, the role is rendered as an hyperlink to corre-
sponding PDF.
The tsc_artifact role should be used when citing artifacts. For example.
Reference documents
-------------------
Note: The version of the artifact is not shown by the role. The reason behind this decision is that if we show the
version, then we will have to change all referencing document version every time a document takes a new version.
This is simply not manageable.
You can use the :hidden: option to hide the directive from the rendered document. What happens is that the
directive content is inserted as a comment in the generated documentation.
For example:
.. tsc_role:: Ninja
:hidden:
Important: Hidden directive data is still captured. Only the rendering is commented out.
Sometimes it is better to render directives as a simple paragraph, and remove all the meta data. This is achieved
by using the as_paragraph option, like this:
It is possible to render directive declarations as a section of the document. Use the as_section option. This is
an example:
EIGHT
ARTIFACTS
Artifacts represents the result of an activity. Typical artifacts are documents, data files, or software code.
The main challenge of managing artifacts is to keep track of where artifacts are stored, as well as their various
versions.
Important: This is a very difficult thing to do with a large number of artifacts being constantly updated by a herd
of contributors. The directives presented here were designed with the goal of ensuring that no modification could
go unnoticed, and to ensure that artifacts are stored in a controlled way.
8. Artifacts 33 of 101
05a0a6b4abdd927fe30de7643a36765158c9b1bc
TSC Sphinx Extension User Manual
An external artifact must be stored somewhere. If you declare an artifact as above, Sphinx will generate a warning
like this:
You can specify where to find an artifact using the base_url, path and filename options. This is useful if
you want to reference artifacts that are external to those produced by the considered project (e.g. standards, texts
of law, etc).
Every declared artifact has a status option. By default, the status is ‘Planned’, meaning that the artifact is
planned to be produced but is not yet available. The two other options possible are ‘Review’ and ‘Published’. The
purpose of this status will be discussed further in Publishing Sphinx artifacts. In the case of an external artifact,
the status should logically be Published.
Note: Based on this declaration, Sphinx will try to guess the MIME type of the file. You can force the mime type
using the mime option.
If you observe the generated documentation in HTML, you will notice that a ‘[Link]’ hyperlink has been added
next to the title of the artifact. This link points to the address obtained from the concatenation of the base_url,
path and filename documented for the artifact.
You can document the version of an external artifact, using the following options. These options accept any text
as input.
• current_version_name: the name of the version (e.g. ‘V1’)
• current_version_author: the author of the version (e.g. ‘Le Chiffre’)
• current_version_date: the date of the version (e.g. ‘07/07/2007’)
• current_version_authorizer: the person having authorized the artifact (e.g. ‘Ernst Stavro
Blofeld’)
To declare an artifact generated using Sphinx, use the tsc_artifact directive with the source and docname
option.
The sources of an artifact are all the files (reST and others) that are required to compile the artifact using Sphinx.
From these source files, Sphinx will calculate a numerical signature that will uniquely identify a given version of
the artifact.
Important: It is crucial to list all the files that are used to compile the document. When displaying figures, for
example, you need to include the figures’ image files in the list.
After documentation is generated, the data section of the artifact declaration will contain the calculated signature.
The docname is the name of the sphinx document that you want to use as the root for generating a corresponding
PDF document. Let us take the example of the TSC Sphinx directive reference document:
The source files are specified relative to a tsc_src_dir configuration option in the conf.py file.
The sphinx docname is given relative to the root document. It is the name of the reST file, without the .rst
extension.
To declare a generic artifact, use the tsc_artifact directive with the generic option.
You can then declare other artifacts as concrete instances of a given generic artifact. For instance:
This can be used to ensure that all the generic artifacts planned in the various plans are instantiated properly
somewhere in the documentation.
To declare a software artifact, use the tsc_artifact directive with the source and type option.
The source should specify where to find the various software files to consider. You may use glob patterns when
specifying the source.
Set the type option to Software.
For example:
.. tsc_artifact:: DOOM
:source: doom/src/*.c,
doom/include/*.h
:type: Software
A numerical signature will be computed on the source files. In addition, the source files will be zipped in a file
bearing the name of the artifact and its current version will be created. It can be accessed by the ‘[Link]’ hyperlink.
In order to document the version of a declared artifact, use the tsc_artifact_version directive. This
directive does not take any argument but has three mandatory options:
• artifact: The name of the artifact.
• name: The name of the version. This is free text. Examples: ‘V1’, ‘DRAFTV1’;
• date: The date of the version. This is free text. No formatting check is done.
In addition, the following options should be documented:
• author: The author of the version. This is free text.
• authorizer: The authorizer of the version. This is free text.
• description: The description of the version. This is free text.
• mr: Merge request identifier. It is assumed by Sphinx that a revision control system is in place to control the
changes in the source files of the artifact. Therefore, the review of changes leading to a new version should
be documented in a suitable Merge request (Gitlab terminology) or Pull request (GitHub terminology).
Finally, remember that Sphinx computes a unique numerical signature for its artifacts. By documenting the
signature field with this signature, it is possible to tie the documented version to a specific version of the
artifact.
Note: After documentation is generated, the data section of the artifact declaration contains the calculated
signature. This signature should be used to populate the signature field.
.. tsc_artifact_version::
:name: V1
:date: 2006
:artifact: Plan for world domination
:author: Le Chiffre
:authorizer: Ernst Stavro Blofeld
:description: Add proposed Poker game at Casino Royal
:signature: 123456780
.. tsc_artifact_version::
:name: V2
:date: 2008
:artifact: Plan for world domination
:author: Dominic Green
:authorizer: Ernst Stavro Blofeld
:description: Hoard water in the Bolivian desert
:signature: 987654321
Sphinx uses the signature data to determine if the current version of the artifact is documented.
If the version is documented, it uses this knowledge to automatically determine the value of the
current_version_name of the artifact. If the signature of the artifact corresponds to none of those doc-
umented in a tsc_artifact_version declared for the artifact, then current_version_name takes the
value ‘DRAFT’.
Important: In other words, if you make any change to the source of an artifact, it becomes a draft. This is the
whole purpose of this mechanism.
The astute reader will have noticed that it is not possible to document the version of artifacts in the artifact source
code itself. Indeed, the signature is computed on the source, so, if we write the signature in the source, the
signature is modified, leading to a never-ending draft state:
source -> signature A -> update source with signature A -> signature B -> ...
Therefore, artifact versions should be documented in reST files alongside the actual content files. For instance in
a version.rst file.
Note: It is also possible to document version in a tabular file (Excel or CSV), and import the data. Refer to
Importing directives from Excel.
Use the tsc_artifact_history directive to insert the revision history of an artifact in the documentation.
In the generated documentation, all documented versions will be recapitulated in a table.
The directive displays also the current version of the artifact, based on its signature and documented version. The
current signature is also documented.
It is convenient to have an hyperlink to the MR appear in the table. To achieve this, it is necessary to specify in
the conf.py file what is the URL of the gitlab or GitHub server, using the tsc_mr_url option.
Use the status option of artifacts to determine the publication status of an artifact.
There are three possible status:
• The default status is ‘Planned’. It corresponds to artifacts that are in draft and are not supposed to be
published;
• The status ‘Review’ identifies the artifacts that should be published only for review;
• Finally, the status ‘Published’ identifies those artifacts that have been authorized to be published;
It is assumed that an automated process will pick this status to determine if a PDF should be generated for each
artifact.
Note: What follows illustrates what happens in the case of the iEVC project.
Typically:
• This is done in the conf.py
• This depends on the GIT branch you are working on
If you are working on a master branch, then automated process will generate the PDF for all published artifacts.
If there are published artifacts in draft, then this will result into an error.
If you are working on a non-master branch, then automated process should generate the PDF only for artifacts in
review and published artifacts in draft.
Note: This avoids generating the entire documentation on non-master branch, as this takes some time.
Finally, the automated process should pick the generated PDF and copy them over to a secure storage (the Library).
The library URL can be documented in the conf.py file using the tsc_library_url configuration option.
This option is used by Sphinx to generate hyperlinks to published artifacts in the HTML documentation.
It is possible to specify the publication status of artifacts aside the artifact declaration, using the
tsc_artifact_status directive.
.. tsc_artifact_status::
:artifact: TSC Sphinx extension user manual
:status: Published
8.10 Phase
It is possible to specify a typical project phase for each artifact. Use the phase option. The possible options are:
• 0 - Planning
• 1 - Concept
• 2 - System Definition & Operational Context
• 3 - Risk Analysis And Evaluation
• 4 - Specification Of System Requirements
• 5 - Architecture & Apportionment Of System
• 6 - Design & Implementation
• 7 - Manufacture
• Safety
• Feasibility
It is possible to specify if the document is to be systematically inspected by an independent safety assessor (ISA)
or upon request only.
Set the isa_ranking option to “Primary” if the document should be systematically inspected by the ISA.
Default value is “Secondary”.
8.12 Requirements
It is possible to specify requirements that are applicable to an artifact. Use the requirements option for that
and refer to Requirements to use this feature for requirement tracing purposes.
NINE
CONFIGURATION ITEMS
Sphinx offers numerous directives to support the TSC configuration management policy (refer to
[TSC-SPHINX-MANUAL-R2-CMP]). The reader should refer to this policy for a conceptual introduction.
.. tsc_ci:: Vinegar
.. tsc_ci:: Vinaigrette
:composed_of: Oil, Vinegar
Sometimes it is not possible to document the components of a CI where the CI is declared. In this case, use the
tsc_ci_component directive to add components to a CI.
.. tsc_ci:: Salt and Pepper
.. tsc_ci_component::
:ci: Vinaigrette
:component: Salt and Pepper
Important: The CI identifier is not based on the code but on the CI name itself. The idea being to be able to
change the code of CIs without breaking all the references in the documentation.
.. tsc_ci:: Oil
:code: V.OIL
.. tsc_ci:: Vinegar
:code: V.VINEGAR
.. tsc_ci:: Vinaigrette
:composed_of: Oil, Vinegar
:code: V
Artifacts may be linked to configuration items. This is the way to go in order to prepare a documentation list for a
given configuration item.
To add an artifact to a configuration item, either document it directly in the artifacts option of the CI, or use
the tsc_ci_artifact directive.
.. tsc_ci:: Vinaigrette
:artifacts: Recipe for vinaigrette
You may specify multiple configuration items or artifacts in the tsc_ci_artifact directive.
The directive will add all the specified artifacts to all listed CIs.
To list the artifacts for a given configuration item, use the tsc_artifact_list directive.
This directive will generate the list of all artifacts under the specified configuration items, with all their informa-
tion.
The directive automatically generates an Excel sheet listing the artifacts. This sheet can be downloaded from a
‘[Click Here to Download]’ hyperlink in HTML. In PDF, the Excel sheet is embedded in the file, and can be
downloaded by clicking on the paperclip icon next to the directive header.
You may specify the excel_only option to only generate the Excel sheet and not display the list in the docu-
ment.
9.4 Baselines
To document a baseline for a configuration, use the tsc_baseline directive. The directive will compute
a numerical signature on the configuration item by concatenation of the signatures of each and every artifact
attached to the CI.
This process is repeated recursively for the sub configuration items composing the CI.
To actually lock a baseline in configuration, document the signature using the signature option. Once this is
done, any modification to the artifacts of the baseline will be reported as an error during the build.
You may specify a name for the baseline using the name option.
To document limitations on a baseline, use the tsc_limitation directive. The limitation must receive a
unique identifier (using the id option), and be assigned to a CI (using the ci option).
For example:
.. code-block:: RST
TEN
The argument should be a unique name for the PBS. The ci option is mandatory, and should specify the CI for
which we generate the PBS.
In HTML, the directive will generate two representation:
• A tree view, that can be folded and unfolded to navigate the PBS. For each node in the tree view, the
following information is provided:
– The CI data;
– Links to the artifacts that have been assigned to the CI;
– Links to the parts that have been declared to instantiate the CI;
• An HTML table that recapitulates important data about the CI.
In order to represent the hierarchy of CI in a tabular fashion, the directive calculates for each row in the table a
hierarchical identification string (e.g. “1.1.3.2”), as well as a depth number.
Furthermore, the directive shall generate an Excel version of the PBS. This sheet can be downloaded from a ‘[Click
Here to Download]’ hyperlink in HTML. In PDF, the Excel sheet is embedded in the file, and can be downloaded
by clicking on the paperclip icon next to the directive header.
The tree view is only shown in HTML, while the table appears in other formats such as PDF.
You may specify the excel_only option to only generate the Excel sheet and not display the list in the docu-
ment.
You may specify the excel_only_in_html option to hide the table in HTML, but still show it in other
formats.
You may specify the hide_navigator option to hide HTML tree view.
ELEVEN
PARTS
A part materializes a design instance of a configuration item. It is uniquely identified by a part number and can
be ordered.
To declare a part, use the tsc_part directive. For each part, it is mandatory to specify the following options:
• part_number: in order to uniquely identify the part;
• supplier: in order to identify the supplier of the part;
Suppliers must be declared using the tsc_supplier directive.
.. tsc_supplier:: ACME
A part may be an instance of a configuration item. In that case, use the ci option to document this relationship.
Note: Once this is done, the part will appear in any PBS where the CI appears. See Product Breakdown Structure.
The following options are available to document the part (option names are self-explanatory)
• height_mm
• width_mm
• depth_mm
• length_mm
• weight_kg
• power_watt
• power_input
.. tsc_part:: Anaconda
:supplier: Nature
:part_number: BIG.SNAKE
:length_mm: 12000
Note: Depending on the type of part declared, the option may be appropriate or not.
It is possible to declare certain artifact versions as supporting documents for a part. The following supporting
documents are expected:
• Datasheets - Use the datasheet option
• Manuals - Use the manual option
• CAD models. These are 3D files that can be used in CAD tools to integrate the part in a larger drawing. -
Use the cad_model option
• Certification kit - Use the certification_kit option
• Baseline - Use the baseline option. This is especially important to document parts that represent a given
version of a software;
It is possible to declare sub parts of a part, therefore building a hierarchy of parts. To declare a sub-part, use the
sub_parts option.
By default, it is assumed that there a part contains one instance of each sub part. Where this is not the case, use
the tsc_sub_part_data directive.
This directive takes no argument, but requires that a part and a sub_part option be documented. Use the
quantity option to define the quantity of sub-part that the part must contain. The info option can be used to
provide contextual information.
.. tsc_part_data::
:part: ACME Rocket
:sub_part: ACME Rocket Engine
(continues on next page)
The argument should be a unique name for the part list. The part option is mandatory, and should specify the
part for which we generate the list.
In HTML, the directive will generate two representation:
• A tree view, that can be folded and unfolded to navigate the part list. For each node in the tree view, the
following information is provided:
– The part data;
– Links to the part documentation;
• An HTML table that recapitulates important data about the parts.
In order to represent the hierarchy of parts in a tabular fashion, the directive calculates for each row in the table a
hierarchical identification string (e.g. “1.1.3.2”), as well as a depth number.
Furthermore, the directive shall generate an Excel version of the part list. This sheet can be downloaded from
a ‘[Click Here to Download]’ hyperlink in HTML. In PDF, the Excel sheet is embedded in the file, and can be
downloaded by clicking on the paperclip icon next to the directive header.
The tree view is only shown in HTML, while the table appears in other formats such as PDF.
You may specify the excel_only option to only generate the Excel sheet and not display the list in the docu-
ment.
You may specify the excel_only_in_html option to hide the table in HTML, but still show it in other
formats.
You may specify the hide_navigator option to hide HTML tree view.
TWELVE
REQUIREMENTS
Sphinx offers numerous directives to support the TSC requirements management policy (refer to
[TSC-SPHINX-MANUAL-R1-RMP]). The reader should refer to this policy for a conceptual introduction to
the management of requirement.
To declare a requirement use the tsc_req directive. It is mandatory to provide an identifier using the id option.
For instance:
It is possible to write more precise description of the requirements in the body of the directive.
Gorgious meaning that people will *want* to use the tool after
looking at the resulting documentation.
Important: It is not recommended to include external references or directives in the body of a requirement
declaration. Sphinx will emit some informational warning when this is done. The reason is that requirements are
supposed to be atomic pieces of information. Refer to [TSC-SPHINX-MANUAL-R1-RMP].
12.2 Traceability
Use the source option to declare the source requirement of a requirement. Additionally, use the
source_justification option to justify this traceability.
12.3 Stakeholders
.. tsc_stakeholder:: Master
.. tsc_stakeholder:: Peon
The tsc_stakeholder directive provides a lot of options to capture relevant information about the stakeholder,
in line with the concepts presented in [TSC-SPHINX-MANUAL-R1-RMP]). Refer to the directive reference
12.4 Allocation
.. tsc_ci:: Sphinx
Important: Requirements may be allocated to multiple configuration items. This is extremely useful to avoid
repeating identical requirements that apply to multiple configuration items.
Equivalently, you may use the tsc_allocate directive to allocate a requirement to a CI. Specify the require-
ment(s) to allocate using the requirements option, then specify the allocated CI with the ci option. Justifica-
tion for the allocation can be given using the justification option.
.. tsc_ci:: Sphinx
Allocation to artifacts is done using the tsc_allocate directive too, with the artifact option. Use the
artifact_ref option to document a specific location in the artifact (e.g. chapter name).
Note: You can allocate requirements simultaneously to CIs, functions and artifacts using a single
tsc_allocate directive.
12.5 Status
12.6 Class
To specify a class, use the class option. Requirement classes are pre-defined. The possible values are:
• Functional
• Architecture
• Environmental
• Performance
• RAMS
• Standards
• Documentation
• Process
• Miscellaneous
It is possible to specify a compliance level for requirements. This is useful to provide a level of flexibility on the
implementation of the requirements.
The possible levels are P1, P2 or P3. A typical interpretation is:
• P1: Mandatory requirement
• P2: Negotiable requirement
• P3: Optional requirement
To specify a compliance level, use the compliance_level option.
12.8 Verification
12.9 Safety
To specify if a requirement is safety related or not, use the is_safety_related option. The possible values
are True or False.
12.10 Specifications
Once requirements are defined in various places of the documentation, it is often useful to collect and present the
requirements in a structured requirement specification.
Use the tsc_req_list directive to generate a table listing all the requirements allocated to a configuration
item.
The directive automatically generates an Excel sheet listing the requirements and the value of their options. This
sheet can be downloaded from a ‘[Click Here to Download]’ hyperlink in HTML. In PDF, the Excel sheet is
embedded in the file, and can be downloaded by clicking on the paperclip icon next to the directive header.
You may specify the excel_only option to only generate the Excel sheet and not display the list in the docu-
ment.
Note: This is useful for very large lists to avoid creating a “phone book” of requirements.
Use the tsc_req_spec directive to generate a requirement specification for a configuration item.
This powerful directive will generate sections where requirements are sorted and repeated:
• Functional requirements section, sorted by functions
• Non-functional requirements sections, sorted by class.
• Exported requirements section, sorted by stakeholders
• Unsupported requirements section
Important: The signature of an artifact using the tsc_req_spec or tsc_req_list directive will depend
on the generated content of both directive.
Therefore, if you modify a requirement in the documentation, the signature of all requirement specs listing the
requirement will be modified.
Important: The signature of an artifact using this directive will depend on the generated content.
Therefore, if you modify a requirement, or a traceability of a requirement, the signature of all artifacts showing a
related traceability matrix will be modified.
It is usually recommended to specify the excel_only option to only generate the Excel sheet and not display
the matrix in the document.
THIRTEEN
FUNCTIONS
Sphinx offer directives to document a functional analysis according to the ARCADIA methodology
[TSC-SPHINX-MANUAL-R3-ARCADIA].
To declare functions, use the tsc_function directive. The function must be given a unique identifier using the
id option.
Use the definition option to document the function purpose in plain english. This text will be inserted in the
documentation when the function needs to be introduced (e.g. requirement specifications).
Functions can be decomposed in sub-functions. To declare a function as a sub-function of another one, use the
contained_in option.
.. tsc_function:: Launch
:id: F.MOON.LAUNCH
:contained_in: F.MOON
:definition: Transport crew from ground to Earth orbit.
Note: Sphinx will automatically calculate the sub-functions list for each function. This will be reported in the in
the data box of the directive.
13.2 Allocation
Functions may be allocated to configuration items. Use the allocated_to option for that.
Functions may also be allocated to stakeholders. Use the stakeholders option for that.
.. tsc_function:: Launch
:id: F.MOON.LAUNCH
:contained_in: F.MOON
:allocated_to: SATURN 5 Rocket
Functions consume inputs and produce outputs. To declare inputs or outputs, use the
tsc_functional_variable directive.
.. tsc_functional_variable:: Water
.. tsc_functional_variable:: Coffee
You may associate functional variables to interfaces. Interfaces are represented as configuration items (see Con-
figuration items)
To do so, use the associated_interface option.
.. tsc_functional_variable:: Water
:associated_interface: Water tank
.. tsc_functional_variable:: Coffee
:associated_interface: Output tap
You may also associate interfaces to functions. Sphinx will automatically add the interfaces associated to variables
to the functions that use these variables.
Important: That way, it is not possible to forget an interface in the functional specification.
You may also specify interfaces that should be excluded from the list of associated interfaces. Use the
excluded_interface option to that effect.
Functional variables have multiple options. Refer to the directive reference for a complete list.
You may specify a realization relationship between functions defined in different phases of the system design
process.
For instance, a function F1 defined at the conceptual design stage may be realized by a function FA defined at the
architectural design stage.
This would be modeled as follows:
Conceptual stage
================
13.6 Safety
It is possible to assign a safety integrity level (SIL) to functions, To do so, use the sil option.
The possible values are:
• Undefined (the default value)
• Basic
• 1
• 2
• 3
• 4
• NA
13.7 Modes
It is possible to assign modes to a function. To do so, declare modes using the tsc_mode option, then assign
those modes to modes option of the relevant functions.
.. tsc_mode:: On
.. tsc_mode:: Off
FOURTEEN
RAMS
TSC Sphinx extension provides directives to support safety activities, in particular the definition and maintenance
of a hazard log.
To define a cause that can lead to a hazard, use the tsc_cause directive.
Mitigations are declared as regular requirements, using the tsc_req directive. However, use the
is_mitigation flag to identify the requirement as a mitigation.
To apply the mitigation to a cause, use the mitigation option on the cause.
FIFTEEN
TSC Sphinx extension provides support for defining roles and activities in plans, and produce the corresponding
RACI matrix.
15.1 RACI
In order to assign responsibility for an activity, it is necessary to define organizational roles first. Use the
tsc_role directive for that.
.. tsc_role:: Bartender
.. tsc_role:: Customer
.. tsc_role:: Waiter
Then, assign the roles to the activity. There are four possible options, according to the RACI methodology:
• responsible_roles - Role(s) in charge of doing the activity;
• accountable_role - Role ultimately accountable for the activity. There can only be one;
• consulted_roles - Role(s) consulted when doing the activity;
• informed_roles - Role(s) informed of the outcome of the activity;
This is an example.
Use the tsc_raci directive to recapitulate all the responsibilities assigned for the activities defined in the en-
closing document.
Activities consume and produce artifacts. Use the input and product options to define them. For instance:
.. tsc_artifact:: Cup
:generic: True
.. tsc_artifact:: Water
:generic: True
Furthermore, it is possible to document entry and exit criteria, that is, conditions that must be fulfilled to start
or complete the activity. Such matters are to be entered as a text paragraph using the entry_criteria and
exit_criteria options. Extending on our example:
15.3 Tools
Activities may require tools. In this case, use the tools option to reference the appropriate configuration item:
15.4 Phase
It is possible to document the CENELEC phase at which an activity belongs. Use the phase option for that
purpose. The list of possible phases is restricted. Refer to the directive reference tsc_activity.
This is example:
15.5 Requirements
It is possible to specify requirements that are applicable to an activity. Use the requirements option for that
and refer to Requirements to use this feature for requirement tracing purposes.
SIXTEEN
SEVENTEEN
A test case should be declared in the test specification artifact. To declare test cases, use the tsc_test_case
directive. The test case must be given an unique name.
.. tsc_test_case:: Unique Name
Use the requirements or interface option to document the test case traceability to requirements or inter-
faces.
.. tsc_test_case:: Unique Name1
:requirements: req_1, req_2
Use the family option to document the test case type (functional, dis-functional, integration . . . )
.. tsc_test_case:: Unique Name1
:requirements: req_1, req_2
:family: Functional
Use the required_configuration option to document the test case Device under test (DUT) configuration.
Use the action option to document the test case action to be performed when the test_case is import from
another tool. This option should take only artifact as input.
A test scenario should be declared in the test specification artifact. To declare test scenarios, use the
tsc_test_scenario directive. The test scenario must be given an unique name.
You may use the source option to document a source code file that implements the test scenario. The system
will compute automatically a signature on this source code that will be rendered in the verification traceability
matrix.
Use the family option to document the test case type (functional, dis-functional, integration . . . )
Use the test_cases option to document the test scenario traceability to test cases.
Use the required_configuration option to document the test scenario Device under test (DUT) configu-
ration.
Use the action option to document the test scenario action to be performed when the test_case is import from
another tool. This option should take only artifact as input.
.. autotsc_test_scenario:: test_parrot.test_hi
Sphinx will automatically document the source and source_signature option of the test scenario by using
the python source file.
In the documentation string of the function, you may document the options as if you were entering the test scenario
in Sphinx. In the example above, this is a possible documentation of the test_hi function.
def test_hi():
"""
:requirements: REQ_HI
This test scenario verifies that the parrot can says hi.
"""
assert parrot.say("hi") == "hi"
A static verification should be declared in the test specification artifact. To declare static verifications, use the
tsc_static_verification directive. The static verification must be given an unique name.
Use the requirements or interface option to document the static verification traceability to requirements
or interfaces.
Use the type option to document the type of static verification (Code reading, Computation etc.).
Use the artifact option if the static verification is on the artifact. In this option only previously declare artifact
should be used.
Use the ci option if the static verification is on the configuration item. In this option only previously declare
configuration item should be used.
A test scenario result should be declared in the test report artifact. To declare test scenario results, use
the tsc_test_scenario_result directive. The test scenario result must be given test scenario using
test_scenario option.
.. tsc_test_scenario_result::
:test_scenario: TS_1
Use the who option to document who perform the test scenario.
.. tsc_test_scenario_result::
:test_scenario: TS_1
:who: John Doe
Use the result option to document who perform the test scenario. The possible results are:
• OK all the check inside the test scenario are verified
• KO some check inside the test scenario are not verified
• JOK (justified OK) Some check inside the test scenario are not verified however the reason for this can be
justified.
.. tsc_test_scenario_result::
:test_scenario: TS_1
:who: John Doe
:result: ``JOK``
In case of result to JOK a justification is needed. To do that the option justification is used.
.. tsc_test_scenario_result::
:test_scenario: TS_1
:who: John Doe
:result: ``JOK``
:justification: The TS_1 is wrong only at the init this don't
have any impact on the global performance
Use the issue option to document the issue create following the execution of this test scenario.
.. tsc_test_scenario_result::
:test_scenario: TS_1
:who: John Doe
:result: ``NOK``
:issue: #1250, #1800
A static verification result should be declared in the test report artifact. To declare static verification results, use
the tsc_test_scenario_result directive. The static verification result must be given static verification
using test_scenario option.
.. tsc_static_verification_result::
:verification: SV_1
Use the who option to document who perform the static verification.
.. tsc_static_verification_result::
:verification: SV_1
:who: John Doe
Use the result option to document who perform the static verification. The possible results are:
• OK all the check inside the static verification are verified
• KO some check inside the static verification are not verified
• JOK (justified OK) Some check inside the static verification are not verified however the reason for this can
be justified.
.. tsc_static_verification_result::
:verification: SV_1
:who: John Doe
:result: ``JOK``
In case of result to JOK a justification is needed. To do that the option justification is used.
.. tsc_static_verification_result::
:verification: SV_1
:who: John Doe
:result: ``JOK``
:justification: The TS_1 is wrong only at the init this don't
have any impact on the global performance
Use the issue option to document the issue create following the execution of this static verification.
.. tsc_static_verification_result::
:verification: SV_1
:who: John Doe
:result: ``NOK``
:issue: #1250, #1800
A verification traceability matrix should be declared in the test specification artifact. To declare verification trace-
ability matrix, use the tsc_verification_traceability_matrix directive. The verification traceabil-
ity matrix must be given an title and the ci on for which you want the traceability matrix.
.. tsc_verification_traceability_matrix:: Title
:ci: Component_1
Use the filter-Function option to filter some part of the traceability matrix. This option is parameter with
a piece of python code that will return True or False based the data of an instance.
For example to trace only the requirement beginning by EN50128 you can used:
.. tsc_verification_traceability_matrix:: Title
:ci: Component_1
:filter_function: r["code"].startswith("EN50128")
Use the excel_only if you want to generate only an excel file that will be integrated in the document but not
the traceability matrix in the document itself. The possible parameter are:
• True to have only a excel file include in the document
• False to have an excel file include in the document and a table representing the traceability matrix
.. tsc_verification_traceability_matrix:: Title
:ci: Component_1
:filter_function: r["code"].startswith("EN50128")
:excel_only: True
Use the page_layout option to decide the layout of the table representing the traceability matrix. This option
is ignore if the option excel_only is at “True” The possible parameter are:
• A4 to keep it in A4
• A3_Landscape to put in in an A3 in landscape
.. tsc_verification_traceability_matrix:: Title
:ci: Component_1
:filter_function: r["code"].startswith("EN50128")
:excel_only: False
:page_layout: a3_landscape
Use the justification option to add in the justification column of the traceability matrix
a justification. This option have the following format: RequirementId1#Justification1,
RequirementId2#Justification2 with the RequirementId the Id of a requirement of the trace-
ability matrix and the Justification is in plain english
.. tsc_verification_traceability_matrix:: Title
:ci: Component_1
:filter_function: r["code"].startswith("EN50128")
:excel_only: False
:page_layout: a3_landscape
:justification: ReqId1:Justif1,ReqId2:Justif2,ReqId3,Justif3
A interface traceability matrix should be declared in the test specification artifact. To declare interface traceability
matrix, use the tsc_interface_traceability_matrix directive. The interface traceability matrix must
be given an title.
.. tsc_interface_traceability_matrix:: Title
Use the filter-Function option to filter some part of the traceability matrix. This option is parameter with
a piece of python code that will return True or False based the data of an instance.
For example to trace only the interface beginning by IEVC.IF you can used:
.. tsc_interface_traceability_matrix:: Title
:filter_function: v["code"].startswith("IEVC.IF")
Use the excel_only if you want to generate only an excel file that will be integrated in the document but not
the traceability matrix in the document itself. The possible parameter are:
• True to have only a excel file include in the document
• False to have an excel file include in the document and a table representing the traceability matrix
.. tsc_interface_traceability_matrix:: Title
:filter_function: v["code"].startswith("IEVC.IF")
:excel_only: True
Use the page_layout option to decide the layout of the table representing the traceability matrix. This option
is ignore if the option excel_only is at “True” The possible parameter are:
• A4 to keep it in A4
• A3_Landscape to put in in an A3 in landscape
.. tsc_interface_traceability_matrix:: Title
:filter_function: v["code"].startswith("IEVC.IF")
:excel_only: False
:page_layout: a3_landscape
Use the justification option to add in the justification column of the traceability matrix
a justification. This option have the following format: RequirementId1#Justification1,
RequirementId2#Justification2 with the RequirementId the Id of a requirement of the trace-
ability matrix and the Justification is in plain english
.. tsc_interface_traceability_matrix:: Title
:filter_function: v["code"].startswith("IEVC.IF")
:excel_only: False
:page_layout: a3_landscape
:justification: ReqId1:Justif1,ReqId2:Justif2,ReqId3,Justif3
EIGHTEEN
QUALITY ASSURANCE
Use the tsc_qa_report directive to create a quality report on the generated documentation. This report anal-
yses the sphinx declaration and reports errors, warnings and information in a spreadsheet.
.. tsc_qa_report::
NINETEEN
UTILITIES
Use the tsc_recap_table directive to create a table listing the instances of a given directive.
Note: This can be seen as a query on the database of the declared TSC directives.
Warning: This directive is powerful but a bit technical. You are warned.
The directive to query should be specified using the directive_name option. Then:
• The header_fields option specifies the options of the directive that should be shown in the table, as a
python string list. To display the argument of the directive, use the name “argument”;
• The colwidths option should specify the relative width of the columns;
• The sort_key option specifies the option to use as the sorting key for the rows in the table;
It is possible to specify a python filter function. This function will take as an input a variable ‘v’ that will contain
a python dictionary of the option values of each declared directive.
The filter_function option should be a boolean expression that returns true for those directive that need to
be retained in the table.
This is a practical example:
.. tsc_role:: Ninja
.. tsc_role:: Samurai
This table will list all declared roles that contain the word
"Ninja" in their argument.
Warning: Recap tables do not influence the signature of the document. So beware that if you change
something that impacts a recap table, it will not necessarily update the document signatures.
Use the tsc_excel_data directive, specifying the path to the CSV file in the file option.
TWENTY
BUILDING DOCUMENTATION
In general, building documentation using sphinx is done using a specific sphinx-build command available in
the Python scripts directory. Call it from the directory where your conf.py file is located like this:
The -b switch allows to select the builder by its name (here html).
The second argument is the source path (where the conf.py is located). The third is the destination directory of
the documentation built.
You may tweak builder behavior using configuration variables in the conf.py file.
Each builder may have specific options. You may refer to the Sphinx builder documentation <https://www.sphinx-
doc.org/en/master/usage/builders/index.html> for a detailed description.
20.1 html
This builder produces HTML documentation. There is nothing much more to say about it.
20.2 tsc_json
TSC added a JSON builder. This builder will extract all directives data and dump it in a series of json files, each
file being named by the directive name (e.g. tsc_req.json). These files can be imported as data sources in
Excel for analysis or quality check purposes.
class tsc_sphinx.builder.TSCJSONBuilder(
app: Sphinx)
This builder exports all the directives found in the documentation as JSON objects. The builder name is
tscjson.
For each directive, a .json file is created, named after the directive (e.g. .. tsc_req:: directives
will be written to tsc_req.json).
The JSON content is a list of objects. Each object has the following standard fields:
Parameters
• docname – the name of the document where the directive is located
• lineno – the line number in the document where the directive is located
• element_id – the unique identifier for this directive declaration.
• tsc_title_string – the string to use when rendering the directive as a section
• tsc_ref_string – the string to use when displaying a link to the directive definition
from somewhere else in the documentation
In addition, each object also receives the value of the directive-specific options used in the directive decla-
ration.
The following values can be configured in your conf.py.
tsc_builder_filter
List of document names to exclude from the TSC builders. This option is useful when you want to restrict
the JSON dumps to a specific subset of the documentation. It is an empty list by default.
Note: This is used by TSC master build to remove test directives from the JSON production build.
20.3 latex
The latex builder produces latex files in the build directory, with a make file to call the PDF generator. The
general Sphinx design is that the list of PDF files to generate should be specified in a latex_documents
configuration variable.
Note: For the iEVC documentation, an automatic selection of artifact is coded in the conf.py.
The latex_documents variable is automatically filled with the artifacts that are in Review or Published status.
The only gotcha is that it is necessary to generate first the documentation in JSON to know about these artifacts
before running the latex build.
Therefore, when generating the iEVC documentation, you should run the JSON build before calling the latex
build. If you don’t, no latex code will be generated.
Note: For windows users, the make_pdf.bat script will do all that stuff for you.
tsc_latex_variables
A dictionary mapping a latex document name to a dictionary of variables. Each entry in this dictionary is a
value that will be passed to the Sphinx latex template
For example:
Will pass 42 in a variable meaningofuniverse to the latex template of the latex document galactic/
guide.
This variable can be retrieved in the Sphinx latex.tex_t template using the following syntax:
There is an annoying feature of Sphinx that, in latex and PDF, moves the reference documents out of where they
are declared to the end of the document. This behavior is not what TSC wanted, so TSC wrote a patch (called a
transform) that can be used to cancel it.
To do this, add the following lines to your conf.py:
import sphinx.builders.latex.transforms
from tsc_sphinx.builder import TSCBibliographyTransform
sphinx.builders.latex.transforms.BibliographyTransform = TSCBibliographyTransform
20.4 spelling
This is a spell checker builder that produces a spelling report. Refer to Spell checking.
TWENTYONE
SPELL CHECKING
Spelling check is done through a special builder called spelling. This builder produces a single result file
_build/doc/spelling/output.txt.
The related CMake target is tsc_doc_spelling, or under Windows:
.\make_spelling.bat
Each line in this file indicates a word that is believed to be not spelled correctly. There are two possible situations.
1. Either the word is indeed not spelled correctly. Just fix it.
2. The word is an acronym or a legit name that the dictionary used by the spelling checker does not know.
In the latter case, there are various ways to remedy the problem.
You may create a spelling_wordlist.txt file in the same directory as your conf.py. Each line of this
file documents an additional word that the spelling checker should accept. Add the word at the end of this file and
run the checker again.
It is also possible to add acceptable words in the document itself. Use the spelling directive, as follows:
.. spelling::
BizarreWord
Otherbizarreword
Finally, if there are entire sections of your document that are not to be inspected for spelling purposes, you can
use the only directive and the not modifier to have it skipped by the Sphinx spelling builder.
TWENTYTWO
EXPERIMENTAL FEATURES
To display a BOQ, use the tsc_boq directive, specifying the top-level CI using the ci option.
TWENTYTHREE
DIRECTIVES REFERENCE
This documentation enumerates all TSC Sphinx directives and details the meaning of all the available options.
23.1 tsc_activity
class tsc_sphinx.tsc_sphinx.tsc_activity
Parameters
• input – A comma separated list of tsc_artifact IDs.
• product – A comma separated list of tsc_artifact IDs.
• entry_criteria – What must be true for this activity to start.
• exit_criteria – What must be true for this activity to be considered complete.
• responsible_roles – role of the person who do the work to complete the activity
• accountable_role – role of the people that is ultimately answerable for the correct
and thorough completion of the activity,the one who ensures the prerequisites of the task
are met and who delegates the work to those responsible
• consulted_roles – role of persons whose opinions are sought
• informed_roles – role of persons, who are kept up-to-date on progress
• requirements – Requirements applicable to this activity.
• tools – Tools relevant for this activity.
• phase – Assign a V cycle phase to the activity. This is used to group related activities
in V cycle representations phase can be one of the following: 0 - Planning, 1 - Concept,
2 - System Definition & Operational Context, 3 - Risk Analysis And Evaluation, 4 -
Specification Of System Requirements, 5 - Architecture & Apportionment Of System,
6 - Design & Implementation, 7 - Manufacture, Safety, Feasibility
23.2 tsc_artifact
class tsc_sphinx.tsc_sphinx.tsc_artifact
This directive declares an artifact.
Parameters
• type – The type of artifact. Artifact type cannot be CI, and can be one of the following:
Doc, Software, Model, Excel, Software Package
• source – Source of the artifact, from which the artifact version signature is calculated.
• signature – Artifact signature. This is calculated and should not be set manually. If
set, it will be ignored.
• phase – CENELEC Phase were the artifact produced phase can be one of the follow-
ing: 0 - Planning, 1 - Concept, 2 - System Definition & Operational Context, 3 - Risk
Analysis And Evaluation, 4 - Specification Of System Requirements, 5 - Architecture
& Apportionment Of System, 6 - Design & Implementation, 7 - Manufacture, Safety,
Feasibility
• isa_ranking – Ranking of the artifact for an ISA. ISA ranking can be one of the
following: Primary, Secondary Default value is Secondary.
• requirements – Requirements applicable to this artifact.
23.3 tsc_artifact_history
class tsc_sphinx.tsc_sphinx.tsc_artifact_history
This directive represents an artifact history.
Parameters artifact – The artifact which history is to be recapped
23.4 tsc_artifact_status
class tsc_sphinx.tsc_sphinx.tsc_artifact_status
This directive documents a status of an artifact.
Parameters
• artifact – Artifact whose status will be changed.
• status – Status of the artifact. Artifacts are initially planned, then reviewed, then
published. This flag is used by TSC CI/CD to know if the artifact must be deployed to
the artifact library, copied in the review area, or left alone. Artifact status can be one of
the following: Planned, Review, Published, Obsolete Default value is Planned.
23.5 tsc_artifact_list
class tsc_sphinx.tsc_sphinx.tsc_artifact_list
This directive inserts an artifact list in the document. The list display the phase, version and status of each
artifact.
Parameters
• ci – CI for which to generate an artifact_list.
• filter_function – A piece of python code that will return True or False based the
data of an instance. The instance data is provided as a dictionary variable v.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
• recursive – If this option is set to true, the list will include all the child CIs of the
specified CIs. Boolean values must be ‘True’ or ‘False’ Default value is False.
23.6 tsc_artifact_version
class tsc_sphinx.tsc_sphinx.tsc_artifact_version
This directive documents a version of an artifact.
Parameters
• artifact – Artifact being versioned.
• name – Name of the version (it can be any string)
• date – Date of the version Correct date format is DD/MM/YYYY
• signature – Signature of the version. It is a SHA-1 hash of the concatenated source
files.
• author – Author of the document
• authorizer – Authorizer of the document
• description – Description.
• mr – Associated Merge Request (e.g. !123)
• path – Optional argument to specify a path for the version of an external artifact.
• file_name – Optional argument to specify a filename for the version of an external
artifact.
23.7 tsc_assumption
class tsc_sphinx.tsc_sphinx.tsc_assumption
Documents a assumption on a baseline.
Parameters
• id – Unique identifier of the assumption
• ci – The CI being targeted by the assumption
• source – The artifact where the assumption originates from.
• is_safety_related – Assumption is safety related. Safety related status can be
one of the following: Undefined, Yes, No. Default value is Undefined.
• is_cybersecurity_related – Assumption is cybersecurity related. Cybersecu-
rity related status can be one of the following: Undefined, Yes, No. Default value is
Undefined.
• status – documents the safety status of the assumption. Assumption status can be
one of the following: open, closed, exported. Default value is Open.
• status_justification – A text providing a justification for closing the assump-
tion.
• mitigations – Mitigation requirement to which the assumption is transferred.
23.8 tsc_attach
class tsc_sphinx.tsc_sphinx.tsc_attach
This meta-directive include a file as an attachment to a sphinx document
Parameters file – Path to the file to include.
23.9 tsc_allocate
class tsc_sphinx.tsc_sphinx.tsc_allocate
This directive allocates a requirement to a CI or an artifact.
Parameters
• requirement – The requirement to allocate
• ci – The CI on which requirements are allocated
• function – The function on which requirements are allocated
• artifact – The artifacts on which requirements are allocated
• artifact_ref – An optional reference to a specific location in the artifact (e.g. chap-
ter name)
• justification – The justification of this allocation
23.10 tsc_baseline
class tsc_sphinx.tsc_sphinx.tsc_baseline
Documents a baseline, that is, a frozen version of a configuration item. For each baseline, a signature is
calculated by compounding the signature of the artifacts of the CI and those of the sub-CIs.
A baseline is frozen when the baseline_signature option is documented with the signature of the version we
want to freeze. A human-friendly name can be documented.
If for any reason, the calculated signature deviates from the one documented, then the documented baseline
has been compromised and an error is generated.
Parameters
• ci – The CI(s) being baselined
• signature – The signature of the baseline. If the calculated signature does not match,
an error will be generated.
• name – The name of the current baseline.
• current_signature – Baseline calculated signature. This is calculated and should
not be set manually. If set, it will be ignored.
23.11 tsc_cause
class tsc_sphinx.tsc_sphinx.tsc_cause
This directive declares a cause
Parameters
• id – Unique identifier of the cause
• mitigation – Mitigation(s) for this cause
• applicable – Specifies whether the cause is applicable Boolean values must be
‘True’ or ‘False’ Default value is True.
• justification – Justifies the applicability (or not) of the cause
• source – The artifact where the source originates from.
23.12 tsc_ci
class tsc_sphinx.tsc_sphinx.tsc_ci
This directive declares a configuration item.
A term:CI is an element of the product that can be manufactured or supplied. CIs can be composed of other
CIs in order to form a bill of material.
Parameters
• code – A code for the CI. Default value is None.
• type – The type of CI. CI can have one of the following types: COTS, Generic Com-
ponent, Project, Reused. Default value is Project.
• physical_type – The physical type of CI. CI can have one the following physical
type: Hardware, Software, Interface, Data. Default value is Hardware.
• sil – The maximum SIL (or SSIL for a software) assigned to a function assigned to
this CI. SIL can have one the following value: Undefined, Basic, 1, 2, 3, 4, Na. Default
value is Undefined.
• tool_classification – When CI is a tool, the tools classification shall be de-
scribed with a directive tsc_tool_class. If such directive exists this field is filled auto-
matically. Default value is None.
• status – The status of the CI. CI can have one the following status: New, Unmodified,
Modified. Default value is New.
• part_number – The part number of the CI. For a COTS, this is provided by the
supplier of the CI.
• artifacts – Hold the list of artifacts regrouped by the CI.
• supplier – List of supplier reference for the CI. (list of supplier ID)
• purchased_by – List of entity in charge of purchasing of the item. (list of supplier
ID)
• composed_of – Hold the assembly of CI
• quantity – number of CI (used for the bill of quantity) Default value is 1.
• safety_process – A string. CI can have one the following safety processes:
Generic Product, Generic Application, Specific Application, Undefined. Default value
is Undefined.
• top_level – Declares if the CI is a top-level one or not. Boolean values must be
‘True’ or ‘False’ Default value is False.
23.13 tsc_ci_component
class tsc_sphinx.tsc_sphinx.tsc_ci_component
This directive adds components to a configuration item.
Parameters
• ci – The CI on which components should be added
• component – The components to add
23.14 tsc_ci_artifact
class tsc_sphinx.tsc_sphinx.tsc_ci_artifact
This directive adds artifacts to a configuration item.
Parameters
• ci – The CI on which artifacts should be added
• artifact – The artifacts to add
23.15 tsc_coding_rules
class tsc_sphinx.tsc_sphinx.tsc_coding_rule
This directive declares a coding rule. This directive allows to describe for a rule requirement of the standard
and application on the project.
Parameters
• standard – The name of the coding standard
• index – Index of rule in standard
• guideline – Identifier of the rule or the directive
• rule_category – Category of rule for the coding standard
• revised_category – Category of rule considered for the project
• justification – Category of rule considered for the project
• compiler_check – Check that can be done by the compiler
• code_checker – Check that can be done by the code checker
• manual_review – Manual Additional review to preform
23.16 tsc_function
class tsc_sphinx.tsc_sphinx.tsc_function
This directive identifies a function in the system.
Parameters
• id – Unique function ID. The ID given must be unique among all functions that will
be analyzed during documentation generation. Generation will fail in case it is not the
case.
• definition – Defines the function in plain english. This text will be inserted in the
documentation when the function needs to be introduced (e.g. requirement specifica-
tions).
23.17 tsc_functional_variable
class tsc_sphinx.tsc_sphinx.tsc_functional_variable
This directive identifies a functional variable in the system.
Parameters
• objective – the goal of this variable (i.e. data, trigger an action . . . ).
• description – description of this variable (i.e. explain what it represents)
• family – Hardware or Software. Family values must be ‘Hardware’ or ‘Software’
Default value is Software.
• type – the type of the variable
• format – Format of the variable (i.e.
• unit – the unit of the variable
• precision – the precision of the variable
• protocol – the communication protocol of the variable
• equivalence_class – the equivalence classes of the variable
• forbidden_data – the forbidden value of the variable
• minimum – the minimum value of the variable
• maximum – the maximum value of the variable
• behavior_outside_range – How the variable act if a value is outside of its range
• memory_management – Where this variable is recorded.
• timing_constraints – What timing constraints are on this variable
• sil – What SIL is on this variable
• associated_interface – The interfaces associated to this functional variable
• produced_by – List of functions that produce this variable. Calculated and should
not be set manually. If set, it will be ignored.
• consumed_by – List of functions that consume this variable. Calculated and should
not be set manually. If set, it will be ignored.
• contained_in – Parent functional variable. For description of structured data
• write_access – Component that has write access for the variable
• read_access – Component(s) that has(have) read access for the variable
23.18 tsc_functional_traceability
class tsc_sphinx.tsc_sphinx.tsc_function_traceability_matrix
Create a traceability matrix that associate functions of a list configuration item to function pointed by the
field realize_function
Parameters
• ci – Comma-separated list of CIs for which to generate a traceability matrix.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
• use_small_font – Use small font in pdf table, to be used for table with long func-
tion identifier Boolean values must be ‘True’ or ‘False’
• traceability_direction – Select the traceability direction top_down lists the
ci functions with the function realizing them, if any bottom-up lists the ci functions with
the function realized by them, if any Function traceability direction can be one of the
following: Bottom_Up,Top_Down Default value is bottom_up.
23.19 tsc_hazard
class tsc_sphinx.tsc_sphinx.tsc_hazard
This directive declares a cause
Parameters
• id – Unique identifier of the hazard
• status – Status of the hazard Hazard status allowed values: Open, Closed, Not Ap-
plicable. Default value is Open.
• justification_if_not_applicable – Justifies the not applicability of the
Hazard
• cause – The cause(s) of the hazard
• parent – Parent hazard
• ci – System(s) or sub-system(s) this hazard is related to
• same_scenario_as – The related causes are the same as the ones of another hazard.
23.20 tsc_hazard_log
class tsc_sphinx.tsc_sphinx.tsc_hazard_log
This directives generates the hazard log related to one or many configuration items.
Parameters
• ci – CI for which to generate the hazard log.
• with_ci_hierarchy – Select also all the ci composed Boolean values must be
‘True’ or ‘False’ Default value is True.
• hazards_only – Only show hazards, not mitigations. Boolean values must be ‘True’
or ‘False’ Default value is False.
• default_mitigation_stakeholder – This will be reported as stakeholder in
the hazard log if a given mitigation has none. Default value is -.
• na_excluded – Only show applicable hazards, not the not applicable. Boolean values
must be ‘True’ or ‘False’ Default value is False.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
23.21 tsc_interface_traceability_matrix
class tsc_sphinx.tsc_sphinx.tsc_interface_traceability_matrix
Create a traceability matrix between interfaces and test_case/test_scenario
Parameters
• filter_function – A piece of python code that will return True or False based the
data of an instance. The instance data is provided as a dictionary variable v.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
• justification – Add in the column justification the justification for each in-
terface not covered. The format was: InterfaceName1#Justification1, Interface-
Name2#Justification2. . .
23.22 tsc_limitation
class tsc_sphinx.tsc_sphinx.tsc_limitation
Documents a limitation on a baseline.
Parameters
• id – Unique identifier of the limitation
• ci – The CI being targeted by the limitation
• source – The artifact where the limitation originates from.
• is_safety_related – Requirement is safety related. Safety related status can be
one of the following: Undefined, Yes, No. Default value is Undefined.
23.23 tsc_mode
class tsc_sphinx.tsc_sphinx.tsc_mode
Documents a functional mode of a system.
23.24 tsc_qa_report
class tsc_sphinx.tsc_sphinx.tsc_qa_report
This presentation directive displays a report of all QA findings generated during the documentation genera-
tion.
23.25 tsc_part
class tsc_sphinx.tsc_sphinx.tsc_part
This directive declares a part. A part is a uniquely identifiable object that can be ordered, documented and/or
installed.
Parameters
• ci – The CI representing this part
• supplier – The supplier of the part
• sub_parts – Sub-parts of the part
• part_number – The unique number identifying this part on the supplier side.
• height_mm – For physical parts: the height of the part.
• width_mm – For physical parts: the width of the part.
• depth_mm – For physical parts: the depth of the part.
• length_mm – For physical parts: the length of the part.
• weight_kg – For physical parts: the weight of the part.
• power_watt – For physical parts: the power consumed by the part.
• power_input – For physical parts: the power input tolerated by the part.
• datasheet – Artifact providing the datasheet of the part.
• manual – Artifact providing the applicable manual(s).
• cad_model – Artifact providing the 2D or 3D model of the part
• certification_kit – Artifact providing certification material for the part
• baseline – If applicable, the CI baseline version this part represents.
23.26 tsc_part_list
class tsc_sphinx.tsc_sphinx.tsc_part_list
Produces a list of all parts composing a given part.
Parameters
• part – The part
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
• excel_only_in_html – Don’t show the full table in the HTML. Boolean values
must be ‘True’ or ‘False’ Default value is False.
• hide_navigator – Don’t show the part navigator. Boolean values must be ‘True’
or ‘False’ Default value is False.
23.27 tsc_pbs
class tsc_sphinx.tsc_sphinx.tsc_pbs
This directive inserts the product breakdown structure of a CI in the document.
Parameters
• ci – The top CI to build a PBS for.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
• excel_only_in_html – Don’t show the full table in the HTML. Boolean values
must be ‘True’ or ‘False’ Default value is False.
• hide_navigator – Don’t show the CI navigator (in html). Boolean values must be
‘True’ or ‘False’ Default value is False.
23.28 tsc_raci
class tsc_sphinx.tsc_sphinx.tsc_raci_matrix
This directive builds a responsibility assignment matrix for the current document.
Parameters
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape
• activity_label_size – Size of column that include the title of the activity De-
fault value is 12.
23.29 tsc_recap_table
class tsc_sphinx.tsc_sphinx.tsc_recap_table
This presentation directive creates a table listing the instances of a given directive.
The headings of the table use the safe bullet text representation specified for each field. For the argument
column, the table header is “Description”.
Parameters
• directive_name – The name of the directive to be recapitulated in a table
• header_fields – The name of the fields to be displayed in the columns of the table.
It must be a python list.
• ref_by_fields – The name of the ref_by fields to be displayed in columns on the
right of the table. It must be a python list.
• colwidths – The column widths. This must be a python list of integers of the same
size as the header_fields list. If size differs, columns will be assumed to have all the
same size
• sort_key – The name of the field to be used as sort key in the table.
• filter_function – A piece of python code that will return True or False based the
data of an instance. The instance data is provided as a dictionary variable v.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape
23.30 tsc_req
class tsc_sphinx.tsc_sphinx.tsc_req
Specifies a requirement, in compliance with TSC requirement management plan.
Parameters
• id – Unique requirement ID. The ID given must be unique among all requirements that
will be analyzed during documentation generation. Generation will fail in case it is not
the case.
• status – Status of the requirement. Status of requirements can be one of the follow-
ing: Applicable, Under Evaluation, Unsupported. Default value is Applicable.
• allocated_to – Comma-separated list of CIs this requirement is allocated to.
• source – Comma-separated list of requirement IDs this requirement originates from.
• source_justification – A text providing a justification for the requirement
source traceability.
• verification – Method to be used to verify this requirement. Verification method
for requirements can be one of the following: Review, Test, Analysis, Model.
• stakeholders – Comma-separated list of stakeholders for this requirement.
• exported_to – Comma-separated list of stakeholders this requirement is exported
to.
• functions – Comma-separated list of functions allocated to this requirement.
• class – Class of the requirement. Requirements classes can be one of the following:
Functional, Architecture, Environmental, Performance, Rams, Standards, Documenta-
tion, Process, Miscellaneous, Verification_Goal. Default requirement class is Miscella-
neous unless it is attached to a function (Functional).
23.31 tsc_req_list
class tsc_sphinx.tsc_sphinx.tsc_req_list
Insert a table listing the requirements of a given configuration items in the document. A link to an Excel
version is also provided.
Parameters
• ci – CI for which to generate a requirement list.
• source_ci – A list of CIs used to filter the requirements in the spec. Only require-
ments having these CIs as parent will be retained.
• exported_to – Stakeholder for which exported requirements shall be included in the
list.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
23.32 tsc_req_spec
class tsc_sphinx.tsc_sphinx.tsc_req_spec
Insert a requirement specification for a given configuration item in the document. Functional requirements
are sorted by functions, then non-functional requirements are sorted by class. Exported requirements are
sorted by stakeholders. Finally, unsupported requirements are listed unsorted.
Parameters
• ci – CI for which to generate a requirement spec.
• source_ci – A list of CIs used to filter the requirements in the spec. Only require-
ments having these CIs as parent will be retained.
23.33 tsc_req_traceability_matrix
class tsc_sphinx.tsc_sphinx.tsc_req_traceability_matrix
Create a requirement traceability matrix.
Parameters
• ci – CI for which to generate a traceability matrix.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
23.34 tsc_role
class tsc_sphinx.tsc_sphinx.tsc_role
Parameters required_skills – A comma separated list of tsc_skill IDs.
23.35 tsc_stakeholder
class tsc_sphinx.tsc_sphinx.tsc_stakeholder
Parameters
• organization – Name of the organization this stakeholder belongs to.
• roles – Roles this stakeholder has in the organization it belongs to.
• contact_details – Contact details for this stakeholder. Typically, a person that
can represent the stakeholder’s interests
• tsc_contact – Contact point for this stakeholder at TSC.
• availability – How easy it is to contact the stakeholder.
• domain – General domain of expertise of the stakeholder.
• expertise_level – Level of expertise of the stakeholder.
• goal – Goal pursued by the stakeholder with TSC products or services.
23.36 tsc_static_verification
class tsc_sphinx.tsc_sphinx.tsc_static_verification
This directive identifies a verification to perform.
Parameters
• requirements – Requirement verify by this verification.
• interface – Interface tested by this test case.
• type – The type of the verification (e.g. Code reading, Computation, etc.)
• artifact – Artifact on which verification must be made
23.37 tsc_static_verification_result
class tsc_sphinx.tsc_sphinx.tsc_static_verification_result
This directive identifies a verification result.
Parameters
• verification – Verification to be performed to product this result
• who – Person who performed the verification
• result – If this result is OK, JOK (Justified OK) or NOK Result must be ‘OK’, ‘JOK’
or ‘KO’
• justification – Justification of the JOK or a quick explanation of what was NOK.
23.38 tsc_sub_part_data
class tsc_sphinx.tsc_sphinx.tsc_sub_part_data
This directive documents the relationship between a part and its subpart. Typically, this can be used to
document quantities.
Parameters
• part – The part
• sub_part – The sub part
• quantity – The quantity of sub parts composing the part Quantity must be an integer
value or custom Default value is 1.
• info – Information about the subpart within the context of the part.
23.39 tsc_supplier
class tsc_sphinx.tsc_sphinx.tsc_supplier
This directive declares a supplier.
Parameters iso_9001_certificate – A string.
23.40 tsc_sw_standard_conformity
class tsc_sphinx.tsc_sphinx.tsc_sw_standard_conformity
This directive declares an entry in a software standard for which an analysis shall be performed by TSC and
recorded.
Parameters
• standard – The name of the standard
• index – Index of entry in standard
• id – Identifier of entry in standard
• category – Category of entry in standard
• analysis – TSC’s analysis of entry to be recorded
• requires_action – 1 if the analysis requires action from TSC
23.41 tsc_test_case
class tsc_sphinx.tsc_sphinx.tsc_test_case
This directive identifies a test case.
Parameters
• requirements – Requirement tested by this test case.
• interface – Interface tested by this test case.
• family – family of the test case (Functional, Dis-functional,. . . ).
• parameters – List of parameter and there value for this test case.
• pre-condition – Precondition needed to execute this test case.
• required_configuration – The required configuration to execute this test case
(Complete (the whole configuration),Partial (to be detailed) . . . )
• action – Artifact listing the action to be performed and the expected result for each
step of the test case.
23.42 tsc_test_case_result
class tsc_sphinx.tsc_sphinx.tsc_test_case_result
This directive identifies a test case result.
Parameters
• test_case – Test Case to be performed to product this result
• who – Person who performed the test
• result – If this result is OK, JOK or KO Result must be ‘OK’, ‘JOK’ or ‘KO’
• issue – the issue number is the result is NOK
• justification – Justification of the JOK or a quick explanation of what was KO.
23.43 tsc_test_scenario
class tsc_sphinx.tsc_sphinx.tsc_test_scenario
This directive identifies a test scenario.
Parameters
• requirements – Requirement tested by this test scenario.
• source – The eventual source code of a program that implements the test scenario
• source_signature – The signature of the source code, if source is documented.
Default value is None.
• ci – Configuration item to be tested.
• family – family of the test scenario (Functional, Dis-functional,. . . ).
• test_cases – Interface tested by this test scenario.
• parameters – List of parameter and there value for this test case.
• pre-condition – Precondition needed to execute this test scenario.
• required_configuration – The required configuration to execute this test sce-
nario (Complete (the whole configuration),Partial (to be detailed) . . . )
• action – Link to the script listing the action to be performed and the expected result
for each step of the test scenario.
23.44 tsc_test_scenario_result
class tsc_sphinx.tsc_sphinx.tsc_test_scenario_result
This directive identifies a test scenario result.
Parameters
• test_scenario – Test Case to be performed to product this result
• who – Person who performed the test
• result – If this result is OK, JOK or KO Result must be ‘OK’, ‘JOK’ or ‘KO’
• issue – the issue number is the result is NOK
• justification – Justification of the JOK or a quick explanation of what was KO.
23.45 tsc_tool_class
class tsc_sphinx.tsc_sphinx.tsc_tool_class
This directive declares a tool Classification.
A Tool Classification is an element that permit to justify the classification of the tool
Parameters
• ci – Configuration Item that identify the tool
• sub_module – Sub module of the tool concerned the classification
• version – Version and revision of the tool subject to the classification
• classification – The classification of the tool EN50128 class of the tool allowed
values
• license_type – Type of license
• use_case – Description of Use case for this tool
• required_skills – List of the required skill for the tools
• administrator – A comma separated list of tsc_role IDs.
23.46 tsc_tool_list
class tsc_sphinx.tsc_sphinx.tsc_tool_list
This directive inserts a tool list in the document.
Parameters
• filter_function – A piece of python code that will return True or False based the
data of an instance. The instance data is provided as a dictionary variable v.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape
23.47 tsc_verification_traceability_matrix
class tsc_sphinx.tsc_sphinx.tsc_verification_traceability_matrix
Create a traceability matrix between requirements and test_case/test_scenario
Parameters
• ci – CI for which to generate a traceability matrix.
• filter_function – A piece of python code that will return True or False based the
data of an instance. The instance data is provided as a dictionary variable v.
• page_layout – Select a page layout for the rendering of the table Page layout can be
one of the following: A4,A3_Landscape Default value is a3_landscape.
• excel_only – Don’t show the full table in the doc. Only provide Excel file. Boolean
values must be ‘True’ or ‘False’ Default value is False.
• justification – Add in the column justification the justification for each re-
quirement not covered. The format was: RequirementId1#Justification1, Requiremen-
tId2#Justification2. . .
23.48 tsc_xlsx_data
class tsc_sphinx.tsc_sphinx.tsc_xlsx_data
This meta-directive reads lines from an Excel sheet as if they were individual directive declarations, where
the value of each option are given in a column.
• The first line must contains the name of the TSC option corresponding to the column. The reader will
ignore columns after the first column with an empty cell on the first line.
• The last line must contain the special value TSC_EXCEL_EOF. If this line does not exist, then the
reader will attempt to read all the lines up to the value specified in the max_row parameter. When this
happens, the builder will fail to prevent data from being lost.
• There must be one column with the name ‘is_ignored’. This column can be used to instruct the Excel
reader to skip a line. Enter ‘Yes’ for the line to be ignored. By default, the line is not ignored.
Parameters
• directive_name – The name of the directive to be instantiated
• file – Path to the excel file. First sheet will be read.
• max_row – Maximum number of line to be parsed Default value is 10000.
Parameters
• of – A comma separated list of tsc_employee IDs.
• from – A string.
• to – A string.
• skill – A comma separated list of tsc_skill IDs.
class tsc_sphinx.tsc_sphinx.tsc_training
This directive records a training that an employee received.
Parameters
• of – A comma separated list of tsc_employee IDs.
• date – A string. Correct date format is DD/MM/YYYY
• skill – A comma separated list of tsc_skill IDs.
• trainer – Optional information on the trainer.
• coaching – Specify if the training included coaching. Boolean values must be ‘True’
or ‘False’ Default value is False.
• proof – Path to an evidence of the training (scan of certificate, . . . ) or a link to a Gitlab
issue
• proof_expiration_date – A string. Correct date format is DD/MM/YYYY
class tsc_sphinx.tsc_sphinx.tsc_risk
This directive represents a risk.
Parameters
• category – A string.
• possible_cause – A string.
• possible_impact – A string.
• severity_grade – A string.
• probability – A string.
class tsc_sphinx.tsc_sphinx.tsc_purchase_order
This directive represents a purchase order.
Parameters
• id – Unique purchase order ID. The ID given must be unique among all PO
• supplier – Supplier on the receiving end of the purchase order
• date – Date the PO was submitted to the supplier.
• requestor – The TSC manager who has requested the purchase order.
• approver – The TSC manager who has approved the purchase order.
• project – The project this purchase order is attached to (optional).
• file – Name of the PO document
• url – URL to the PO file (optional).
class tsc_sphinx.tsc_sphinx.tsc_it_computer
Parameters
• supplier – A string.
• location – A string.
• administrator – A string.
class tsc_sphinx.tsc_sphinx.tsc_verification
This directive declares a verification activity on a version of an artifact. Such directive is intended to be
inserted in verification reports.
Parameters
• artifact_version – The name and version of the artifact(s) verified
• date – Date of the verification
• by – Who did the verification