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

documentation building, readthedocs config #203

Merged
merged 30 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0855dfd
WIP: cleanup of doc building
newville Mar 15, 2024
f55aee4
add yaml config for readthedocs
newville Mar 15, 2024
bc2825c
Merge branch 'master' into master
newville Apr 3, 2024
8766f2e
add .codecov.yml
newville Apr 3, 2024
cabd620
add codecov token
newville Apr 3, 2024
a124d27
Merge branch 'master' of github.com:lmfit/uncertainties
newville Apr 20, 2024
2566710
updating docs: layout and configuration
newville Apr 21, 2024
0f34d54
update pyproject config to allow more install options
newville Apr 21, 2024
3810af0
update docstrings for ufloat and ufloat_fromstr
newville Apr 21, 2024
929fb7f
updates for user_guide
newville Apr 21, 2024
c3c8cde
simplify name for PDF doc, generate zip file of docs
newville Apr 21, 2024
6a0e887
more doc work
newville Apr 22, 2024
111ddfe
clean up makefiles
newville Apr 27, 2024
abb1ce6
more updates
newville Apr 27, 2024
d6599c1
move formatting doc
newville Apr 27, 2024
7f877f3
playing with themes, add sphinx_copybutton
newville Apr 27, 2024
c8df1c5
add formatting to top bar
newville Apr 27, 2024
337c8b1
index sidebar tweaks
newville Apr 27, 2024
b6625f2
more work on user guide
newville Apr 27, 2024
e55afe0
export Variable, improve its docstring
newville Apr 29, 2024
f0b2607
more user guide tweaks
newville Apr 29, 2024
a233ce2
more doc changes
newville Apr 29, 2024
12b6b6b
more tweaks
newville Apr 30, 2024
ac8c8f0
add python-docs-theme requirement for docs
newville May 12, 2024
d0db622
shorten, update formatting of function
newville May 12, 2024
f99071d
relabel technical guide as advanced topics, move api doc here
newville May 12, 2024
773bece
more doc fixes
newville May 12, 2024
71983bf
ran rstcheck by hand
newville May 13, 2024
02f3be1
doc fixes and spelling check as per @andrewgsavage review
newville May 15, 2024
b1ae532
update doc for savetxt/loadtxt
newville May 15, 2024
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
17 changes: 17 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
codecov:
token: c2f0ce36-17ad-4668-bb1b-f1b72dedf3fc
comment:
after_n_builds: 9

coverage:
status:
project:
default:
target: auto
threshold: 2.0%
informational: true
patch:
default:
target: auto
threshold: 20%
informational: true
35 changes: 35 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# 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.11"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# 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
88 changes: 19 additions & 69 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,69 +10,32 @@ PAPER =
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
PDFFILE = uncertainties.pdf

