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

Create .readthedocs.yaml #94

Merged
merged 25 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 21 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
41 changes: 41 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"
apt_packages:
- ghostscript
- graphviz
- texlive-full
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if you need texlive if we aren't rendering into a PDF.

I don't know what ghostscript is either...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ghostscript is a tool that processes postscript files and is often used with tex engines. I think it may be needed if we want to produce docs for printing. If it is not causing any unnecessary overhead, I would leave it as is for now.

jobs:
post_build:
- cd docs && doxygen ./doxygen/Doxyfile.in
Comment on lines +21 to +22
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just what we were looking for :)

# checks for broken links sometimes it gives false negatives
# - python -m sphinx -b linkcheck -D linkcheck_timeout=1 docs/ $READTHEDOCS_OUTPUT/linkcheck

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
35 changes: 12 additions & 23 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
import os
import shlex

# Call doxygen in ReadtheDocs
# read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
# if read_the_docs_build:


# Modify Doxyfile for ReadTheDocs compatibility
with open('./doxygen/Doxyfile.in', 'r') as f:
fdata = f.read()
fdata = fdata.replace('@PROJECT_SOURCE_DIR@', '.')
with open('./doxygen/Doxyfile.in', 'w') as f:
f.write(fdata)

# Call doxygen
from subprocess import call
call(['doxygen', "./doxygen/Doxyfile.in"])
with open('./doxygen/Doxyfile.in', 'a') as f:
f.write("\nOUTPUT_DIRECTORY=../_readthedocs/html/doxygen")
Comment on lines +30 to +31
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be super helpful to document where this directory is locally and where it is copied to later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This directory does not exist locally and will only exist on the read the docs server where the builds happen.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding a comment like this would be helpful. It beats me why it is ../_readthedocs. It is ../ relative to where? In any case, we can create a separate issue to document these pathing issues, no need to hold this PR.


# Call doxygen
# from subprocess import call
# call(['doxygen', "./doxygen/Doxyfile.in"])


# Get current directory
Expand Down Expand Up @@ -69,7 +69,7 @@
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = ['.rst', '.html']
source_suffix = ['.rst']

# The encoding of source files.
#source_encoding = 'utf-8-sig'
Expand All @@ -82,21 +82,8 @@
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

root_doc = 'index'


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']


# -- Option for numbering figures/tables/etc.-----------------------------------
# Note: numfig requires Sphinx (1.3+)
numfig = True
Expand Down Expand Up @@ -194,7 +181,9 @@
# 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 = [os.path.join(conf_directory, 'sphinx/_static')]
html_static_path = [os.path.join(conf_directory, 'sphinx/_build/_static')]

Comment on lines +190 to +191
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, it would be helpful to understand why this specific path is chosen. Thinking of me trying to figure out why docs are not showing up at the remote location a few months from now :).

#html_static_path = ['docs/sphinx/_build/_static/theme_overrides.css']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down Expand Up @@ -263,7 +252,7 @@
# override wide tables in RTD theme
# (Thanks to https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html)
# These folders are copied to the documentation's HTML output
html_static_path = ['sphinx/_static/theme_overrides.css']
# html_static_path = ['sphinx/_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
Expand Down
6 changes: 3 additions & 3 deletions docs/doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ PROJECT_ICON =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.

OUTPUT_DIRECTORY = sphinx/_build/doxygen
# OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/html/doxygen

Comment on lines -81 to 82
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using Doxygen default output dir?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is replaced by the command in conf.py but I will document this.

# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
# sub-directories (in 2 levels) under the output directory of each output format
Expand Down Expand Up @@ -2716,7 +2716,7 @@ DOT_PATH =
# command).
# This tag requires that the tag HAVE_DOT is set to YES.

DOTFILE_DIRS = @PROJECT_SOURCE_DIR@/docs
DOTFILE_DIRS =

# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
Expand Down Expand Up @@ -2845,4 +2845,4 @@ GENERATE_TREEVIEW = YES # required!
DISABLE_INDEX = NO
FULL_SIDEBAR = NO
HTML_EXTRA_STYLESHEET = doxygen/doxygen-awesome.css
HTML_COLORSTYLE = LIGHT # required with Doxygen >= 1.9.5
HTML_COLORSTYLE = LIGHT # required with Doxygen >= 1.9.5
14 changes: 0 additions & 14 deletions docs/doxygen/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,3 @@ API Documentation
-----------------

Doxygen generated API documentation can be found here: `API documentation <html/index.html>`_

`Coo_8cpp documentation <html/Coo_8cpp.html>`_

`Csc_8cpp documentation <html/Csc_8cpp.htmll>`_

`Csr_8cpp documentation <html/Csr_8cpp.html>`_

`GramSchmidt_8cpp documentation <html/GramSchmidt_8cpp.html>`_

`LinAlgWorkspaceCUDA_8cpp documentation <html/LinAlgWorkspaceCUDA_8cpp.html>`_

`LinAlgWorkspaceHIP_8cpp documentation <html/LinAlgWorkspaceHIP_8cpp.html>`_

`LinAlgWorkspaceCpu_8cpp documentation <./html/LinAlgWorkspaceCpu_8cpp.html>`_
11 changes: 6 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Documentation

User guides and source code documentation are always linked on this site.
`ReSolve Github Project <https://github.com/ORNL/ReSolve>`_.
`Source documentation <doxygen/html/index.html>`_
`Source documentation <html/index.html>`_
Comment on lines 70 to +72
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this page is a super quick redirect, maybe we could just make the sidebar entry link straight to Doxygen docs? IMO we could also change name to just Doxygen Docs then as well. (maybe Source Documentation is cleaner language)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we leave links to both, general ReSolve documentation (top level docs) and the direct link to source documentation (Doxygen generated). The former is for users who just want to interface to ReSolve and the latter is for contributors who need to know about ReSolve's internals.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cameronrutherford looks like sphinx toctree can only include rst based documents in the toctree and there isn't very obvious support for including html files in the toctree which is what the doxygen page are.


.. list-table::
:align: center
Expand All @@ -84,7 +84,7 @@ Contributing
------------

For all contributions to ReSolve please follow the `developer
guidelines <CONTRIBUTING.md>`__
guidelines <sphinx/coding_guide/index.html>`__

Test and Deploy
---------------
Expand Down Expand Up @@ -183,8 +183,8 @@ License
Copyright © 2023, UT-Battelle, LLC, and Battelle Memorial Institute.

ReSolve is a free software distributed under a BSD-style license. See
the `LICENSE <LICENSE>`__ and `NOTICE <NOTICE>`__ files for details. All
new contributions to ReSolve must be made under the smae licensing
the `LICENSE <sphinx/license.rst>`__ and `NOTICE <sphinx/notice.rst>`__ files for details. All
new contributions to ReSolve must be made under the same licensing
pelesh marked this conversation as resolved.
Show resolved Hide resolved
terms.


Expand All @@ -194,5 +194,6 @@ terms.
:caption: Developer Resources

sphinx/coding_guide/index
sphinx/licenses
doxygen/index
sphinx/licenses
sphinx/notice
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docutils
sphinx==6.2.1
sphinx-rtd-theme==1.2.2
4 changes: 4 additions & 0 deletions docs/sphinx/notice.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Notice
*******

.. mdinclude:: ../../NOTICE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://resolve.readthedocs.io/en/latest/sphinx/notice.html - you can't simply use an extension without installing it ;)

See #92 and look a little closer into what python deps I install

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why don't we simply write these files (license and notice) in rst format and include them without the conversion tool?