Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
calibration
pycalibration
Commits
886fe413
Commit
886fe413
authored
2 years ago
by
Karim Ahmed
Browse files
Options
Downloads
Patches
Plain Diff
remove conf file
parent
52a03a13
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!820
[Documentation] Introduce mkdocs and add new documentation pages
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/source/conf.py
+0
-609
0 additions, 609 deletions
docs/source/conf.py
with
0 additions
and
609 deletions
docs/source/conf.py
deleted
100644 → 0
+
0
−
609
View file @
52a03a13
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# European XFEL Offline Calibration documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 10 17:32:30 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import
glob
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import
os
import
shutil
import
sys
import
textwrap
from
datetime
import
datetime
from
subprocess
import
Popen
,
check_output
from
textwrap
import
dedent
,
indent
from
uuid
import
uuid4
import
nbformat
import
tabulate
from
dateutil.parser
import
parse
from
lxml
import
etree
from
nbconvert
import
RSTExporter
# generate the list of available notebooks
from
xfel_calibrate
import
notebooks
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions
=
[
'
sphinx.ext.autodoc
'
,
'
sphinx.ext.intersphinx
'
,
'
sphinx.ext.todo
'
,
'
sphinx.ext.mathjax
'
,
'
sphinx.ext.ifconfig
'
,
'
sphinx.ext.viewcode
'
,
]
sys
.
path
.
append
(
os
.
path
.
abspath
(
"
../pycalibration/
"
))
p
=
Popen
([
"
./makeAllDocs.sh
"
])
p
.
communicate
()
# Add any paths that contain templates here, relative to this directory.
templates_path
=
[
'
_templates
'
]
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix
=
'
.rst
'
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc
=
'
index
'
# General information about the project.
project
=
'
European XFEL Offline Calibration
'
copyright
=
'
2018, The European XFEL Detector Group
'
author
=
'
The European XFEL Detector Group
'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version
=
'
1.0
'
# The full version, including alpha/beta/rc tags.
release
=
'
1.0
'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language
=
None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
# today = ''
#
# Else, today_fmt is used as the format for a strftime call.
#
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns
=
[]
# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style
=
'
sphinx
'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos
=
True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme
=
'
sphinx_rtd_theme
'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = 'European XFEL Offline Calibration v1.0'
# A shorter title for the navigation bar. Default is the same as html_title.
#
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
# html_logo = None
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path
=
[
'
_static
'
]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#
# html_extra_path = []
# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
# html_last_updated_fmt = None
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#
# html_additional_pages = {}
# If false, no module index is generated.
#
# html_domain_indices = True
# If false, no index is generated.
#
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename
=
'
EuropeanXFELOfflineCalibrationdoc
'
# -- Options for LaTeX output ---------------------------------------------
latex_elements
=
{
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
'
extraclassoptions
'
:
'
openany, oneside
'
,
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents
=
[
(
master_doc
,
'
EuropeanXFELOfflineCalibration.tex
'
,
'
European XFEL Offline Calibration Documentation
'
,
'
The European XFEL Detector Group
'
,
'
manual
'
,
True
),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#
# latex_use_parts = False
# If true, show page references after internal links.
#
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#
# latex_appendices = []
# It false, will not define \strong, \code, itleref, \crossref ... but only
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
# packages.
#
# latex_keep_old_macro_names = True
# If false, no module index is generated.
#
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages
=
[
(
master_doc
,
'
europeanxfelofflinecalibration
'
,
'
European XFEL Offline Calibration Documentation
'
,
[
author
],
1
)
]
# If true, show URL addresses after external links.
#
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents
=
[
(
master_doc
,
'
EuropeanXFELOfflineCalibration
'
,
'
European XFEL Offline Calibration Documentation
'
,
author
,
'
EuropeanXFELOfflineCalibration
'
,
'
One line description of project.
'
,
'
Miscellaneous
'
),
]
# Documents to append as an appendix to all manuals.
#
# texinfo_appendices = []
# If false, no module index is generated.
#
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#
# texinfo_no_detailmenu = False
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping
=
{
'
https://docs.python.org/
'
:
None
}
# first install pandoc if necessary, this is mainly meant for the RTD builds
try
:
from
nbconvert.utils.pandoc
import
check_pandoc_version
check_pandoc_version
()
print
(
"
Pandoc was found!
"
)
except
:
print
(
"
Installing Pandoc!
"
)
from
subprocess
import
check_call
pandoc_url
=
"
https://github.com/jgm/pandoc/releases/download/2.2.1/pandoc-2.2.1-1-amd64.deb
"
pandoc_pack
=
"
pandoc-2.2.1-1-amd64.deb
"
check_call
([
"
wget
"
,
pandoc_url
])
check_call
([
"
dpkg
"
,
"
-i
"
,
pandoc_pack
])
rst_exporter
=
RSTExporter
()
with
open
(
"
available_notebooks.rst
"
,
"
w
"
)
as
f
:
f
.
write
(
dedent
(
"""
.. _available_notebooks:
Available Notebooks
===================
The following notebooks are currently integrated into the European XFEL
Offline Calibration tool chain.
"""
))
for
detector
in
sorted
(
notebooks
.
notebooks
.
keys
()):
# Avoid having test notebooks in detector notebooks documentations.
if
"
TEST
"
in
detector
.
upper
():
continue
values
=
notebooks
.
notebooks
[
detector
]
f
.
write
(
"
{}
\n
"
.
format
(
detector
))
f
.
write
(
"
{}
\n
"
.
format
(
"
-
"
*
len
(
detector
)))
f
.
write
(
"
\n
"
)
for
caltype
in
sorted
(
values
.
keys
()):
data
=
values
[
caltype
]
nbpath
=
os
.
path
.
abspath
(
"
{}/../../../{}
"
.
format
(
__file__
,
data
[
"
notebook
"
]))
with
open
(
nbpath
,
"
r
"
)
as
nf
:
nb
=
nbformat
.
read
(
nf
,
as_version
=
4
)
def
first_markdown_cell
(
nb
):
for
cell
in
nb
.
cells
:
if
cell
.
cell_type
==
'
markdown
'
:
return
cell
mdcell
=
first_markdown_cell
(
nb
)
nb
.
cells
=
[
mdcell
]
# we only want this single cell
body
,
_
=
rst_exporter
.
from_notebook_node
(
nb
)
adjusted
=
[]
# adjust titles
for
line
in
body
.
split
(
"
\n
"
):
if
line
.
startswith
(
"
==
"
):
line
=
line
.
replace
(
"
=
"
,
"
+
"
)
if
line
.
startswith
(
"
--
"
):
line
=
line
.
replace
(
"
-
"
,
"
~
"
)
adjusted
.
append
(
line
)
f
.
write
(
"
\n
"
.
join
(
adjusted
))
f
.
write
(
"
\n
"
)
f
.
write
(
"
To invoke this notebook and display help use:
\n\n
"
)
f
.
write
(
"
.. code-block:: bash
\n\n
"
)
f
.
write
(
"
xfel-calibrate {} {} --help
\n\n
"
.
format
(
detector
,
caltype
))
f
.
write
(
"
The full parameter list of this notebook (with defaults is):
\n\n
"
)
f
.
write
(
"
.. code-block:: bash
\n\n
"
)
nb_help
=
[
"
xfel-calibrate
"
,
detector
,
caltype
,
"
--help
"
]
output
=
check_output
(
nb_help
).
decode
(
'
utf8
'
)
f
.
write
(
indent
(
output
.
replace
(
"
DETECTOR
"
,
detector
).
replace
(
"
TYPE
"
,
caltype
),
"
"
*
4
))
f
.
write
(
"
\n\n
"
)
# add test results
test_artefact_dir
=
os
.
path
.
realpath
(
"
../../tests/legacy/artefacts
"
)
def
xml_to_rst_report
(
xml
,
git_tag
,
reports
=
[]):
e
=
etree
.
fromstring
(
xml
.
encode
())
rst
=
[
""
]
rst
+=
[
"
Test execution for {test_name} on {ex_date}
"
]
test_name
,
ex_date
=
e
.
get
(
"
name
"
).
split
(
"
-
"
)
ex_date
=
parse
(
ex_date
)
rst
[
-
1
]
=
rst
[
-
1
].
format
(
test_name
=
test_name
,
ex_date
=
ex_date
)
rst
+=
[
"
=
"
*
len
(
rst
[
-
1
])]
rst
+=
[
""
]
num_tests
=
e
.
get
(
"
tests
"
)
num_err
=
int
(
e
.
get
(
"
errors
"
))
num_fail
=
int
(
e
.
get
(
"
failures
"
))
num_skip
=
int
(
e
.
get
(
"
skipped
"
))
# create a summary header
if
num_err
+
num_fail
==
0
:
rst
+=
[
"
:header-passed:`✓`
"
]
else
:
rst
+=
[
"
:header-failed:`❌`
"
]
if
num_skip
>
0
:
rst
[
-
1
]
+=
"
:header-skipped:`⚠`
"
rst
+=
[
""
]
# give a summary
rst
+=
[
"
:Git tag: {git_tag}
"
.
format
(
git_tag
=
git_tag
)]
rst
+=
[
"
:Tests: {num_tests}
"
.
format
(
num_tests
=
num_tests
)]
rst
+=
[
"
:Errors: {num_err}
"
.
format
(
num_err
=
num_err
)]
rst
+=
[
"
:Failures: {num_fail}
"
.
format
(
num_fail
=
num_fail
)]
rst
+=
[
"
:Skipped: {num_skip}
"
.
format
(
num_skip
=
num_skip
)]
rst
+=
[
"
:Duration: {duration}s
"
.
format
(
duration
=
e
.
get
(
"
time
"
))]
for
rname
,
rpath
in
reports
:
rst
+=
[
"
:Report: `{} <{}>`_
"
.
format
(
rname
,
rpath
)]
rst
+=
[
""
]
# now the details
rst
+=
[
"
Detailed Results
"
]
rst
+=
[
"
-
"
*
len
(
rst
[
-
1
])]
rst
+=
[
""
]
detailed_failures
=
[]
rows
=
[]
for
child
in
e
:
if
child
.
tag
!=
"
testcase
"
:
continue
name
=
child
.
get
(
"
name
"
)
extime
=
child
.
get
(
"
time
"
)
status
=
"
:passed:`passed`
"
msg
=
""
etype
=
""
if
len
(
child
):
# children are pressent so test failed or skipped
detail
=
child
[
0
]
etype
=
detail
.
get
(
"
type
"
)
msg
=
detail
.
get
(
"
message
"
)
if
etype
==
"
skip
"
:
status
=
"
:skipped:`skipped`
"
else
:
status
=
"
:failed:`failed`
"
detailed_failures
.
append
((
name
,
detail
.
text
))
msg
=
"
\n
"
.
join
(
textwrap
.
wrap
(
msg
,
20
))
row
=
[
status
,
name
,
etype
,
msg
,
extime
]
rows
.
append
(
row
)
header
=
[
"
Result
"
,
"
Test
"
,
"
Error
"
,
"
Message
"
,
"
Duration (s)
"
]
tblrst
=
tabulate
.
tabulate
(
rows
,
headers
=
header
,
tablefmt
=
"
rst
"
)
rst
+=
tblrst
.
split
(
"
\n
"
)
rst
+=
[
""
]
for
test
,
report
in
detailed_failures
:
rst
+=
[
"
Failure report for: {}
"
.
format
(
test
)]
rst
+=
[
"
~
"
*
len
(
rst
[
-
1
])]
rst
+=
[
""
]
rst
+=
[
"
.. code-block:: python
"
]
rst
+=
textwrap
.
indent
(
report
,
"
"
*
4
).
split
(
"
\n
"
)
rst
+=
[
""
]
do_console
=
False
for
child
in
e
:
if
child
.
tag
==
"
system-out
"
and
len
(
child
.
text
.
strip
()):
do_console
=
True
break
if
do_console
:
# console output
rst
+=
[
"
Console Output
"
]
rst
+=
[
"
-
"
*
len
(
rst
[
-
1
])]
rst
+=
[
""
]
for
child
in
e
:
if
child
.
tag
!=
"
system-out
"
:
continue
rst
+=
[
"
.. code-block:: console
"
]
rst
+=
textwrap
.
indent
(
child
.
text
,
"
"
*
4
).
split
(
"
\n
"
)
return
"
\n
"
.
join
(
rst
)
def
sorted_dir
(
folder
):
def
getmtime
(
name
):
path
=
os
.
path
.
join
(
folder
,
name
)
return
os
.
path
.
getmtime
(
path
)
sort
=
sorted
(
os
.
listdir
(
folder
),
key
=
getmtime
,
reverse
=
True
)
return
[(
s
,
datetime
.
fromtimestamp
(
getmtime
(
s
)))
for
s
in
sort
]
header
=
"""
Test Results
++++++++++++
Results are organized by git commit, and sorted descending by date.
Contents:
.. toctree::
:maxdepth: 2
"""
if
not
os
.
path
.
exists
(
"
./test_rsts
"
):
os
.
makedirs
(
"
./test_rsts
"
)
with
open
(
"
test_results.rst
"
,
"
w
"
)
as
f
:
f
.
write
(
header
)
for
commit
,
modtime
in
sorted_dir
(
test_artefact_dir
):
with
open
(
"
./test_rsts/{}.rst
"
.
format
(
commit
),
"
w
"
)
as
fr
:
rst
=
[
"
.. include:: roles.rst
"
]
rst
+=
[
""
]
rst
+=
[
"
{} - {}
"
.
format
(
commit
[:
8
],
modtime
)]
rst
+=
[
"
+
"
*
len
(
rst
[
-
1
])]
rst
+=
[
""
]
fr
.
write
(
"
\n
"
.
join
(
rst
))
# copy reports
pdfs
=
glob
.
glob
(
"
{}/{}/*/*.pdf
"
.
format
(
test_artefact_dir
,
commit
))
if
not
os
.
path
.
exists
(
"
./_static/reports/{}
"
.
format
(
commit
)):
os
.
makedirs
(
"
./_static/reports/{}
"
.
format
(
commit
))
reports
=
{}
for
pdf
in
pdfs
:
ppath
=
"
{}/{}.pdf
"
.
format
(
commit
,
uuid4
())
shutil
.
copyfile
(
pdf
,
"
./_static/reports/{}
"
.
format
(
ppath
))
rloc
=
pdf
.
split
(
"
/
"
)[
-
2
]
rlist
=
reports
.
get
(
rloc
,
[])
rname
=
os
.
path
.
basename
(
pdf
).
split
(
"
.
"
)[
0
]
rlist
.
append
((
rname
,
"
../_static/reports/{}
"
.
format
(
ppath
)))
reports
[
rloc
]
=
rlist
xmls
=
glob
.
glob
(
"
{}/{}/*/TEST*.xml
"
.
format
(
test_artefact_dir
,
commit
))
for
xml
in
xmls
:
rloc
=
xml
.
split
(
"
/
"
)[
-
2
]
with
open
(
xml
,
"
r
"
)
as
xf
:
xs
=
xf
.
read
()
rst
=
xml_to_rst_report
(
xs
,
commit
,
reports
=
reports
.
get
(
rloc
,
[]))
fr
.
write
(
rst
)
f
.
write
(
"
test_rsts/{}
\n
"
.
format
(
commit
))
def
setup
(
app
):
app
.
add_stylesheet
(
'
css/test_decorators.css
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment