diff --git a/sphinx_needs/data.py b/sphinx_needs/data.py index aa9448a4c..2f8b099da 100644 --- a/sphinx_needs/data.py +++ b/sphinx_needs/data.py @@ -32,6 +32,12 @@ LOGGER = getLogger(__name__) +ENV_DATA_VERSION: Final = 2 +"""Version of the data stored in the environment. + +See https://www.sphinx-doc.org/en/master/extdev/index.html#extension-metadata +""" + class NeedsPartType(TypedDict): """Data for a single need part.""" diff --git a/sphinx_needs/needs.py b/sphinx_needs/needs.py index 34ce59131..f647079f1 100644 --- a/sphinx_needs/needs.py +++ b/sphinx_needs/needs.py @@ -22,7 +22,12 @@ build_needumls_pumls, ) from sphinx_needs.config import NEEDS_CONFIG, LinkOptionsType, NeedsSphinxConfig -from sphinx_needs.data import NeedsCoreFields, SphinxNeedsData, merge_data +from sphinx_needs.data import ( + ENV_DATA_VERSION, + NeedsCoreFields, + SphinxNeedsData, + merge_data, +) from sphinx_needs.defaults import ( GRAPHVIZ_STYLE_DEFAULTS, LAYOUTS, @@ -303,6 +308,7 @@ def setup(app: Sphinx) -> dict[str, Any]: "version": VERSION, "parallel_read_safe": True, "parallel_write_safe": True, + "env_version": ENV_DATA_VERSION, }