summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-08-20 11:31:36 +0100
committerJulian Berman <Julian@GrayVines.com>2021-08-20 11:35:20 +0100
commit656a86a4bb08819e1a74635ffdec0167e43db8e0 (patch)
tree2b9259e306a5ef6e8b04eea8d8babb4bd8fc9727 /docs
parentb88852007bd365b40be64f1c9fe27a56dbc683ba (diff)
downloadjsonschema-656a86a4bb08819e1a74635ffdec0167e43db8e0.tar.gz
Deprecate jsonschema.__version__.
importlib.metadata is in the standard library now, so there's not much purpose in pre-calculating this attribute.
Diffstat (limited to 'docs')
-rw-r--r--docs/conf.py5
-rw-r--r--docs/jsonschema_role.py6
2 files changed, 5 insertions, 6 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 64f872d..ac0630c 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,9 +1,8 @@
+from importlib import metadata
import os
import re
import sys
-import jsonschema
-
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -55,7 +54,7 @@ copyright = "2013, " + author
#
# version: The short X.Y version
# release: The full version, including alpha/beta/rc tags.
-release = jsonschema.__version__
+release = metadata.version("jsonschema")
version = release.partition("-")[0]
# There are two options for replacing |today|: either, you set today to some
diff --git a/docs/jsonschema_role.py b/docs/jsonschema_role.py
index f0100d2..1867f8a 100644
--- a/docs/jsonschema_role.py
+++ b/docs/jsonschema_role.py
@@ -1,4 +1,5 @@
from datetime import datetime
+from importlib import metadata
from urllib.parse import urljoin
import errno
import os
@@ -8,8 +9,6 @@ from docutils import nodes
from lxml import html
import certifi
-import jsonschema
-
__version__ = "1.2.0"
BASE_URL = "https://json-schema.org/draft-07/"
@@ -57,7 +56,8 @@ def fetch_or_load(spec_path):
headers = {
"User-Agent": "python-jsonschema v{} - documentation build v{}".format(
- jsonschema.__version__, __version__,
+ metadata.version("jsonschema"),
+ __version__,
),
}