gituser/production/: jsonschema-4.2.1 metadata and description

Homepage Simple index

An implementation of JSON Schema validation for Python

author Julian Berman
author_email Julian@GrayVines.com
classifiers
  • Development Status :: 5 - Production/Stable
  • Intended Audience :: Developers
  • License :: OSI Approved :: MIT License
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Programming Language :: Python :: 3.7
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: Implementation :: CPython
  • Programming Language :: Python :: Implementation :: PyPy
description_content_type text/x-rst
license MIT
project_urls
  • Documentation, https://python-jsonschema.readthedocs.io/en/latest/
  • Source, https://github.com/Julian/jsonschema
  • Issues, https://github.com/Julian/jsonschema/issues/
provides_extras format_nongpl
requires_dist
  • attrs (>=17.4.0)
  • pyrsistent (!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0)
  • importlib-metadata ; python_version < "3.8"
  • importlib-resources (>=1.4.0) ; python_version < "3.9"
  • fqdn ; extra == 'format'
  • idna ; extra == 'format'
  • isoduration ; extra == 'format'
  • jsonpointer (>1.13) ; extra == 'format'
  • rfc3339-validator ; extra == 'format'
  • rfc3987 ; extra == 'format'
  • uri-template ; extra == 'format'
  • webcolors (>=1.11) ; extra == 'format'
  • fqdn ; extra == 'format_nongpl'
  • idna ; extra == 'format_nongpl'
  • isoduration ; extra == 'format_nongpl'
  • jsonpointer (>1.13) ; extra == 'format_nongpl'
  • rfc3339-validator ; extra == 'format_nongpl'
  • rfc3986-validator (>0.1.0) ; extra == 'format_nongpl'
  • uri-template ; extra == 'format_nongpl'
  • webcolors (>=1.11) ; extra == 'format_nongpl'
requires_python >=3.7
File Tox results History
jsonschema-4.2.1-py3-none-any.whl
Size
68 KB
Type
Python Wheel
Python
3

PyPI version Supported Python versions Build status ReadTheDocs status pre-commit.ci status Zenodo

jsonschema is an implementation of the JSON Schema specification for Python.

>>> from jsonschema import validate

>>> # A sample schema, like what we'd get from json.load()
>>> schema = {
...     "type" : "object",
...     "properties" : {
...         "price" : {"type" : "number"},
...         "name" : {"type" : "string"},
...     },
... }

>>> # If no exception is raised by validate(), the instance is valid.
>>> validate(instance={"name" : "Eggs", "price" : 34.99}, schema=schema)

>>> validate(
...     instance={"name" : "Eggs", "price" : "Invalid"}, schema=schema,
... )                                   # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
    ...
ValidationError: 'Invalid' is not of type 'number'

It can also be used from console:

$ jsonschema --instance sample.json sample.schema

Features

Installation

jsonschema is available on PyPI. You can install using pip:

$ pip install jsonschema

Running the Test Suite

If you have tox installed (perhaps via pip install tox or your package manager), running tox in the directory of your source checkout will run jsonschema’s test suite on all of the versions of Python jsonschema supports. If you don’t have all of the versions that jsonschema is tested under, you’ll likely want to run using tox’s --skip-missing-interpreters option.

Of course you’re also free to just run the tests on a single version with your favorite test runner. The tests live in the jsonschema.tests package.

Benchmarks

jsonschema’s benchmarks make use of pyperf. Running them can be done via:

$ tox -e perf

Community

The JSON Schema specification has a Slack, with an invite link on its home page. Many folks knowledgeable on authoring schemas can be found there.

Otherwise, asking questions on Stack Overflow is another means of getting help if you’re stuck.

Contributing

I’m Julian Berman.

jsonschema is on GitHub.

Get in touch, via GitHub or otherwise, if you’ve got something to contribute, it’d be most welcome!

You can also generally find me on Libera (nick: Julian) in various channels, including #python.

If you feel overwhelmingly grateful, you can also sponsor me.

And for companies who appreciate jsonschema and its continued support and growth, jsonschema is also now supportable via TideLift.