-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create the infrastructure for generating the Sphinx documentation. * Add a job to the CI pipeline to build the documentation. * Add a documentation badge to the README.md. * Fix Sphinx warnings/errors.
- Loading branch information
Showing
14 changed files
with
313 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Remove existing documentation to ensure we build from scratch. | ||
if [ -e html ]; then | ||
rm -rf html | ||
fi | ||
|
||
# Build the Sphinx documentation for `ShellLogger`. | ||
sphinx-build -b html source/ html/ -W |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ShellLogger Class Reference | ||
=========================== | ||
|
||
.. autoclass:: shelllogger.ShellLogger | ||
:noindex: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
Helper Classes | ||
============== | ||
|
||
The following are a number of helper classes used by :class:`ShellLogger`. | ||
|
||
JSON Serialization | ||
------------------ | ||
|
||
.. autoclass:: shelllogger.ShellLoggerDecoder | ||
:noindex: | ||
|
||
.. todo:: | ||
|
||
Figure out why the documentation below is pulling in the docstring for the | ||
base class as well. | ||
|
||
.. autoclass:: shelllogger.ShellLoggerEncoder | ||
:noindex: | ||
|
||
Shell | ||
----- | ||
|
||
.. autoclass:: shelllogger.classes.Shell | ||
:noindex: | ||
|
||
Trace | ||
----- | ||
|
||
.. autoclass:: shelllogger.classes.Trace | ||
:noindex: | ||
|
||
.. automethod:: shelllogger.classes::trace_collector | ||
:noindex: | ||
|
||
Strace | ||
~~~~~~ | ||
|
||
.. autoclass:: shelllogger.ShellLogger.Strace | ||
:noindex: | ||
|
||
Ltrace | ||
~~~~~~ | ||
|
||
.. autoclass:: shelllogger.ShellLogger.Ltrace | ||
:noindex: | ||
|
||
StatsCollector | ||
-------------- | ||
|
||
.. autoclass:: shelllogger.classes.StatsCollector | ||
:noindex: | ||
|
||
.. automethod:: shelllogger.classes::stats_collectors | ||
:noindex: | ||
|
||
DiskStatsCollector | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: shelllogger.ShellLogger.DiskStatsCollector | ||
:noindex: | ||
|
||
CPUStatsCollector | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: shelllogger.ShellLogger.CPUStatsCollector | ||
:noindex: | ||
|
||
MemoryStatsCollector | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: shelllogger.ShellLogger.MemoryStatsCollector | ||
:noindex: | ||
|
||
AbstractMethod | ||
-------------- | ||
.. autoexception:: shelllogger.classes.AbstractMethod | ||
:noindex: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# http://www.sphinx-doc.org/en/master/config | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# 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. | ||
# | ||
from pathlib import Path | ||
import sys | ||
|
||
sys.path.append(str(Path.cwd().parent.parent.resolve() / "src")) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "ShellLogger" | ||
copyright = "2021, Sandia National Laboratories" | ||
author = "Josh Braun, David Collins, Jason M. Gates" | ||
version = "1.0.0" | ||
release = version | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# 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.coverage", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.mathjax", | ||
"sphinx.ext.napoleon", | ||
"sphinx.ext.todo", | ||
"sphinx.ext.viewcode", | ||
"sphinxarg.ext", | ||
"sphinx_rtd_theme", | ||
] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ["_templates"] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = [] | ||
|
||
|
||
# -- 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" | ||
|
||
# -- AutoDoc Configuration --------------------------------------------------- | ||
|
||
autodoc_default_options = { | ||
"show-inheritance": True, | ||
"members": True, | ||
"undoc-members": True | ||
} | ||
autoclass_content = "both" | ||
autodoc_preserve_defaults = True | ||
autodoc_inherit_docstrings = False | ||
todo_include_todos = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
shelllogger | ||
=========== | ||
|
||
.. toctree:: | ||
:hidden: | ||
:maxdepth: 3 | ||
:caption: Contents | ||
|
||
ShellLogger | ||
classes | ||
util | ||
todo | ||
|
||
The ``shelllogger`` module allows you to interact with the shell, while logging | ||
various metadata, statistics, and trace information. Any time you're tempted | ||
to write your own wrapper around things like :class:`subprocess.Popen` or | ||
:func:`subprocess.run`, consider using :func:`ShellLogger.log` instead. The | ||
following talk from the `US-RSE Virtual Workshop 2021 | ||
<https://us-rse.org/virtual-workshop-2021/>`_ illustrates ``shelllogger`` 's | ||
functionality. | ||
|
||
.. raw:: html | ||
|
||
<div style="position: relative; | ||
padding-bottom: 56.25%; | ||
height: 0; | ||
overflow: hidden; | ||
max-width: 100%; | ||
height: auto;"> | ||
<iframe src="https://www.youtube.com/embed/P32RYY_2V7w?start=5985" | ||
frameborder="0" | ||
allowfullscreen | ||
style="position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
padding: 10px;"> | ||
</iframe> | ||
</div> | ||
|
||
Where to Get shelllogger | ||
------------------------ | ||
|
||
The source repository for this module can be found `here | ||
<https://internal.gitlab.server/ShellLogger/ShellLogger>`_. See the project's | ||
`README.md | ||
<https://internal.gitlab.server/ShellLogger/ShellLogger/-/blob/master/README.md>`_ | ||
for details on how to clone, install, and otherwise interact with the project. | ||
|
||
Using shelllogger | ||
----------------- | ||
|
||
At a high-level, :func:`ShellLogger.log` allows you to execute commands, given | ||
as strings, in the shell. When a command is executed, :class:`ShellLogger` | ||
will also collect the following information: | ||
|
||
* The command run | ||
* A description of the command, or why it was run | ||
* ``stdout`` and ``stderr`` | ||
* Environment variables | ||
* Working directory | ||
* Hostname | ||
* User and group | ||
* Umask | ||
* Return code | ||
* Ulimit | ||
* Command start/stop time and duration | ||
|
||
It can also optionally collect: | ||
|
||
* Resource usage (CPU, memory, disk) | ||
* Trace information (``strace``, ``ltrace``) | ||
|
||
These data are collected in a "log book". When you call | ||
:func:`ShellLogger.finalize`, the contents of the log book are written to a | ||
HTML log file. | ||
|
||
Example | ||
^^^^^^^ | ||
|
||
.. todo:: | ||
|
||
Insert simplest example here, and link to other examples in the repo. | ||
|
||
For more detailed usage information, see the :doc:`ShellLogger`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
To-Do List | ||
========== | ||
|
||
.. |grin| unicode:: U+1F601 .. GRINNING FACE WITH SMILING EYES EMOJI | ||
|
||
The following are items that need to be addressed in our documentation. If | ||
there's nothing below, then we've already tackled all our to-do items |grin| | ||
|
||
.. todolist:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Utilities | ||
========= | ||
|
||
The following are a number of utility functions used to generate the HTML log | ||
file produced by :class:`ShellLogger`. | ||
|
||
.. automodule:: shelllogger.util | ||
:noindex: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.