Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-jsonschema for 
openSUSE:Factory checked in at 2023-08-05 12:54:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-jsonschema (Old)
 and      /work/SRC/openSUSE:Factory/.python-jsonschema.new.22712 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-jsonschema"

Sat Aug  5 12:54:56 2023 rev:41 rq:1102347 version:4.18.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-jsonschema/python-jsonschema.changes      
2023-07-19 19:09:51.688295027 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-jsonschema.new.22712/python-jsonschema.changes
   2023-08-05 12:55:02.716632170 +0200
@@ -1,0 +2,13 @@
+Thu Aug  3 18:38:22 UTC 2023 - Johannes Kastl <ka...@b1-systems.de>
+
+- update to 4.18.6:
+  * Set a jsonschema specific user agent when automatically
+    retrieving remote references (which is deprecated).
+
+-------------------------------------------------------------------
+Thu Aug  3 17:44:21 UTC 2023 - Johannes Kastl <ka...@b1-systems.de>
+
+- update to 4.18.5:
+  * Declare support for Py3.12
+
+-------------------------------------------------------------------

Old:
----
  jsonschema-4.18.4.tar.gz

New:
----
  jsonschema-4.18.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-jsonschema.spec ++++++
--- /var/tmp/diff_new_pack.xKCmbB/_old  2023-08-05 12:55:03.760638849 +0200
+++ /var/tmp/diff_new_pack.xKCmbB/_new  2023-08-05 12:55:03.764638874 +0200
@@ -33,7 +33,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-jsonschema%{psuffix}
-Version:        4.18.4
+Version:        4.18.6
 Release:        0
 Summary:        An implementation of JSON-Schema validation for Python
 License:        MIT

++++++ jsonschema-4.18.4.tar.gz -> jsonschema-4.18.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/.github/workflows/ci.yml 
new/jsonschema-4.18.6/.github/workflows/ci.yml
--- old/jsonschema-4.18.4/.github/workflows/ci.yml      2020-02-02 
01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/.github/workflows/ci.yml      2020-02-02 
01:00:00.000000000 +0100
@@ -34,10 +34,7 @@
       - id: noxenvs-matrix
         run: |
           echo >>$GITHUB_OUTPUT noxenvs=$(
-            nox --list-sessions |
-            grep '^* ' |
-            cut -d ' ' -f 2- |
-            jq --raw-input --slurp 'split("\n") | map(select(. != ""))'
+            nox --list-sessions --json | jq '[.[].session]'
           )
 
   ci:
@@ -79,7 +76,14 @@
       - name: Set up Python
         uses: actions/setup-python@v4
         with:
-          python-version: "3.x"
+          python-version: |
+            3.8
+            3.9
+            3.10
+            3.11
+            3.12
+            pypy3.10
+          allow-prereleases: true
       - name: Set up nox
         uses: wntrblm/nox@2023.04.22
       - name: Enable UTF-8 on Windows
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/.pre-commit-config.yaml 
new/jsonschema-4.18.6/.pre-commit-config.yaml
--- old/jsonschema-4.18.4/.pre-commit-config.yaml       2020-02-02 
01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/.pre-commit-config.yaml       2020-02-02 
01:00:00.000000000 +0100
@@ -16,7 +16,7 @@
         args: [--fix, lf]
       - id: trailing-whitespace
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: "v0.0.278"
+    rev: "v0.0.281"
     hooks:
       - id: ruff
   - repo: https://github.com/PyCQA/isort
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/CHANGELOG.rst 
new/jsonschema-4.18.6/CHANGELOG.rst
--- old/jsonschema-4.18.4/CHANGELOG.rst 2020-02-02 01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/CHANGELOG.rst 2020-02-02 01:00:00.000000000 +0100
@@ -1,3 +1,13 @@
+v4.18.6
+=======
+
+* Set a ``jsonschema`` specific user agent when automatically retrieving 
remote references (which is deprecated).
+
+v4.18.5
+=======
+
+* Declare support for Py3.12
+
 v4.18.4
 =======
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/PKG-INFO 
new/jsonschema-4.18.6/PKG-INFO
--- old/jsonschema-4.18.4/PKG-INFO      2020-02-02 01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/PKG-INFO      2020-02-02 01:00:00.000000000 +0100
@@ -1,9 +1,9 @@
 Metadata-Version: 2.1
 Name: jsonschema
