Skip to content

Commit

Permalink
Merge pull request #1398 from amath-idm/fix-readthedocs
Browse files Browse the repository at this point in the history
Fix readthedocs
  • Loading branch information
cliffckerr authored Oct 23, 2022
2 parents a3db333 + e11bfdf commit 753c493
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 35 deletions.
33 changes: 12 additions & 21 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
# .readthedocs.yml
# .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 version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.9"

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

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF
# If using Sphinx, optionally build your docs in additional formats such as PDF
formats:
- htmlzip
- pdf
- pdf

# Optionally set the version of Python and requirements required to build your docs
# Optionally declare the Python requirements required to build your docs
python:
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
path: .
system_packages: true

# Optionally rank topics in search results, between -10 (lower) and 10 (higher).
# 0 is normal rank, not no rank

search:
ranking:
index.html: 3
modules.html: 2
system_packages: true
2 changes: 1 addition & 1 deletion covasim/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ def reconcile_inputs(self):
self.inds.data[key] = []
self.date_matches[key] = []
count = -1
for d, datum in self.data[key].iteritems():
for d, datum in self.data[key].items():
count += 1
if np.isfinite(datum):
if d in self.sim_dates:
Expand Down
19 changes: 9 additions & 10 deletions covasim/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Options(sc.objdict):
- font: the font family/face used for the plots
- fontsize: the font size used for the plots
- interactive: convenience method to set show, close, and backend
- jupyter: defaults for Jupyter (change backend and figure close/return)
- jupyter: defaults for Jupyter (change backend and figure return)
- show: whether to show figures
- close: whether to close the figures
- backend: which Matplotlib backend to use
Expand Down Expand Up @@ -241,16 +241,15 @@ def set(self, key=None, value=None, use=False, **kwargs):
jupyter = 'retina' # Default option for True
if 'returnfig' not in kwargs:
kwargs['returnfig'] = False # We almost never want to return figs from Jupyter, since then they appear twice
if 'show' not in kwargs:
kwargs['show'] = False
try:
if jupyter == 'retina': # This makes plots much nicer, but isn't available on all systems
import matplotlib_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('retina')
elif jupyter in ['widget', 'interactive']: # Or use interactive
from IPython import get_ipython
magic = get_ipython().magic
magic('%matplotlib widget')
if not os.environ.get('SPHINX_BUILD'): # Custom check implemented in conf.py to skip this if we're inside Sphinx
if jupyter == 'retina': # This makes plots much nicer, but isn't available on all systems
import matplotlib_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('retina')
elif jupyter in ['widget', 'interactive']: # Or use interactive
from IPython import get_ipython
magic = get_ipython().magic
magic('%matplotlib widget')
except:
pass

Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

# Set environment
os.environ['SPHINX_BUILD'] = 'True' # This is used so cv.options.set('jupyter') doesn't reset the Matplotlib renderer
os.environ['COVASIM_WARNINGS'] = 'error' # Don't let warnings pass in the tutorials
on_rtd = os.environ.get('READTHEDOCS') == 'True'

if sys.platform in ["linux", "darwin"]:
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/tut_plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
"metadata": {},
"outputs": [],
"source": [
"sim.plot(style='seaborn-whitegrid')"
"sim.plot(style='ggplot')"
]
},
{
Expand All @@ -236,7 +236,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"(Note: Covasim comes bundled with two fonts, Mulish (sans-serif, the default) and Rosario (serif).)"
"(Note: Covasim comes bundled with two fonts, [Mulish](https://github.com/googlefonts/mulish) (sans-serif, the default) and [Rosario](https://fonts.adobe.com/fonts/rosario) (serif).)"
]
},
{
Expand Down

0 comments on commit 753c493

Please sign in to comment.