From 384713fdf8497a603a83fb6740e111bec2abd71a Mon Sep 17 00:00:00 2001 From: cliffckerr Date: Sat, 22 Oct 2022 14:15:13 -0700 Subject: [PATCH 1/7] update readthedocs config --- .readthedocs.yml | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 7e36f3990..c34bfa7e2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,37 +1,25 @@ -# .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 -formats: - - htmlzip - - pdf +# If using Sphinx, optionally build your docs in additional formats such as PDF +# formats: +# - 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 + install: + - requirements: docs/requirements.txt \ No newline at end of file From 0a3d6719e373011c8a638037fa979500f83acfdd Mon Sep 17 00:00:00 2001 From: cliffckerr Date: Sat, 22 Oct 2022 14:20:20 -0700 Subject: [PATCH 2/7] trying some adjustments --- .readthedocs.yml | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index c34bfa7e2..53e703b6c 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,25 +1,36 @@ -# .readthedocs.yaml +# .readthedocs.yml # 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 + configuration: docs/conf.py + +# Build documentation with MkDocs +#mkdocs: +# configuration: mkdocs.yml -# If using Sphinx, optionally build your docs in additional formats such as PDF -# formats: -# - pdf +# Optionally build your docs in additional formats such as PDF +formats: + - htmlzip + - pdf -# Optionally declare the Python requirements required to build your docs +# Optionally set the version of Python and requirements required to build your docs python: - install: - - requirements: docs/requirements.txt \ No newline at end of file + version: 3.9 + 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 From 05a554f8cc772c53fa5cd6f87a39ba20d669df37 Mon Sep 17 00:00:00 2001 From: cliffckerr Date: Sat, 22 Oct 2022 14:22:33 -0700 Subject: [PATCH 3/7] change python version --- .readthedocs.yml | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 53e703b6c..80cdccf57 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,36 +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 - -# 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.9 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 \ No newline at end of file From e240381e22a98f428d3e912229cfbf9c807b15f9 Mon Sep 17 00:00:00 2001 From: cliffckerr Date: Sat, 22 Oct 2022 21:27:09 -0700 Subject: [PATCH 4/7] change example scheme --- docs/tutorials/tut_plotting.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/tut_plotting.ipynb b/docs/tutorials/tut_plotting.ipynb index 0cdea3c2e..65def5e5d 100644 --- a/docs/tutorials/tut_plotting.ipynb +++ b/docs/tutorials/tut_plotting.ipynb @@ -213,7 +213,7 @@ "metadata": {}, "outputs": [], "source": [ - "sim.plot(style='seaborn-whitegrid')" + "sim.plot(style='ggplot')" ] }, { @@ -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).)" ] }, { From 2a772db7a7d2ddfc996883d08a29f1d38aee3ea1 Mon Sep 17 00:00:00 2001 From: cliffckerr Date: Sat, 22 Oct 2022 22:21:29 -0700 Subject: [PATCH 5/7] fix warning --- covasim/analysis.py | 2 +- docs/conf.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/covasim/analysis.py b/covasim/analysis.py index d59bb8fff..f5aa350ea 100644 --- a/covasim/analysis.py +++ b/covasim/analysis.py @@ -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: diff --git a/docs/conf.py b/docs/conf.py index 0ba39229b..23448ad9c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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"]: From 53ddf9ac7ad3a9ea8c7990e6f773ddae40714238 Mon Sep 17 00:00:00 2001 From: cliffckerr Date: Sat, 22 Oct 2022 22:25:09 -0700 Subject: [PATCH 6/7] reimplement sphinx check --- covasim/settings.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/covasim/settings.py b/covasim/settings.py index 42672fead..0479445db 100644 --- a/covasim/settings.py +++ b/covasim/settings.py @@ -244,13 +244,14 @@ def set(self, key=None, value=None, use=False, **kwargs): 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 From e11bfdf2ec03b04bfd4166634e253aa6d1f49753 Mon Sep 17 00:00:00 2001 From: cliffckerr Date: Sat, 22 Oct 2022 22:38:06 -0700 Subject: [PATCH 7/7] change show option --- covasim/settings.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/covasim/settings.py b/covasim/settings.py index 0479445db..fbaa3d900 100644 --- a/covasim/settings.py +++ b/covasim/settings.py @@ -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 @@ -241,8 +241,6 @@ 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 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