Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-fastjsonschema for openSUSE:Factory checked in at 2023-03-07 16:50:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-fastjsonschema (Old) and /work/SRC/openSUSE:Factory/.python-fastjsonschema.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-fastjsonschema" Tue Mar 7 16:50:05 2023 rev:3 rq:1069753 version:2.16.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-fastjsonschema/python-fastjsonschema.changes 2022-10-16 16:09:19.302769608 +0200 +++ /work/SRC/openSUSE:Factory/.python-fastjsonschema.new.31432/python-fastjsonschema.changes 2023-03-07 16:50:41.561697726 +0100 @@ -1,0 +2,6 @@ +Mon Mar 6 21:23:34 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 2.16.3: + * Fix variable name resolving with references + +------------------------------------------------------------------- Old: ---- fastjsonschema-2.16.2.tar.gz New: ---- fastjsonschema-2.16.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-fastjsonschema.spec ++++++ --- /var/tmp/diff_new_pack.Tvq4ew/_old 2023-03-07 16:50:42.137700758 +0100 +++ /var/tmp/diff_new_pack.Tvq4ew/_new 2023-03-07 16:50:42.141700779 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-fastjsonschema # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,12 +18,12 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-fastjsonschema -Version: 2.16.2 +Version: 2.16.3 Release: 0 Summary: Fastest Python implementation of JSON schema License: BSD-3-Clause Group: Development/Languages/Python -URL: https://github.com/seznam/python-fastjsonschema +URL: https://github.com/horejsek/python-fastjsonschema Source: https://files.pythonhosted.org/packages/source/f/fastjsonschema/fastjsonschema-%{version}.tar.gz BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} ++++++ fastjsonschema-2.16.2.tar.gz -> fastjsonschema-2.16.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fastjsonschema-2.16.2/PKG-INFO new/fastjsonschema-2.16.3/PKG-INFO --- old/fastjsonschema-2.16.2/PKG-INFO 2022-09-19 18:49:54.000000000 +0200 +++ new/fastjsonschema-2.16.3/PKG-INFO 2023-02-25 13:45:03.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: fastjsonschema -Version: 2.16.2 +Version: 2.16.3 Summary: Fastest Python implementation of JSON schema Home-page: https://github.com/horejsek/python-fastjsonschema Author: Michal Horejsek @@ -31,6 +31,9 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fastjsonschema-2.16.2/fastjsonschema/__init__.py new/fastjsonschema-2.16.3/fastjsonschema/__init__.py --- old/fastjsonschema-2.16.2/fastjsonschema/__init__.py 2022-01-09 09:39:24.000000000 +0100 +++ new/fastjsonschema-2.16.3/fastjsonschema/__init__.py 2023-02-25 13:43:53.000000000 +0100 @@ -18,25 +18,26 @@ ***** ``fastjsonschema`` implements validation of JSON documents by JSON schema. -The library implements JSON schema drafts 04, 06 and 07. The main purpose is +The library implements JSON schema drafts 04, 06, and 07. The main purpose is to have a really fast implementation. See some numbers: - * Probably most popular ``jsonschema`` can take up to 5 seconds for valid inputs - and 1.2 seconds for invalid inputs. - * Second most popular ``json-spec`` is even worse with up to 7.2 and 1.7 seconds. + * Probably the most popular, ``jsonschema``, can take up to 5 seconds for valid + inputs and 1.2 seconds for invalid inputs. + * Second most popular, ``json-spec``, is even worse with up to 7.2 and 1.7 seconds. * Last ``validictory``, now deprecated, is much better with 370 or 23 milliseconds, - but it does not follow all standards and it can be still slow for some purposes. + but it does not follow all standards, and it can be still slow for some purposes. With this library you can gain big improvements as ``fastjsonschema`` takes only about 25 milliseconds for valid inputs and 2 milliseconds for invalid ones. Pretty amazing, right? :-) -Technically it works by generating the most stupid code on the fly which is fast but -is hard to write by hand. The best efficiency is achieved when compiled once and used -many times, of course. It works similarly like regular expressions. But you can also -generate the code to the file which is even slightly faster. +Technically it works by generating the most stupid code on the fly, which is fast but +is hard to write by hand. The best efficiency is achieved when a validator is compiled +once and used many times, of course. It works similarly like regular expressions. But +you can also generate the code to a file, which is even slightly faster. -You can do the performance on your computer or server with an included script: +You can run the performance benchmarks on your computer or server with the included +script: .. code-block:: bash @@ -57,14 +58,14 @@ validictory invalid ==> 0.0232244 This library follows and implements `JSON schema draft-04, draft-06, and draft-07 -<http://json-schema.org>`_. Sometimes it's not perfectly clear so I recommend also +<http://json-schema.org>`_. Sometimes it's not perfectly clear, so I recommend also check out this `understanding JSON schema <https://spacetelescope.github.io/understanding-json-schema>`_. Note that there are some differences compared to JSON schema standard: * Regular expressions are full Python ones, not only what JSON schema allows. It's easier - to allow everything and also it's faster to compile without limits. So keep in mind that when - you will use a more advanced regular expression, it may not work with other library or in + to allow everything, and also it's faster to compile without limits. So keep in mind that when + you will use a more advanced regular expression, it may not work with other libraries or in other languages. * Because Python matches new line for a dollar in regular expressions (``a$`` matches ``a`` and ``a\\n``), instead of ``$`` is used ``\Z`` and all dollars in your regular expression are changed to ``\\Z`` @@ -72,6 +73,33 @@ * JSON schema says you can use keyword ``default`` for providing default values. This implementation uses that and always returns transformed input data. +Usage +***** + +.. code-block:: python + + import fastjsonschema + + point_schema = { + "type": "object", + "properties": { + "x": { + "type": "number", + }, + "y": { + "type": "number", + }, + }, + "required": ["x", "y"], + "additionalProperties": False, + } + + point_validator = fastjsonschema.compile(point_schema) + try: + point_validator({"x": 1.0, "y": 2.0}) + except fastjsonschema.JsonSchemaException as e: + print(f"Data failed validation: {e}") + API *** """ @@ -97,9 +125,9 @@ def validate(definition, data, handlers={}, formats={}, use_default=True): """ - Validation function for lazy programmers or for use cases, when you need + Validation function for lazy programmers or for use cases when you need to call validation only once, so you do not have to compile it first. - Use it only when you do not care about performance (even thought it will + Use it only when you do not care about performance (even though it will be still faster than alternative implementations). .. code-block:: python @@ -158,7 +186,7 @@ remote schemes used in your ``definition`` in parameter ``handlers``. Also, you can pass mapping for custom formats. Key is the name of your - formatter and value can be regular expression which will be compiled or + formatter and value can be regular expression, which will be compiled or callback returning `bool` (or you can raise your own exception). .. code-block:: python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fastjsonschema-2.16.2/fastjsonschema/generator.py new/fastjsonschema-2.16.3/fastjsonschema/generator.py --- old/fastjsonschema-2.16.2/fastjsonschema/generator.py 2022-07-17 09:30:32.000000000 +0200 +++ new/fastjsonschema-2.16.3/fastjsonschema/generator.py 2023-02-11 16:54:55.000000000 +0100 @@ -201,6 +201,8 @@ assert self._variable_name.startswith("data") path = self._variable_name[4:] name_arg = '(name_prefix or "data") + "{}"'.format(path) + if '{' in name_arg: + name_arg = name_arg + '.format(**locals())' self.l('{}({variable}, custom_formats, {name_arg})', name, name_arg=name_arg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fastjsonschema-2.16.2/fastjsonschema/version.py new/fastjsonschema-2.16.3/fastjsonschema/version.py --- old/fastjsonschema-2.16.2/fastjsonschema/version.py 2022-08-10 18:06:55.000000000 +0200 +++ new/fastjsonschema-2.16.3/fastjsonschema/version.py 2023-02-25 13:41:49.000000000 +0100 @@ -1 +1 @@ -VERSION = '2.16.2' +VERSION = '2.16.3' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fastjsonschema-2.16.2/fastjsonschema.egg-info/PKG-INFO new/fastjsonschema-2.16.3/fastjsonschema.egg-info/PKG-INFO --- old/fastjsonschema-2.16.2/fastjsonschema.egg-info/PKG-INFO 2022-09-19 18:49:53.000000000 +0200 +++ new/fastjsonschema-2.16.3/fastjsonschema.egg-info/PKG-INFO 2023-02-25 13:45:03.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: fastjsonschema -Version: 2.16.2 +Version: 2.16.3 Summary: Fastest Python implementation of JSON schema Home-page: https://github.com/horejsek/python-fastjsonschema Author: Michal Horejsek @@ -31,6 +31,9 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fastjsonschema-2.16.2/setup.py new/fastjsonschema-2.16.3/setup.py --- old/fastjsonschema-2.16.2/setup.py 2022-07-17 09:38:08.000000000 +0200 +++ new/fastjsonschema-2.16.3/setup.py 2023-02-25 13:43:53.000000000 +0100 @@ -41,19 +41,22 @@ license='BSD', classifiers=[ - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', + "Programming Language :: Python", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: CPython", - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Libraries :: Python Modules', + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", ], )