- Update to 0.7.0
* allow a 'message' field in an event schema #72 (@Zsailer) * Improve usability of jp_read_emitted_events fixture #74 (@kevin-bates) - Fix libalternatives/update-alternatives - Drop jupyter_events-pr80-jsonschema-referencing.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:jupyter/python-jupyter-events?expand=0&rev=14
This commit is contained in:
parent
5ba773099f
commit
1795cf6e38
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9a6e9995f75d1b7146b436ea24d696ce3a35bfa8bfe45e0c33c334c79464d0b3
|
||||
size 59393
|
3
jupyter_events-0.7.0.tar.gz
Normal file
3
jupyter_events-0.7.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7be27f54b8388c03eefea123a4f79247c5b9381c49fb1cd48615ee191eb12615
|
||||
size 59717
|
@ -1,209 +0,0 @@
|
||||
From d7c265b3362d68a4796f08f852745a3fd300d9ca Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Herrero <26092748+hbcarlos@users.noreply.github.com>
|
||||
Date: Wed, 12 Jul 2023 17:58:15 +0200
|
||||
Subject: [PATCH 01/15] Migrate RefResolver to referencing.Registry
|
||||
|
||||
---
|
||||
jupyter_events/schema.py | 11 ++++++-----
|
||||
jupyter_events/validators.py | 16 +++++++++++-----
|
||||
pyproject.toml | 1 +
|
||||
3 files changed, 18 insertions(+), 10 deletions(-)
|
||||
|
||||
Index: jupyter_events-0.6.3/jupyter_events/schema.py
|
||||
===================================================================
|
||||
--- jupyter_events-0.6.3.orig/jupyter_events/schema.py
|
||||
+++ jupyter_events-0.6.3/jupyter_events/schema.py
|
||||
@@ -3,7 +3,9 @@ import json
|
||||
from pathlib import Path, PurePath
|
||||
from typing import Optional, Type, Union
|
||||
|
||||
-from jsonschema import FormatChecker, RefResolver, validators
|
||||
+from jsonschema import FormatChecker, validators
|
||||
+from referencing import Registry
|
||||
+from referencing.jsonschema import DRAFT7
|
||||
|
||||
try:
|
||||
from jsonschema.protocols import Validator
|
||||
@@ -55,8 +57,8 @@ class EventSchema:
|
||||
any schema registered here follows the expected form
|
||||
of Jupyter Events.
|
||||
|
||||
- resolver:
|
||||
- RefResolver for nested JSON schema references.
|
||||
+ registry:
|
||||
+ Registry for nested JSON schema references.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@@ -64,14 +66,18 @@ class EventSchema:
|
||||
schema: SchemaType,
|
||||
validator_class: Type[Validator] = validators.Draft7Validator, # type:ignore[assignment]
|
||||
format_checker: FormatChecker = draft7_format_checker,
|
||||
- resolver: Optional[RefResolver] = None,
|
||||
+ registry: Optional[Registry] = None,
|
||||
):
|
||||
"""Initialize an event schema."""
|
||||
_schema = self._load_schema(schema)
|
||||
# Validate the schema against Jupyter Events metaschema.
|
||||
validate_schema(_schema)
|
||||
+
|
||||
+ if registry is None:
|
||||
+ registry = DRAFT7.create_resource(_schema) @ Registry()
|
||||
+
|
||||
# Create a validator for this schema
|
||||
- self._validator = validator_class(_schema, resolver=resolver, format_checker=format_checker)
|
||||
+ self._validator = validator_class(_schema, registry=registry, format_checker=format_checker) # type: ignore
|
||||
self._schema = _schema
|
||||
|
||||
def __repr__(self):
|
||||
Index: jupyter_events-0.6.3/jupyter_events/validators.py
|
||||
===================================================================
|
||||
--- jupyter_events-0.6.3.orig/jupyter_events/validators.py
|
||||
+++ jupyter_events-0.6.3/jupyter_events/validators.py
|
||||
@@ -2,7 +2,9 @@
|
||||
import pathlib
|
||||
|
||||
import jsonschema
|
||||
-from jsonschema import Draft7Validator, RefResolver, ValidationError
|
||||
+from jsonschema import Draft7Validator, ValidationError
|
||||
+from referencing import Registry
|
||||
+from referencing.jsonschema import DRAFT7
|
||||
|
||||
draft7_format_checker = (
|
||||
Draft7Validator.FORMAT_CHECKER
|
||||
@@ -29,19 +31,21 @@ SCHEMA_STORE = {
|
||||
EVENT_CORE_SCHEMA["$id"]: EVENT_CORE_SCHEMA,
|
||||
}
|
||||
|
||||
-METASCHEMA_RESOLVER = RefResolver(
|
||||
- base_uri=EVENT_METASCHEMA["$id"], referrer=EVENT_METASCHEMA, store=SCHEMA_STORE
|
||||
-)
|
||||
+resources = [
|
||||
+ DRAFT7.create_resource(each)
|
||||
+ for each in (EVENT_METASCHEMA, PROPERTY_METASCHEMA, EVENT_CORE_SCHEMA)
|
||||
+]
|
||||
+METASCHEMA_REGISTRY: Registry = resources @ Registry()
|
||||
|
||||
-JUPYTER_EVENTS_SCHEMA_VALIDATOR = Draft7Validator(
|
||||
+JUPYTER_EVENTS_SCHEMA_VALIDATOR = Draft7Validator( # type: ignore
|
||||
schema=EVENT_METASCHEMA,
|
||||
- resolver=METASCHEMA_RESOLVER,
|
||||
+ registry=METASCHEMA_REGISTRY,
|
||||
format_checker=draft7_format_checker,
|
||||
)
|
||||
|
||||
-JUPYTER_EVENTS_CORE_VALIDATOR = Draft7Validator(
|
||||
+JUPYTER_EVENTS_CORE_VALIDATOR = Draft7Validator( # type: ignore
|
||||
schema=EVENT_CORE_SCHEMA,
|
||||
- resolver=METASCHEMA_RESOLVER,
|
||||
+ registry=METASCHEMA_REGISTRY,
|
||||
format_checker=draft7_format_checker,
|
||||
)
|
||||
|
||||
Index: jupyter_events-0.6.3/pyproject.toml
|
||||
===================================================================
|
||||
--- jupyter_events-0.6.3.orig/pyproject.toml
|
||||
+++ jupyter_events-0.6.3/pyproject.toml
|
||||
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
||||
name = "jupyter-events"
|
||||
description = "Jupyter Event System library"
|
||||
readme = "README.md"
|
||||
-requires-python = ">=3.7"
|
||||
+requires-python = ">=3.8"
|
||||
authors = [
|
||||
{ name = "Jupyter Development Team", email = "jupyter@googlegroups.com" },
|
||||
]
|
||||
@@ -23,7 +23,8 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
]
|
||||
dependencies = [
|
||||
- "jsonschema[format-nongpl,format_nongpl]>=3.2.0",
|
||||
+ "referencing",
|
||||
+ "jsonschema[format-nongpl,format_nongpl]>=4.18.0",
|
||||
"python-json-logger>=2.0.4",
|
||||
"pyyaml>=5.3",
|
||||
"traitlets>=5.3",
|
||||
Index: jupyter_events-0.6.3/.github/workflows/python-tests.yml
|
||||
===================================================================
|
||||
--- jupyter_events-0.6.3.orig/.github/workflows/python-tests.yml
|
||||
+++ jupyter_events-0.6.3/.github/workflows/python-tests.yml
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
- python-version: ["3.7", "3.11"]
|
||||
+ python-version: ["3.8", "3.12"]
|
||||
include:
|
||||
- os: windows-latest
|
||||
python-version: "3.9"
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
- os: ubuntu-latest
|
||||
python-version: "3.10"
|
||||
- os: macos-latest
|
||||
- python-version: "3.8"
|
||||
+ python-version: "3.11"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
|
||||
Index: jupyter_events-0.6.3/tests/test_logger.py
|
||||
===================================================================
|
||||
--- jupyter_events-0.6.3.orig/tests/test_logger.py
|
||||
+++ jupyter_events-0.6.3/tests/test_logger.py
|
||||
@@ -1,6 +1,7 @@
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
+import sys
|
||||
from datetime import datetime, timedelta
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
@@ -158,12 +159,15 @@ def test_emit():
|
||||
assert "__timestamp__" in event_capsule
|
||||
# Remove timestamp from capsule when checking equality, since it is gonna vary
|
||||
del event_capsule["__timestamp__"]
|
||||
- assert event_capsule == {
|
||||
+ expected = {
|
||||
"__schema__": "http://test/test",
|
||||
"__schema_version__": 1,
|
||||
"__metadata_version__": 1,
|
||||
"something": "blah",
|
||||
}
|
||||
+ if sys.version_info >= (3, 12):
|
||||
+ expected["taskName"] = None
|
||||
+ assert event_capsule == expected
|
||||
|
||||
|
||||
def test_register_event_schema(tmp_path):
|
||||
@@ -320,24 +324,30 @@ def test_unique_logger_instances():
|
||||
assert "__timestamp__" in event_capsule0
|
||||
# Remove timestamp from capsule when checking equality, since it is gonna vary
|
||||
del event_capsule0["__timestamp__"]
|
||||
- assert event_capsule0 == {
|
||||
+ expected = {
|
||||
"__schema__": "http://test/test0",
|
||||
"__schema_version__": 1,
|
||||
"__metadata_version__": 1,
|
||||
"something": "blah",
|
||||
}
|
||||
+ if sys.version_info >= (3, 12):
|
||||
+ expected["taskName"] = None
|
||||
+ assert event_capsule0 == expected
|
||||
|
||||
event_capsule1 = json.loads(output1.getvalue())
|
||||
|
||||
assert "__timestamp__" in event_capsule1
|
||||
# Remove timestamp from capsule when checking equality, since it is gonna vary
|
||||
del event_capsule1["__timestamp__"]
|
||||
- assert event_capsule1 == {
|
||||
+ expected = {
|
||||
"__schema__": "http://test/test1",
|
||||
"__schema_version__": 1,
|
||||
"__metadata_version__": 1,
|
||||
"something": "blah",
|
||||
}
|
||||
+ if sys.version_info >= (3, 12):
|
||||
+ expected["taskName"] = None
|
||||
+ assert event_capsule1 == expected
|
||||
|
||||
|
||||
def test_register_duplicate_schemas():
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 23 08:11:45 UTC 2023 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Update to 0.7.0
|
||||
* allow a 'message' field in an event schema #72 (@Zsailer)
|
||||
* Improve usability of jp_read_emitted_events fixture #74
|
||||
(@kevin-bates)
|
||||
- Fix libalternatives/update-alternatives
|
||||
- Drop jupyter_events-pr80-jsonschema-referencing.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 23 07:36:24 UTC 2023 - ecsos <ecsos@opensuse.org>
|
||||
|
||||
|
@ -21,16 +21,15 @@
|
||||
%else
|
||||
%bcond_with libalternatives
|
||||
%endif
|
||||
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-jupyter-events
|
||||
Version: 0.6.3
|
||||
Version: 0.7.0
|
||||
Release: 0
|
||||
Summary: Jupyter Event System library
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com/jupyter/jupyter_events
|
||||
Source: https://files.pythonhosted.org/packages/source/j/jupyter_events/jupyter_events-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM jupyter_events-pr80-jsonschema-referencing.patch gh#jupyter/jupyter_events#80
|
||||
Patch0: jupyter_events-pr80-jsonschema-referencing.patch
|
||||
BuildRequires: %{python_module base >= 3.8}
|
||||
BuildRequires: %{python_module hatchling >= 1.5}
|
||||
BuildRequires: %{python_module pip}
|
||||
@ -47,6 +46,13 @@ Requires: python-rfc3986-validator >= 0.1.1
|
||||
Requires: python-traitlets >= 5.3
|
||||
Provides: python-jupyter_events = %{version}-%{release}
|
||||
BuildArch: noarch
|
||||
%if %{with libalternatives}
|
||||
BuildRequires: alts
|
||||
Requires: alts
|
||||
%else
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
%endif
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module rfc3339-validator}
|
||||
BuildRequires: %{python_module PyYAML >= 5.3}
|
||||
@ -99,6 +105,7 @@ which jupyter-events || ln -s %{buildroot}%{_bindir}/jupyter-events-%{$python_bi
|
||||
%python_uninstall_alternative jupyter-events
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%python_alternative %{_bindir}/jupyter-events
|
||||
%{python_sitelib}/jupyter_events
|
||||
%{python_sitelib}/jupyter_events-%{version}.dist-info
|
||||
|
Loading…
Reference in New Issue
Block a user