Skip to content

prefer tomllib from the Standard Library when available #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 ----------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dynamic = ['version']

[project.optional-dependencies]
docs = [
'tomli',
'tomli; python_version < "3.11"',
'sphinx',
'sphinx-asdf >= 0.1.3',
'sphinx-astropy',
Expand Down