diff --git a/docs/conf.py b/docs/conf.py index 3d7d55c..4400184 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,9 +3,14 @@ import sys from pathlib import Path +try: + # Added in Python 3.11 + import tomllib +except ImportError + import tomli as tomllib + # Ensure documentation examples are determinstically random. import numpy -import tomli from pkg_resources import get_distribution try: @@ -21,7 +26,7 @@ # Get configuration information from `pyproject.toml` with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as configuration_file: - conf = tomli.load(configuration_file) + conf = tomllib.load(configuration_file) configuration = conf["project"] # -- General configuration ---------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 7bf4d7e..803083d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dynamic = ['version'] [project.optional-dependencies] docs = [ - 'tomli', + 'tomli; python_version < "3.11"', 'sphinx', 'sphinx-asdf >= 0.1.3', 'sphinx-astropy',