.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
.PHONY: all html help clean latex pdf

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
-rm -rf _build/*

pdf: latex
(cd _build/latex; $(MAKE) all-pdf)

# The HTML needs pdf because it contains a link to the PDF version:
html: pdf
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml
@echo
@echo "Build finished. The HTML pages are in _build/dirhtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
@echo
@echo "Build finished; now you can process the JSON files."

htmlhelp: pdf
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
all: html pdf
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
-cp _build/latex/$(PDFFILE) _build/html/.
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in _build/htmlhelp."
-cd _build && ln -s html uncertainties_doc && zip -pur uncertainties_doc.zip uncertainties_doc/* && mv uncertainties_doc.zip html && rm -f uncertainties_doc
@echo "Build finished. The HTML pages are in _build/html."

epub: pdf
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) _build/epub
@echo
@echo "Build finished; the EPUB documentation is in" \
"_build/epub."
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " all to make standalone HTML files with PDF and zipped HTML"
@echo " html to make standalone HTML files"
@echo " pdf to make PDF"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " clean to clean folders"

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in _build/qthelp, like this:"
@echo "# qcollectiongenerator _build/qthelp/uncertaintiesPythonpackage.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile _build/qthelp/uncertaintiesPythonpackage.qhc"
clean:
-rm -rf _build/*

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
Expand All @@ -81,18 +44,5 @@ latex:
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
@echo
@echo "The overview file is in _build/changes."

linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in _build/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in _build/doctest/output.txt."
pdf: latex
(cd _build/latex; $(MAKE) all-pdf)
5 changes: 0 additions & 5 deletions doc/README.rst

This file was deleted.

20 changes: 20 additions & 0 deletions doc/_templates/indexsidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<h5> Get <tt>uncertainties</tt></h5>
<p>Current version: <b>{{ release }}</b></p>

<p>
Installation: <br>
<tt> pip install uncertainties</tt>

<p>
Development Version:
<a href="https://github.com/lmfit/uncertainties/">Github</a>
</p>


<h5>Offline Documentation</h5>

<p>
<a href="uncertainties.pdf">uncertainties.pdf</a>
<br>
<a href="uncertainties_doc.zip">Zipped HTML and PDF</a>
</p>
98 changes: 14 additions & 84 deletions doc/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,93 +1,23 @@
{% extends "!layout.html" %}

{% block rootrellink %}
{{ toctree() }}
{% endblock %}

{% block document %}
{{ super() }}
<a href="https://github.com/lebigot/uncertainties"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" height="137px" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
<li>[<a href="{{ pathto('index') }}">Uncertainties</a></li>
<li>[<a href="{{ pathto('install') }}">Installation & Credits</a></li>
<li>|<a href="{{ pathto('user_guide') }}">User Guide</a></li>
<li>|<a href="{{ pathto('formatting') }}">Formatting</a></li>
<li>|<a href="{{ pathto('numpy_guide') }}"> Numpy Arrays</a></li>
<li>|<a href="{{ pathto('tech_guide') }}">Advanced</a>]</li> &nbsp;
&nbsp;
&nbsp; &nbsp;
{% endblock %}

{% block relbar1 %}

<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="{{ pathto('index') }}"><img src="{{
pathto("_static/logo.png", 1) }}" border="0" alt="uncertainties"/></a>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<font size=+2>
<a href="{{ pathto('index') }}">
<img src="{{pathto("_static/logo.png", 1) }}" height=75 border="0" alt="uncertainties logo"/>
</a>
</font>
</div>
{{ super() }}
{% endblock %}


{#############################################################################}
{# Sidebar customization #)

{# put the sidebar before the body #}
{% block sidebar1 %}

{%- macro sidebar() %}
{%- if not embedded %}{% if not theme_nosidebar|tobool %}
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
{%- block sidebarlogo %}
{%- if logo %}
<p class="logo"><a href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
</a></p>
{%- endif %}
{%- endblock %}
{%- block sidebartoc %}
{%- block sidebarglobaltoc %}
<h3>{{ _('Table of contents') }}</h3>
{{ toctree() }}
{%- endblock %}
{%- endblock %}
{%- block sidebarrel %}
{%- endblock %}
{%- block sidebarsourcelink %}
{%- if show_source and has_source and sourcename %}
<h3>{{ _('This Page') }}</h3>
<ul class="this-page-menu">
<li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
rel="nofollow">{{ _('Show Source') }}</a></li>
</ul>
{%- endif %}
{%- endblock %}
{%- if customsidebar %}
{% include customsidebar %}
{%- endif %}
{%- if display_toc %}
<h3>{{ _('Section contents') }}</h3>
{{ toc }}
{%- endif %}
{%- block sidebarsearch %}
{%- if pagename != "search" %}
<div id="searchbox" style="display: none">
<h3>{{ _('Quick search') }}</h3>
<form class="search" action="{{ pathto('search') }}" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="{{ _('Go') }}" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
{{ _('Search the documentation.') }}
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
{%- endif %}
{%- endblock %}
{%- block copyright %}
<h3>Documentation license</h3>
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a>
{%- endblock %}
</div>
</div>
{%- endif %}{% endif %}
{%- endmacro %}

{{ sidebar() }}{% endblock %}


{% block sidebar2 %}{% endblock %}

24 changes: 14 additions & 10 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
extensions = ['sphinx.ext.autodoc', 'sphinx_copybutton']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -39,11 +39,11 @@
#source_encoding = 'utf-8'

# The master toctree document.
master_doc = 'index_TOC'
master_doc = 'index'

# General information about the project.
project = u'uncertainties Python package'
copyright = u'2010–%d, Eric O. LEBIGOT (EOL)' % date.today().year
project = u'uncertainties'
copyright = f'2010–{date.today().year}, Eric O. LEBIGOT (EOL)'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -96,7 +96,11 @@

# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'sphinxdoc'
# html_theme = 'sphinxdoc'
html_theme = 'bizstyle'
# html_theme = 'cloud'
html_theme = 'python_docs_theme'
# html_theme = "pydata_sphinx_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
Expand All @@ -108,7 +112,7 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
html_title = "uncertainties"

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
Expand All @@ -120,7 +124,7 @@
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
html_favicon = 'favicon.ico'
html_favicon = '_static/favicon.ico'

# 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,
Expand All @@ -136,7 +140,7 @@
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']}

# Additional templates that should be rendered to pages, maps page names to
# template names.
Expand All @@ -163,7 +167,7 @@
#html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'uncertaintiesdoc'
htmlhelp_basename = 'uncertainties'


# -- Options for LaTeX output --------------------------------------------------
Expand All @@ -177,7 +181,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index_TOC', 'uncertaintiesPythonPackage.tex', u'uncertainties Python package Documentation',
('index', 'uncertainties.tex', u'uncertainties Python package Documentation',
u'Eric O. LEBIGOT (EOL)', 'manual'),
]

Expand Down
Loading
Loading