Skip to content

Commit

Permalink
Ensure REGISTRY shows up in the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Mar 20, 2023
1 parent 25dc542 commit aec21f5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
13 changes: 11 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import importlib.metadata
import re

HOMEPAGE = "https://github.com/python-jsonschema/jsonschema-specifications"

project = "jsonschema-specifications"
author = "Julian Berman"
copyright = f"2022, {author}"
Expand Down Expand Up @@ -38,12 +40,19 @@ def entire_domain(host):

linkcheck_ignore = [
entire_domain("img.shields.io"),
"https://github.com/python-jsonschema/jsonschema/actions",
"https://github.com/python-jsonschema/jsonschema/workflows/CI/badge.svg",
f"{HOMEPAGE}/actions",
f"{HOMEPAGE}/workflows/CI/badge.svg",
]

# = Extensions =

# -- autodoc --

autodoc_default_options = {
"members": True,
"member-order": "bysource",
}

# -- autosectionlabel --

autosectionlabel_prefix_document = True
Expand Down
1 change: 1 addition & 0 deletions docs/spelling-wordlist.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
metaschemas
runtime
schemas
Empty file removed docs/spelling_wordlist.txt
Empty file.
11 changes: 10 additions & 1 deletion jsonschema_specifications/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
from jsonschema_specifications._core import REGISTRY # noqa: F401
from referencing import Registry as _Registry
from referencing.jsonschema import SchemaRegistry as _SchemaRegistry

from jsonschema_specifications._core import _schemas

#: A `referencing.jsonschema.SchemaRegistry` containing all of the official
#: meta-schemas and vocabularies.
REGISTRY: _SchemaRegistry = (_schemas() @ _Registry()).crawl()

__all__ = ["REGISTRY"]
5 changes: 1 addition & 4 deletions jsonschema_specifications/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
except ImportError:
from importlib_resources import files # type: ignore

from referencing import Registry, Resource
from referencing import Resource


def _schemas():
Expand All @@ -31,6 +31,3 @@ def _schemas():
for path in children:
contents = json.loads(path.read_text())
yield Resource.from_contents(contents)


REGISTRY: Registry = (_schemas() @ Registry()).crawl()

0 comments on commit aec21f5

Please sign in to comment.