sphinx_reports
A Sphinx domain providing directives to add reports to the Sphinx-based documentation.
Supported reports:
Submodules
Functions
setup()
: Extension setup function registering thereport
domain in Sphinx.
Classes
ReportDomain
: A Sphinx extension providing areport
domain to integrate reports and summaries into a Sphinx-based documentation.
Functions
- sphinx_reports.setup(sphinxApplication)[source]
Extension setup function registering the
report
domain in Sphinx.It will execute these steps:
register domains, directives and roles.
connect events (register callbacks)
register configuration variables for
conf.py
- Parameters:
sphinxApplication (<module ‘sphinx_reports.Sphinx’ from ‘/home/runner/work/sphinx-reports/sphinx-reports/sphinx_reports/Sphinx.py’>) – The Sphinx application.
- Return type:
setup_ReturnType
- Returns:
Dictionary containing the extension version and some properties.
Classes
- class sphinx_reports.ReportDomain(env)[source]
A Sphinx extension providing a
report
domain to integrate reports and summaries into a Sphinx-based documentation.New directives:
report:dependency-table
New roles:
None
New indices:
None
Configuration variables
All configuration variables in
conf.py
are prefixed withreport_*
:report_codecov_packages
report_doccov_packages
report_unittest_testsuites
Inheritance
- Parameters:
env (BuildEnvironment)
- name = 'report'
The name of this domain
- label = 'rpt'
The label of this domain
- directives: dict[str, type[Directive]] = {'code-coverage': <class 'sphinx_reports.CodeCoverage.CodeCoverage'>, 'code-coverage-legend': <class 'sphinx_reports.CodeCoverage.CodeCoverageLegend'>, 'dependency-table': <class 'sphinx_reports.Dependency.DependencyTable'>, 'doc-coverage': <class 'sphinx_reports.DocCoverage.DocStrCoverage'>, 'doc-coverage-legend': <class 'sphinx_reports.DocCoverage.DocCoverageLegend'>, 'module-coverage': <class 'sphinx_reports.CodeCoverage.ModuleCoverage'>, 'unittest-summary': <class 'sphinx_reports.Unittest.UnittestSummary'>}
A dictionary of all directives in this domain.
- roles: dict[str, RoleFunction | XRefRole] = {}
A dictionary of all roles in this domain.
- indices: list[type[Index]] = []
A list of all indices in this domain.
-
configValues:
Dict
[str
,Tuple
[Any
,str
,Any
]] = {'codecov_levels': ({'default': {'error': {'class': 'report-cov-error', 'desc': 'internal error'}, 100: {'class': 'report-cov-below100', 'desc': 'excellently used'}, 30: {'class': 'report-cov-below30', 'desc': 'almost unused'}, 50: {'class': 'report-cov-below50', 'desc': 'poorly used'}, 80: {'class': 'report-cov-below80', 'desc': 'somehow used'}, 90: {'class': 'report-cov-below90', 'desc': 'well used'}}}, 'env', typing.Dict), 'codecov_packages': ({}, 'env', typing.Dict), 'doccov_levels': ({'default': {'error': {'class': 'report-cov-error', 'desc': 'internal error'}, 100: {'class': 'report-cov-below100', 'desc': 'excellent documented'}, 30: {'class': 'report-cov-below30', 'desc': 'almost undocumented'}, 50: {'class': 'report-cov-below50', 'desc': 'poorly documented'}, 80: {'class': 'report-cov-below80', 'desc': 'roughly documented'}, 90: {'class': 'report-cov-below90', 'desc': 'well documented'}}}, 'env', typing.Dict), 'doccov_packages': ({}, 'env', typing.Dict), 'unittest_testsuites': ({}, 'env', typing.Dict)} A dictionary of all configuration values used by this domain. (name: (default, rebuilt, type))
- initial_data: dict = {}
A dictionary of all global data fields used by this domain.
- static CheckConfigurationVariables(sphinxApplication, config)[source]
Call back for Sphinx
config-inited
event.This callback will verify configuration variables used by that domain.
See also
- Sphinx builder-inited event
See https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-core-events
- Parameters:
sphinxApplication (<module ‘sphinx_reports.Sphinx’ from ‘/home/runner/work/sphinx-reports/sphinx-reports/sphinx_reports/Sphinx.py’>) – The Sphinx application.
config (
Config
) – Sphinx configuration parsed fromconf.py
.
- Return type:
- static AddCSSFiles(sphinxApplication)[source]
Call back for Sphinx
builder-inited
event.This callback will copy the CSS file(s) to the build directory.
See also
- Sphinx builder-inited event
See https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-core-events
- Parameters:
sphinxApplication (<module ‘sphinx_reports.Sphinx’ from ‘/home/runner/work/sphinx-reports/sphinx-reports/sphinx_reports/Sphinx.py’>) – The Sphinx application.
- Return type:
- static ReadReports(sphinxApplication)[source]
Call back for Sphinx
builder-inited
event.This callback will read the linked report files
See also
- Sphinx builder-inited event
See https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-core-events
- Parameters:
sphinxApplication (<module ‘sphinx_reports.Sphinx’ from ‘/home/runner/work/sphinx-reports/sphinx-reports/sphinx_reports/Sphinx.py’>) – The Sphinx application.
- Return type:
-
callbacks:
Dict
[str
,List
[Callable
]] = {'builder-inited': [<staticmethod(<function ReportDomain.AddCSSFiles>)>, <staticmethod(<function ReportDomain.ReadReports>)>], 'config-inited': [<staticmethod(<function ReportDomain.CheckConfigurationVariables>)>]} A dictionary of all events/callbacks <https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-core-events>`__ used by this domain.
- resolve_xref(env, fromdocname, builder, typ, target, node, contnode)[source]
Resolve the pending_xref node with the given typ and target.
This method should return a new node, to replace the xref node, containing the contnode which is the markup content of the cross-reference.
If no resolution can be found, None can be returned; the xref node will :rtype:
Optional
[Element
]then given to the :event:`missing-reference` event, and if that yields no resolution, replaced by contnode.
The method can also raise
sphinx.environment.NoUri
to suppress the :event:`missing-reference` event being emitted.
- __init__(env)
- Parameters:
env (BuildEnvironment)
- Return type:
None
- add_object_type(name, objtype)
Add an object type.
- clear_doc(docname)
Remove traces of a document in the domain-specific inventories.
- dangling_warnings: dict[str, str] = {}
role name -> a warning message if reference is missing
- data_version = 0
data version, bump this when the format of self.data changes
- directive(name)
Return a directive adapter class that always gives the registered directive its full name (‘domain:name’) as
self.name
.
- enumerable_nodes: dict[type[Node], tuple[str, TitleGetter | None]] = {}
node_class -> (enum_node_type, title_getter)
- get_enumerable_node_type(node)
Get type of enumerable nodes (experimental).
- get_full_qualified_name(node)
Return full qualified name for given node.
- get_objects()
Return an iterable of “object descriptions”.
Object descriptions are tuples with six items:
name
Fully qualified name.
dispname
Name to display when searching/linking.
type
Object type, a key in
self.object_types
.docname
The document where it is to be found.
anchor
The anchor name for the object.
priority
How “important” the object is (determines placement in search results). One of:
1
Default priority (placed before full-text matches).
0
Object is important (placed before default-priority objects).
2
Object is unimportant (placed after full-text matches).
-1
Object should not show up in search at all.
- get_type_name(type, primary=False)
Return full name for given ObjType.
- merge_domaindata(docnames, otherdata)
Merge in data regarding docnames from a different domaindata inventory (coming from a subprocess in parallel builds).
- object_types: dict[str, ObjType] = {}
type (usually directive) name -> ObjType instance
- process_doc(env, docname, document)
Process a document after it is read by the environment.
- process_field_xref(pnode)
Process a pending xref created in a doc field. For example, attach information about the current scope.
- Return type:
- Parameters:
pnode (pending_xref)
- resolve_any_xref(env, fromdocname, builder, target, node, contnode)
Resolve the pending_xref node with the given target.
The reference comes from an “any” or similar role, which means that we don’t know the type. Otherwise, the arguments are the same as for
resolve_xref()
.The method must return a list (potentially empty) of tuples
('domain:role', newnode)
, where'domain:role'
is the name of a role that could have created the same reference, e.g.'py:func'
.newnode
is whatresolve_xref()
would return. :rtype:list
[tuple
[str
,Element
]]Added in version 1.3.
- role(name)
Return a role adapter function that always gives the registered role its full name (‘domain:name’) as the first argument.
- data: dict[str, Any]
data value