Skip to content

Commit dc3d79c

Browse files
release: bump version 1.3.1
1 parent ade8de7 commit dc3d79c

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

doc/changelog.d/617.documentation.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix: optimize imports for whatsnew

doc/source/user-guide/options.rst

+6
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ What's new section
263263
The "What's new" section is an option that allows you to highlight new features in your library
264264
for each minor version within the changelog file.
265265

266+
To install the "What's new" dependencies from ansys-sphinx-theme, run the following command:
267+
268+
.. code-block:: bash
269+
270+
pip install ansys-sphinx-theme[changelog]
271+
266272
To get started, create a YAML file named ``whatsnew.yml`` in the ``doc/source`` directory. The
267273
YAML file should contain the following structure:
268274

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"
55
[project]
66
# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections
77
name = "ansys-sphinx-theme"
8-
version = "1.3.0"
8+
version = "1.3.1"
99
description = "A theme devised by ANSYS, Inc. for Sphinx documentation."
1010
readme = "README.rst"
1111
requires-python = ">=3.10,<4"

src/ansys_sphinx_theme/__init__.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
from docutils import nodes
3535
from sphinx import addnodes
3636
from sphinx.application import Sphinx
37-
import yaml
3837

3938
from ansys_sphinx_theme.extension.linkcode import DOMAIN_KEYS, sphinx_linkcode_resolve
4039
from ansys_sphinx_theme.latex import generate_404
@@ -687,6 +686,14 @@ def get_whatsnew_data(whatsnew_file: pathlib.Path) -> dict:
687686
"""
688687
if whatsnew_file.exists():
689688
# Open and read the whatsnew.yml file
689+
690+
try:
691+
import yaml
692+
except ImportError as e:
693+
raise ImportError(
694+
f"Failed to import `pyyaml`: {e}. Install the package using `pip install ansys-sphinx-theme[changelog]`" # noqa: E501
695+
)
696+
690697
with pathlib.Path.open(whatsnew_file, "r", encoding="utf-8") as file:
691698
whatsnew_data = yaml.safe_load(file)
692699

@@ -1143,11 +1150,11 @@ def setup(app: Sphinx) -> Dict:
11431150
# Check for what's new options in the theme configuration
11441151
whatsnew_file, changelog_file, sidebar_pages = get_whatsnew_options(app)
11451152

1146-
if whatsnew_file is not None and changelog_file is not None:
1153+
if whatsnew_file and changelog_file:
11471154
app.connect("doctree-read", add_whatsnew_changelog)
11481155
app.connect("doctree-resolved", extract_whatsnew)
11491156

1150-
if sidebar_pages is not None:
1157+
if sidebar_pages:
11511158
app.connect("html-page-context", add_whatsnew_sidebar)
11521159

11531160
app.connect("html-page-context", update_footer_theme)

0 commit comments

Comments
 (0)