Skip to content

Commit f1557a0

Browse files
authored
Update doc build to py313 (#2050)
1 parent a33afff commit f1557a0

File tree

10 files changed

+44
-71
lines changed

10 files changed

+44
-71
lines changed

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Python
2222
uses: actions/setup-python@v2
2323
with:
24-
python-version: 3.9
24+
python-version: 3.13
2525
- name: Update package index
2626
run: sudo apt-get update
2727
- name: Install mpi libs

armi/physics/neutronics/crossSectionGroupManager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
from armi.physics.neutronics.const import CONF_CROSS_SECTION
6464
from armi.reactor import flags
6565
from armi.reactor.components import basicShapes
66-
from armi.reactor.converters.blockConverters import stripComponents
6766
from armi.reactor.flags import Flags
6867
from armi.utils import safeCopy
6968
from armi.utils.units import C_TO_K, TRACE_NUMBER_DENSITY
@@ -710,6 +709,8 @@ def _makeRepresentativeBlock(self):
710709

711710
def _getNucTempHelper(self):
712711
"""All candidate blocks are used in the average."""
712+
from armi.reactor.converters.blockConverters import stripComponents
713+
713714
nvt = np.zeros(len(self.allNuclidesInProblem))
714715
nv = np.zeros(len(self.allNuclidesInProblem))
715716
for block in self.getCandidateBlocks():

armi/reactor/__init__.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,6 @@
1616
The reactor package houses the data model used in ARMI to represent the reactor during its
1717
simulation. It contains definitions of the reactor, assemblies, blocks, components, etc.
1818
19-
The key classes of the reactor package are shown below:
20-
21-
.. _reactor-class-diagram:
22-
23-
.. pyreverse:: armi.reactor -A -k --ignore=
24-
assemblyParameters.py,
25-
basicShapes.py,
26-
blockParameters.py,
27-
blueprints,
28-
complexShapes.py,
29-
componentParameters.py,
30-
converters,
31-
excoreStructure.py,
32-
flags.py,
33-
geometry.py,
34-
grids.py,
35-
parameters,
36-
plugins.py,
37-
reactorParameters.py,
38-
shapes.py,
39-
spentFuelPool.py,
40-
tests,
41-
volumetricShapes.py,
42-
zones.py
43-
:align: center
44-
:alt: Reactor class diagram
45-
:width: 90%
46-
47-
Class inheritance diagram for :py:mod:`armi.reactor`.
48-
4919
See :doc:`/developer/index`.
5020
"""
5121

armi/runLog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def __init__(self, *args, **kwargs):
572572
handler.setFormatter(form)
573573
self.addHandler(handler)
574574

575-
def log(self, msgType, msg, single=False, label=None, **kwargs):
575+
def log(self, msgType, msg, single=False, label=None, *args, **kwargs):
576576
"""
577577
This is a wrapper around logger.log() that does most of the work.
578578

doc/conf.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
All configuration values have a default; values that are commented out
2525
serve to show the default.
2626
"""
27+
2728
# ruff: noqa: E402
2829
import datetime
2930
import inspect
@@ -35,7 +36,7 @@
3536
import sys
3637
import warnings
3738

38-
import sphinx_rtd_theme
39+
import sphinx_rtd_theme # noqa: F401
3940
from docutils import nodes, statemachine
4041
from docutils.parsers.rst import Directive, directives
4142
from sphinx.domains.python import PythonDomain
@@ -96,17 +97,15 @@ class ExecDirective(Directive):
9697

9798
def run(self):
9899
try:
99-
code = inspect.cleandoc(
100-
"""
101-
def usermethod():
102-
{}
103-
"""
104-
).format("\n ".join(self.content))
105-
exec(code)
106-
result = locals()["usermethod"]()
100+
# clean the content, then put back into a list
101+
cleancode = inspect.cleandoc("\n".join(self.content)).split("\n")
102+
code = "def usermethod():\n " + "\n ".join(cleancode)
103+
globals = {}
104+
exec(code, globals)
107105

108-
if result is None:
106+
result = globals["usermethod"]()
109107

108+
if result is None:
110109
raise self.error(
111110
"Return value needed! The body of your `.. exec::` is used as a "
112111
"function call that must return a value."
@@ -119,9 +118,7 @@ def usermethod():
119118
except Exception as e:
120119
docname = self.state.document.settings.env.docname
121120
raise self.error(
122-
"Unable to execute embedded doc code at {}:{} ... {}\n{}".format(
123-
docname, self.lineno, datetime.datetime.now(), str(e)
124-
)
121+
f"Unable to execute embedded doc code at {docname}:{self.lineno}\n{str(e)}"
125122
)
126123

127124

@@ -363,6 +360,11 @@ def setup(app):
363360
exclude_patterns = [
364361
"**/Python27*",
365362
"**/ccl*",
363+
# prevent sphinx-gallery from causing duplicate source file errors
364+
"gallery/**/*.ipynb",
365+
"gallery/**/*.md5",
366+
"gallery/**/*.zip",
367+
"gallery/**/*.json",
366368
"**.ipynb_checkpoints",
367369
"_build",
368370
] # , '**/tests*']
@@ -410,9 +412,6 @@ def setup(app):
410412
"titles_only": False,
411413
}
412414

413-
# Add any paths that contain custom themes here, relative to this directory.
414-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
415-
416415
# as long as this file @import's the theme's main css it won't break anything
417416
html_style = "css/theme_fixes.css"
418417

doc/gallery-src/framework/run_chartOfNuclides.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
2323
Our :ref:`extended tutorial for nuclides </tutorials/nuclide_demo.ipynb>` and
2424
detailed :py:mod:`nucDirectory docs <armi.nucDirectory>` may also be of interest.
25+
2526
"""
27+
2628
import matplotlib.pyplot as plt
2729

2830
from armi import configure

doc/gallery-src/framework/run_computeReactionRates.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from armi import configure, nuclideBases, settings
2929
from armi.materials import ht9, sodium, uZr
3030
from armi.nuclearDataIO.cccc import isotxs
31-
from armi.reactor import assemblies, blocks, blueprints, geometry, grids, reactors
31+
from armi.reactor import assemblies, blocks, geometry, grids, reactors
3232
from armi.reactor.components import Circle, DerivedShape, Hexagon
3333
from armi.reactor.flags import Flags
3434
from armi.tests import ISOAA_PATH
@@ -56,7 +56,9 @@ def createDummyReactor():
5656
Often, a reactor model like this is built directly from input files rather
5757
than from code as done here.
5858
"""
59-
bp = blueprints.Blueprints()
59+
from armi.reactor.blueprints import Blueprints
60+
61+
bp = Blueprints()
6062
cs = settings.Settings()
6163

6264
r = reactors.Reactor("Reactor", bp)

doc/gallery-src/framework/run_fuelManagement.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
"""
1515
Fuel management in a LWR.
16+
=========================
1617
1718
Demo of locating and swapping assemblies in a core with Cartesian geometry. Given a burnup
1819
distribution, this swaps high burnup assemblies with low ones.
@@ -26,6 +27,7 @@
2627
ARMI to do fuel management. Thus, this example applies a dummy burnup distribution for
2728
demonstration purposes.
2829
"""
30+
2931
# Tell the gallery to feature the 2nd image
3032
# sphinx_gallery_thumbnail_number = 2
3133
import math

doc/release/0.5.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Bug Fixes
2929
Quality Work
3030
------------
3131
#. Adding PDF versions of the ARMI docs. (`PR#2072 <https://github.com/terrapower/armi/pull/2072>`_)
32+
#. Update docs build to occur with python 3.13 and updated docs dependencies. (`PR#2050 <https://github.com/terrapower/armi/pull/2050>`_)
3233
#. TBD
3334

3435

pyproject.toml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,31 +92,27 @@ test = [
9292
docs = [
9393
#######################################################################
9494
# These are most specified that usual, because Sphinx docs seem to be
95-
# quite fragile limited <7 by sphinx-rtd-theme at the moment.
95+
# quite fragile.
9696
#
97-
# sphinx-rtd-theme requires docutils <0.19 but sphinx dropped support
98-
# for 0.18 in 6.0.0 so we're stuck at these versions.
99-
#
100-
# We are only building our docs with Python 3.9.
97+
# We are only building our docs with Python 3.13.
10198
#######################################################################
102-
"Sphinx==5.3.0", # central library used to build our docs
103-
"docutils==0.18.1", # Needed by sphinx-rtd-them
104-
"sphinx-rtd-theme==1.2.2", # Read-The-Docs theme for Sphinx
105-
"nbsphinx==0.9.2", # Parses Jupyter notebooks
106-
"nbsphinx-link==1.3.0", # Adds Jupyter NBs to Sphinx source root
107-
"sphinx-gallery==0.13.0", # Builds an HTML version of a Python script and puts it into a gallery
108-
"sphinxcontrib-apidoc==0.3.0", # More easily document our API
109-
"sphinxext-opengraph==0.8.2", # Generates OpenGraph metadata to make good-looking cards on social media
110-
"sphinx-needs==1.2.2", # Requirements traceability matrices for QA
111-
"sphinxcontrib-plantuml==0.25", # UML support in sphinx-needs
99+
"Sphinx==8.1.3", # central library used to build our docs
100+
"docutils==0.21.2", # Needed by sphinx-rtd-them
101+
"sphinx-rtd-theme==3.0.2", # Read-The-Docs theme for Sphinx
102+
"nbsphinx", # Parses Jupyter notebooks
103+
"nbsphinx-link", # Adds Jupyter NBs to Sphinx source root
104+
"sphinx-gallery", # Builds an HTML version of a Python script and puts it into a gallery
105+
"sphinxcontrib-apidoc==0.5.0", # More easily document our API
106+
"sphinxext-opengraph", # Generates OpenGraph metadata to make good-looking cards on social media
107+
"sphinx-needs==4.1.0", # Requirements traceability matrices for QA
108+
"sphinxcontrib-plantuml==0.30", # UML support in sphinx-needs
112109
"pandoc", # Must be in the path (to convert file formats)
113-
"ipykernel==6.25.1", # iPython kernel to run Jupyter notebooks
114-
"pylint==2.17.5", # Generates UML diagrams
115-
"Jinja2==3.0.3", # Used in numpydoc and nbconvert
110+
"ipykernel", # iPython kernel to run Jupyter notebooks
111+
"pylint", # Generates UML diagrams
112+
"Jinja2", # Used in numpydoc and nbconvert
116113
"sphinxcontrib-jquery==4.1", # Handle missing jquery errors
117-
"jupyter-contrib-nbextensions", # A collections of JS extensions for jupyter notebooks
118-
"lxml<5.0.0", # Needed because the dep above is no longer an active project
119114
"sphinx-simplepdf==1.6.0", # Used to make PDF versions of the docs
115+
"setuptools", # needed for conf.py tooling
120116
]
121117

122118
[project.scripts]

0 commit comments

Comments
 (0)