-Version: 4.18.4
+Version: 4.18.6
 Summary: An implementation of JSON Schema validation for Python
-Project-URL: Homepage, https://github.com/python-jsonschema/jsonschema
 Project-URL: Documentation, https://python-jsonschema.readthedocs.io/
+Project-URL: Homepage, https://github.com/python-jsonschema/jsonschema
 Project-URL: Issues, https://github.com/python-jsonschema/jsonschema/issues/
 Project-URL: Funding, https://github.com/sponsors/Julian
 Project-URL: Tidelift, 
https://tidelift.com/subscription/pkg/pypi-jsonschema?utm_source=pypi-jsonschema&utm_medium=referral&utm_campaign=pypi-link
@@ -23,6 +23,7 @@
 Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: File Formats :: JSON
@@ -168,7 +169,7 @@
 Release Information
 -------------------
 
-v4.18.4
+v4.18.6
 =======
 
-* Improve the hashability of wrapped referencing exceptions when they contain 
hashable data.
+* Set a ``jsonschema`` specific user agent when automatically retrieving 
remote references (which is deprecated).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/docs/requirements.txt 
new/jsonschema-4.18.6/docs/requirements.txt
--- old/jsonschema-4.18.4/docs/requirements.txt 2020-02-02 01:00:00.000000000 
+0100
+++ new/jsonschema-4.18.6/docs/requirements.txt 2020-02-02 01:00:00.000000000 
+0100
@@ -2,11 +2,13 @@
 # This file is autogenerated by pip-compile with Python 3.11
 # by the following command:
 #
-#    pip-compile --resolver=backtracking docs/requirements.in
+#    pip-compile --config=pyproject.toml docs/requirements.in
 #
 alabaster==0.7.13
     # via sphinx
-astroid==2.15.5
+anyascii==0.3.2
+    # via sphinx-autoapi
+astroid==2.15.6
     # via sphinx-autoapi
 attrs==23.1.0
     # via
@@ -16,19 +18,19 @@
     # via sphinx
 beautifulsoup4==4.12.2
     # via furo
-certifi==2023.5.7
+certifi==2023.7.22
     # via requests
-charset-normalizer==3.1.0
+charset-normalizer==3.2.0
     # via requests
-contourpy==1.0.7
+contourpy==1.1.0
     # via matplotlib
 cycler==0.11.0
     # via matplotlib
 docutils==0.20.1
     # via sphinx
-fonttools==4.39.4
+fonttools==4.41.1
     # via matplotlib
-furo==2023.5.20
+furo==2023.7.26
     # via -r docs/requirements.in
 idna==3.4
     # via requests
@@ -40,21 +42,21 @@
     #   sphinx-autoapi
 file:.#egg=jsonschema
     # via -r docs/requirements.in
-jsonschema-specifications==2023.5.1
+jsonschema-specifications==2023.7.1
     # via jsonschema
 kiwisolver==1.4.4
     # via matplotlib
 lazy-object-proxy==1.9.0
     # via astroid
-lxml==4.9.2
+lxml==4.9.3
     # via
     #   -r docs/requirements.in
     #   sphinx-json-schema-spec
-markupsafe==2.1.2
+markupsafe==2.1.3
     # via jinja2
-matplotlib==3.7.1
+matplotlib==3.7.2
     # via sphinxext-opengraph
-numpy==1.24.3
+numpy==1.25.1
     # via
     #   contourpy
     #   matplotlib
