Skip to content

Commit be5281f

Browse files
committed
Trivial docs on writing schema packages.
1 parent 5dd21d3 commit be5281f

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

docs/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,22 @@ def setup(app):
8989
# -- Options for intersphinx extension ---------------------------------------
9090

9191
intersphinx_mapping = {
92+
"hatch": ("https://hatch.pypa.io/latest/", None),
93+
"jsonschema-specifications": (
94+
"https://jsonschema-specifications.readthedocs.io/en/latest/",
95+
None,
96+
),
9297
"pyrsistent": ("https://pyrsistent.readthedocs.io/en/latest/", None),
9398
"python": ("https://docs.python.org/", None),
99+
"setuptools": ("https://setuptools.pypa.io/en/latest/", None),
94100
}
95101

96102
# -- Options for extlinks extension ------------------------------------------
97103

98104
extlinks = {
99105
"gh": (str(HOMEPAGE) + "/%s", None),
100106
"github": (str(GITHUB) + "/%s", None),
107+
"hatch": ("https://hatch.pypa.io/latest/%s", None),
101108
}
102109

103110
# -- Options for the linkcheck builder ---------------------------------------

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ Contents
88
:glob:
99
:maxdepth: 2
1010

11+
schema-packages
1112
api

docs/schema-packages.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
===============
2+
Schema Packages
3+
===============
4+
5+
The `Registry` object is a useful way to ship Python packages which essentially bundle a set of JSON Schemas for use at runtime from Python.
6+
7+
In order to do so, you likely will want to:
8+
9+
* Collect together the JSON files you wish to ship
10+
* Put them inside a Python package (one you possibly tag with the ``jsonschema`` keyword for easy discoverability).
11+
Remember to ensure you have configured your build tool to include the JSON files in your built package distribution -- for e.g. :hatch:`hatch </>` this is likely automatic, but for `setuptools <setuptools:index>` may involve creating a suitable :file:`MANIFEST.in`.
12+
* Instantiate a `Registry` object somewhere globally within the package
13+
* Call `Registry.crawl` at import-time, such that users of your package get a "fully ready" registry to use
14+
15+
For an example of such a package, see `jsonschema-specifications <jsonschema-specifications:index>`, which bundles the JSON Schema "official" schemas for use.

docs/spelling_wordlist.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
autodetecting
22
deserialized
3+
discoverability
34
referenceable
45
resolvers
6+
runtime
7+
schemas
58
submodules
69
subresource
710
subresources

0 commit comments

Comments
 (0)