Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: sketch out source code architecture for apidoc #48

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bin/benchpark
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import shutil
import shlex
import sys

import benchpark

DEBUG = False

def debug_print(message):
Expand All @@ -25,6 +27,7 @@ def main():
actions = {}
benchpark_list(subparsers, actions)
benchpark_setup(subparsers, actions)
benchpark_version(subparsers, actions)

args = parser.parse_args()

Expand Down Expand Up @@ -113,6 +116,11 @@ def benchpark_setup(subparsers, actions_dict):

actions_dict["setup"] = benchpark_setup_handler

def benchpark_version(subparsers, actions_dict):
list_parser = subparsers.add_parser("version", help="Benchpark version")
list_parser.add_argument('sublist', nargs='?')
actions_dict["version"] = benchpark_version_handler

def run_command(command_str, env=None):
subprocess.run(
shlex.split(command_str),
Expand Down Expand Up @@ -243,5 +251,8 @@ Further steps are needed to run the experiments (ramble -P -D . on)
"""
print(instructions)

def benchpark_version_handler(args):
print(benchpark.benchpark_version)

if __name__ == "__main__":
main()
31 changes: 31 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import os
import sys

from sphinx.ext.apidoc import main as sphinx_apidoc

# -- Benchpark customizations ------------------------------------------------
# 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.
sys.path.append(os.path.abspath("../lib/benchpark/benchpark"))
print(sys.path)


project = 'Benchpark'
copyright = '2023, LLNS LLC'
author = 'Olga Pearce, Alec Scott, Peter Scheibel, Greg Becker, Riyaz Haque, and Nathan Hanford'
Expand All @@ -15,6 +28,7 @@

extensions = [
'sphinx_rtd_theme',
"sphinx.ext.autodoc",
]

exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.spack-env']
Expand All @@ -26,3 +40,20 @@

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']

# -- Run sphinx-apidoc -------------------------------------------------
# Remove any previous API docs
# ReadtheDocs doesn't clean up after previous builds
# Without this, the API Docs will never actually update
apidoc_args = [
"--force", # Overwrite existing files
"--no-toc", # Don't create a table of contents file
"--output-dir=.", # Directory to place all output
"--module-first", # emit module docs before submodule docs
]
sphinx_apidoc(
apidoc_args
+ [
"../lib/benchpark/benchpark",
]
)
16 changes: 16 additions & 0 deletions lib/benchpark/benchpark/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
__version__ = "0.1.0"
benchpark_version = __version__


def __try_int(v):
try:
return int(v)
except ValueError:
return v


benchpark_version_info = tuple([__try_int(v) for v in __version__.split(".")])


__all__ = ["benchpark_version_info", "benchpark_version"]