@@ -62,7 +64,7 @@
     # via
     #   matplotlib
     #   sphinx
-pillow==9.5.0
+pillow==10.0.0
     # via matplotlib
 pyenchant==3.2.2
     # via sphinxcontrib-spelling
@@ -74,15 +76,15 @@
     # via matplotlib
 python-dateutil==2.8.2
     # via matplotlib
-pyyaml==6.0
+pyyaml==6.0.1
     # via sphinx-autoapi
-referencing==0.28.4
+referencing==0.30.0
     # via
     #   jsonschema
     #   jsonschema-specifications
 requests==2.31.0
     # via sphinx
-rpds-py==0.7.1
+rpds-py==0.9.2
     # via
     #   jsonschema
     #   referencing
@@ -92,7 +94,7 @@
     # via sphinx
 soupsieve==2.4.1
     # via beautifulsoup4
-sphinx==7.0.1
+sphinx==7.1.1
     # via
     #   -r docs/requirements.in
     #   furo
@@ -103,15 +105,15 @@
     #   sphinx-json-schema-spec
     #   sphinxcontrib-spelling
     #   sphinxext-opengraph
-sphinx-autoapi==2.1.0
+sphinx-autoapi==2.1.1
     # via -r docs/requirements.in
-sphinx-autodoc-typehints==1.23.0
+sphinx-autodoc-typehints==1.24.0
     # via -r docs/requirements.in
-sphinx-basic-ng==1.0.0b1
+sphinx-basic-ng==1.0.0b2
     # via furo
 sphinx-copybutton==0.5.2
     # via -r docs/requirements.in
-sphinx-json-schema-spec==2023.5.2
+sphinx-json-schema-spec==2023.7.2
     # via -r docs/requirements.in
 sphinxcontrib-applehelp==1.0.4
     # via sphinx
@@ -129,9 +131,7 @@
     # via -r docs/requirements.in
 sphinxext-opengraph==0.8.2
     # via -r docs/requirements.in
-unidecode==1.3.6
-    # via sphinx-autoapi
-urllib3==2.0.2
+urllib3==2.0.4
     # via requests
 wrapt==1.15.0
     # via astroid
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/docs/validate.rst 
new/jsonschema-4.18.6/docs/validate.rst
--- old/jsonschema-4.18.4/docs/validate.rst     2020-02-02 01:00:00.000000000 
+0100
+++ new/jsonschema-4.18.6/docs/validate.rst     2020-02-02 01:00:00.000000000 
+0100
@@ -281,7 +281,7 @@
 
             Use `FormatChecker.checks` on an instance instead.
 
-.. autoexception:: FormatError
+.. autoexception:: jsonschema.exceptions.FormatError
     :noindex:
     :members:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/jsonschema/_format.py 
new/jsonschema-4.18.6/jsonschema/_format.py
--- old/jsonschema-4.18.4/jsonschema/_format.py 2020-02-02 01:00:00.000000000 
+0100
+++ new/jsonschema-4.18.6/jsonschema/_format.py 2020-02-02 01:00:00.000000000 
+0100
@@ -45,7 +45,7 @@
     checkers: dict[
         str,
         tuple[_FormatCheckCallable, _RaisesType],
-    ] = {}
+    ] = {}  # noqa: RUF012
 
     def __init__(self, formats: typing.Iterable[str] | None = None):
         if formats is None:
@@ -55,7 +55,7 @@
     def __repr__(self):
         return f"<FormatChecker checkers={sorted(self.checkers)}>"
 
-    def checks(  # noqa: D417,D214,D405 (charliermarsh/ruff#3547)
+    def checks(  # noqa: D417
         self, format: str, raises: _RaisesType = (),
     ) -> typing.Callable[[_F], _F]:
         """
@@ -75,7 +75,7 @@
                 The exception object will be accessible as the
                 `jsonschema.exceptions.ValidationError.cause` attribute of the
                 resulting validation error.
-        """  # noqa: D417,D214,D405 (charliermarsh/ruff#3547)
+        """  # noqa: D214,D405 (charliermarsh/ruff#3547)
 
         def _checks(func: _F) -> _F:
             self.checkers[format] = (func, raises)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jsonschema-4.18.4/jsonschema/benchmarks/nested_schemas.py 
new/jsonschema-4.18.6/jsonschema/benchmarks/nested_schemas.py
--- old/jsonschema-4.18.4/jsonschema/benchmarks/nested_schemas.py       
1970-01-01 01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/jsonschema/benchmarks/nested_schemas.py       
2020-02-02 01:00:00.000000000 +0100
@@ -0,0 +1,56 @@
+"""
+Validating highly nested schemas shouldn't cause exponential time blowups.
+
+See https://github.com/python-jsonschema/jsonschema/issues/1097.
+"""
+from itertools import cycle
+
+from jsonschema.validators import validator_for
+
+metaschemaish = {
+    "$id": "https://example.com/draft/2020-12/schema/strict";,
+    "$schema": "https://json-schema.org/draft/2020-12/schema";,
+
+    "$vocabulary": {
+        "https://json-schema.org/draft/2020-12/vocab/core": True,
+        "https://json-schema.org/draft/2020-12/vocab/applicator": True,
+        "https://json-schema.org/draft/2020-12/vocab/unevaluated": True,
+        "https://json-schema.org/draft/2020-12/vocab/validation": True,
+        "https://json-schema.org/draft/2020-12/vocab/meta-data": True,
+        "https://json-schema.org/draft/2020-12/vocab/format-annotation": True,
+        "https://json-schema.org/draft/2020-12/vocab/content": True
+    },
+    "$dynamicAnchor": "meta",
+
+    "$ref": "https://json-schema.org/draft/2020-12/schema";,
+    "unevaluatedProperties": False,
+}
+
+
+def nested_schema(levels):
+    """
+    Produce a schema which validates deeply nested objects and arrays.
+    """
+
+    names = cycle(["foo", "bar", "baz", "quux", "spam", "eggs"])
+    schema = {"type": "object", "properties": {"ham": {"type": "string"}}}
+    for _, name in zip(range(levels - 1), names):
+        schema = {"type": "object", "properties": {name: schema}}
+    return schema
+
+
+validator = validator_for(metaschemaish)(metaschemaish)
+
+if __name__ == "__main__":
+    from pyperf import Runner
+    runner = Runner()
+
+    not_nested = nested_schema(levels=1)
+    runner.bench_func("not nested", lambda: validator.is_valid(not_nested))
+
+    for levels in range(1, 11, 3):
+        schema = nested_schema(levels=levels)
+        runner.bench_func(
+            f"nested * {levels}",
+            lambda schema=schema: validator.is_valid(schema),
+        )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jsonschema-4.18.4/jsonschema/benchmarks/subcomponents.py 
new/jsonschema-4.18.6/jsonschema/benchmarks/subcomponents.py
--- old/jsonschema-4.18.4/jsonschema/benchmarks/subcomponents.py        
1970-01-01 01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/jsonschema/benchmarks/subcomponents.py        
2020-02-02 01:00:00.000000000 +0100
@@ -0,0 +1,42 @@
+"""
+A benchmark which tries to compare the possible slow subparts of validation.
+"""
+from referencing import Registry
+from referencing.jsonschema import DRAFT202012
+from rpds import HashTrieMap, HashTrieSet
+
+from jsonschema import Draft202012Validator
+
+schema = {
+    "type": "array",
+    "minLength": 1,
+    "maxLength": 1,
+    "items": {"type": "integer"}
+}
+
+hmap = HashTrieMap()
+hset = HashTrieSet()
+
+registry = Registry()
+
+v = Draft202012Validator(schema)
+
+
+def registry_data_structures():
+    return hmap.insert("foo", "bar"), hset.insert("foo")
+
+
+def registry_add():
+    resource = DRAFT202012.create_resource(schema)
+    return registry.with_resource(uri="urn:example", resource=resource)
+
+
+if __name__ == "__main__":
+    from pyperf import Runner
+    runner = Runner()
+
+    runner.bench_func("HashMap/HashSet insertion", registry_data_structures)
+    runner.bench_func("Registry insertion", registry_add)
+    runner.bench_func("Success", lambda: v.is_valid([1]))
+    runner.bench_func("Failure", lambda: v.is_valid(["foo"]))
+    runner.bench_func("Metaschema validation", lambda: v.check_schema(schema))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/jsonschema/tests/test_cli.py 
new/jsonschema-4.18.6/jsonschema/tests/test_cli.py
--- old/jsonschema-4.18.4/jsonschema/tests/test_cli.py  2020-02-02 
01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/jsonschema/tests/test_cli.py  2020-02-02 
01:00:00.000000000 +0100
@@ -84,18 +84,13 @@
 
         self.assertEqual(
             actual_exit_code, exit_code, msg=dedent(
-                """
-                    Expected an exit code of {} != {}.
+                f"""
+                    Expected an exit code of {exit_code} != {actual_exit_code}.
 
-                    stdout: {}
+                    stdout: {stdout.getvalue()}
 
-                    stderr: {}
-                """.format(
-                    exit_code,
-                    actual_exit_code,
-                    stdout.getvalue(),
-                    stderr.getvalue(),
-                ),
+                    stderr: {stderr.getvalue()}
+                """,
             ),
         )
         return stdout.getvalue(), stderr.getvalue()
@@ -450,9 +445,9 @@
             argv=["-i", "some_instance", "some_schema"],
 
             exit_code=1,
-            stderr="""\
-                Failed to parse 'some_instance': {}
-            """.format(_message_for(instance)),
+            stderr=f"""\
+                Failed to parse 'some_instance': {_message_for(instance)}
+            """,
         )
 
     def test_instance_is_invalid_JSON_pretty_output(self):
@@ -483,9 +478,9 @@
             argv=["some_schema"],
 
             exit_code=1,
-            stderr="""\
-                Failed to parse <stdin>: {}
-            """.format(_message_for(instance)),
+            stderr=f"""\
+                Failed to parse <stdin>: {_message_for(instance)}
+            """,
         )
 
     def test_instance_is_invalid_JSON_on_stdin_pretty_output(self):
@@ -513,9 +508,9 @@
             argv=["some_schema"],
 
             exit_code=1,
-            stderr="""\
-                Failed to parse 'some_schema': {}
-            """.format(_message_for(schema)),
+            stderr=f"""\
+                Failed to parse 'some_schema': {_message_for(schema)}
+            """,
         )
 
     def test_schema_is_invalid_JSON_pretty_output(self):
@@ -543,9 +538,9 @@
             argv=["some_schema"],
 
             exit_code=1,
-            stderr="""\
-                Failed to parse 'some_schema': {}
-            """.format(_message_for(schema)),
+            stderr=f"""\
+                Failed to parse 'some_schema': {_message_for(schema)}
+            """,
         )
 
     def test_schema_and_instance_are_both_invalid_JSON_pretty_output(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jsonschema-4.18.4/jsonschema/tests/test_deprecations.py 
new/jsonschema-4.18.6/jsonschema/tests/test_deprecations.py
--- old/jsonschema-4.18.4/jsonschema/tests/test_deprecations.py 2020-02-02 
01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/jsonschema/tests/test_deprecations.py 2020-02-02 
01:00:00.000000000 +0100
@@ -1,7 +1,11 @@
-from unittest import TestCase
-import importlib
+from contextlib import contextmanager
+from io import BytesIO
+from unittest import TestCase, mock
+import importlib.metadata
+import json
 import subprocess
 import sys
+import urllib.request
 
 import referencing.exceptions
 
@@ -16,8 +20,9 @@
 
         message = "Accessing jsonschema.__version__ is deprecated"
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import __version__  # noqa
+            from jsonschema import __version__
 
+        self.assertEqual(__version__, importlib.metadata.version("jsonschema"))
         self.assertEqual(w.filename, __file__)
 
     def test_validators_ErrorTree(self):
@@ -28,7 +33,7 @@
 
         message = "Importing ErrorTree from jsonschema.validators is "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema.validators import ErrorTree  # noqa
+            from jsonschema.validators import ErrorTree
 
         self.assertEqual(ErrorTree, exceptions.ErrorTree)
         self.assertEqual(w.filename, __file__)
@@ -41,7 +46,7 @@
 
         message = "Importing ErrorTree directly from the jsonschema package "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import ErrorTree  # noqa
+            from jsonschema import ErrorTree
 
         self.assertEqual(ErrorTree, exceptions.ErrorTree)
         self.assertEqual(w.filename, __file__)
@@ -54,7 +59,7 @@
 
         message = "Importing FormatError directly from the jsonschema package "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import FormatError  # noqa
+            from jsonschema import FormatError
 
         self.assertEqual(FormatError, exceptions.FormatError)
         self.assertEqual(w.filename, __file__)
@@ -145,7 +150,7 @@
 
         message = "jsonschema.RefResolver is deprecated"
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import RefResolver  # noqa: F401
+            from jsonschema import RefResolver
         self.assertEqual(w.filename, __file__)
 
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
@@ -160,13 +165,13 @@
 
         message = "jsonschema.exceptions.RefResolutionError is deprecated"
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import RefResolutionError  # noqa: F401
+            from jsonschema import RefResolutionError
 
         self.assertEqual(RefResolutionError, exceptions._RefResolutionError)
         self.assertEqual(w.filename, __file__)
 
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema.exceptions import RefResolutionError  # noqa
+            from jsonschema.exceptions import RefResolutionError
 
         self.assertEqual(RefResolutionError, exceptions._RefResolutionError)
         self.assertEqual(w.filename, __file__)
@@ -274,7 +279,7 @@
 
         message = "Accessing jsonschema.draft202012_format_checker is "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import draft202012_format_checker  # noqa
+            from jsonschema import draft202012_format_checker
 
         self.assertIs(
             draft202012_format_checker,
@@ -284,7 +289,7 @@
 
         message = "Accessing jsonschema.draft201909_format_checker is "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import draft201909_format_checker  # noqa
+            from jsonschema import draft201909_format_checker
 
         self.assertIs(
             draft201909_format_checker,
@@ -294,7 +299,7 @@
 
         message = "Accessing jsonschema.draft7_format_checker is "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import draft7_format_checker  # noqa
+            from jsonschema import draft7_format_checker
 
         self.assertIs(
             draft7_format_checker,
@@ -304,7 +309,7 @@
 
         message = "Accessing jsonschema.draft6_format_checker is "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import draft6_format_checker  # noqa
+            from jsonschema import draft6_format_checker
 
         self.assertIs(
             draft6_format_checker,
@@ -314,7 +319,7 @@
 
         message = "Accessing jsonschema.draft4_format_checker is "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import draft4_format_checker  # noqa
+            from jsonschema import draft4_format_checker
 
         self.assertIs(
             draft4_format_checker,
@@ -324,7 +329,7 @@
 
         message = "Accessing jsonschema.draft3_format_checker is "
         with self.assertWarnsRegex(DeprecationWarning, message) as w:
-            from jsonschema import draft3_format_checker  # noqa
+            from jsonschema import draft3_format_checker
 
         self.assertIs(
             draft3_format_checker,
@@ -357,3 +362,44 @@
             capture_output=True,
         )
         self.assertIn(b"The jsonschema CLI is deprecated ", process.stderr)
+
+    def test_automatic_remote_retrieval(self):
+        """
+        Automatic retrieval of remote references is deprecated as of v4.18.0.
+        """
+        ref = "http://bar#/$defs/baz";
+        schema = {
+            "$schema": "https://json-schema.org/draft/2020-12/schema";,
+            "$defs": {"baz": {"type": "integer"}},
+        }
+
+        if "requests" in sys.modules:  # pragma: no cover
+            self.addCleanup(
+                sys.modules.__setitem__, "requests", sys.modules["requests"],
+            )
+        sys.modules["requests"] = None
+
+        @contextmanager
+        def fake_urlopen(request):
+            self.assertIsInstance(request, urllib.request.Request)
+            self.assertEqual(request.full_url, "http://bar";)
+
+            # Ha ha urllib.request.Request "normalizes" header names and
+            # Request.get_header does not also normalize them...
+            (header, value), = request.header_items()
+            self.assertEqual(header.lower(), "user-agent")
+            self.assertEqual(
+                value, "python-jsonschema (deprecated $ref resolution)",
+            )
+            yield BytesIO(json.dumps(schema).encode("utf8"))
+
+        validator = validators.Draft202012Validator({"$ref": ref})
+
+        message = "Automatically retrieving remote references "
+        patch = mock.patch.object(urllib.request, "urlopen", new=fake_urlopen)
+
+        with patch, self.assertWarnsRegex(DeprecationWarning, message):
+            self.assertEqual(
+                (validator.is_valid({}), validator.is_valid(37)),
+                (False, True),
+            )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jsonschema-4.18.4/jsonschema/tests/test_validators.py 
new/jsonschema-4.18.6/jsonschema/tests/test_validators.py
--- old/jsonschema-4.18.4/jsonschema/tests/test_validators.py   2020-02-02 
01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/jsonschema/tests/test_validators.py   2020-02-02 
01:00:00.000000000 +0100
@@ -2393,7 +2393,7 @@
     def test_newly_created_validator_with_ref_resolver(self):
         """
         See 
https://github.com/python-jsonschema/jsonschema/issues/1061#issuecomment-1624266555.
-        """  # noqa: E501
+        """
 
         def handle(uri):
             self.assertEqual(uri, "http://example.com/foo";)
@@ -2414,7 +2414,7 @@
     def test_refresolver_with_pointer_in_schema_with_no_id(self):
         """
         See 
https://github.com/python-jsonschema/jsonschema/issues/1124#issuecomment-1632574249.
-        """  # noqa: E501
+        """
 
         schema = {
             "properties": {"x": {"$ref": "#/definitions/x"}},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/jsonschema/validators.py 
new/jsonschema-4.18.6/jsonschema/validators.py
--- old/jsonschema-4.18.4/jsonschema/validators.py      2020-02-02 
01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/jsonschema/validators.py      2020-02-02 
01:00:00.000000000 +0100
@@ -103,8 +103,10 @@
 
 
 def _warn_for_remote_retrieve(uri: str):
-    from urllib.request import urlopen
-    with urlopen(uri) as response:
+    from urllib.request import Request, urlopen
+    headers = {"User-Agent": "python-jsonschema (deprecated $ref resolution)"}
+    request = Request(uri, headers=headers)
+    with urlopen(request) as response:
         warnings.warn(
             "Automatically retrieving remote references can be a security "
             "vulnerability and is discouraged by the JSON Schema "
@@ -213,8 +215,8 @@
     @define
     class Validator:
 
-        VALIDATORS = dict(validators)
-        META_SCHEMA = dict(meta_schema)
+        VALIDATORS = dict(validators)  # noqa: RUF012
+        META_SCHEMA = dict(meta_schema)  # noqa: RUF012
         TYPE_CHECKER = type_checker
         FORMAT_CHECKER = format_checker_arg
         ID_OF = staticmethod(id_of)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/noxfile.py 
new/jsonschema-4.18.6/noxfile.py
--- old/jsonschema-4.18.4/noxfile.py    2020-02-02 01:00:00.000000000 +0100
+++ new/jsonschema-4.18.6/noxfile.py    2020-02-02 01:00:00.000000000 +0100
@@ -42,7 +42,7 @@
     return _session
 
 
-@session(python=["3.8", "3.9", "3.10", "3.11", "pypy3"])
+@session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"])
 @nox.parametrize("installable", INSTALLABLE)
 def tests(session, installable):
 
@@ -155,6 +155,7 @@
         argv = ["-n", "-T", "-W"]
         if builder != "spelling":
             argv += ["-q"]
+        posargs = session.posargs or [tmpdir / builder]
         session.run(
             "python",
             "-m",
@@ -162,8 +163,8 @@
             "-b",
             builder,
             DOCS,
-            tmpdir / builder,
             *argv,
+            *posargs,
         )
 
 
@@ -201,7 +202,7 @@
 @session(default=False)
 def requirements(session):
     session.install("pip-tools")
-    for each in [DOCS / "requirements.in", ROOT / "test-requirements.in"]:
+    for each in [DOCS / "requirements.in"]:
         session.run(
             "pip-compile",
             "--resolver",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jsonschema-4.18.4/pyproject.toml 
new/jsonschema-4.18.6/pyproject.toml
--- old/jsonschema-4.18.4/pyproject.toml        2020-02-02 01:00:00.000000000 
+0100
+++ new/jsonschema-4.18.6/pyproject.toml        2020-02-02 01:00:00.000000000 
+0100
@@ -25,6 +25,7 @@
   "Programming Language :: Python :: 3.9",
   "Programming Language :: Python :: 3.10",
   "Programming Language :: Python :: 3.11",
+  "Programming Language :: Python :: 3.12",
   "Programming Language :: Python :: Implementation :: CPython",
   "Programming Language :: Python :: Implementation :: PyPy",
   "Topic :: File Formats :: JSON",
@@ -68,8 +69,8 @@
 jsonschema = "jsonschema.cli:main"
 
 [project.urls]
-Homepage = "https://github.com/python-jsonschema/jsonschema";
 Documentation = "https://python-jsonschema.readthedocs.io/";
+Homepage = "https://github.com/python-jsonschema/jsonschema";
 Issues = "https://github.com/python-jsonschema/jsonschema/issues/";
 Funding = "https://github.com/sponsors/Julian";
 Tidelift = 
"https://tidelift.com/subscription/pkg/pypi-jsonschema?utm_source=pypi-jsonschema&utm_medium=referral&utm_campaign=pypi-link";
@@ -136,11 +137,12 @@
 [tool.mypy]
 ignore_missing_imports = true
 show_error_codes = true
+exclude = ["jsonschema/benchmarks/*"]
 
 [tool.ruff]
 line-length = 79
 target-version = "py38"
-select = ["B", "D", "D204", "E", "F", "Q", "SIM", "UP", "W"]
+select = ["B", "D", "D204", "E", "F", "Q", "RUF", "SIM", "UP", "W"]
 ignore = [
   # Wat, type annotations for self and cls, why is this a thing?
   "ANN101",
@@ -169,6 +171,8 @@
   "D407",
   # Plz spaces after section headers
   "D412",
+  # We support 3.8 + 3.9
+  "UP007",
 ]
 extend-exclude = ["json"]
 
@@ -181,4 +185,4 @@
 "jsonschema/cli.py" = ["D", "SIM", "UP"]
 "jsonschema/_utils.py" = ["D"]
 "jsonschema/benchmarks/*" = ["D"]
-"jsonschema/tests/*" = ["ANN", "D", "SIM"]
+"jsonschema/tests/*" = ["ANN", "D", "RUF012", "SIM"]

Reply via email to