Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-jupyter-server-fileid for 
openSUSE:Factory checked in at 2023-12-25 19:05:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-jupyter-server-fileid (Old)
 and      /work/SRC/openSUSE:Factory/.python-jupyter-server-fileid.new.28375 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-jupyter-server-fileid"

Mon Dec 25 19:05:33 2023 rev:4 rq:1134928 version:0.9.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-jupyter-server-fileid/python-jupyter-server-fileid.changes
        2023-08-18 19:28:51.755370072 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-jupyter-server-fileid.new.28375/python-jupyter-server-fileid.changes
     2023-12-25 19:05:47.574560889 +0100
@@ -1,0 +2,9 @@
+Sat Dec 23 19:41:16 UTC 2023 - Ben Greiner <[email protected]>
+
+- Update to 0.9.1
+  * Add a simple REST API for fetching a file's ID #72 (@Zsailer)
+  * Allow db_path to be set to ":memory:" #70 (@cmd-ntrf)
+  * provides a summary description for pip #68 (@stonebig)
+
+
+-------------------------------------------------------------------

Old:
----
  jupyter_server_fileid-0.9.0.tar.gz

New:
----
  jupyter_server_fileid-0.9.1.tar.gz

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

Other differences:
------------------
++++++ python-jupyter-server-fileid.spec ++++++
--- /var/tmp/diff_new_pack.zF2b7X/_old  2023-12-25 19:05:48.726602931 +0100
+++ /var/tmp/diff_new_pack.zF2b7X/_new  2023-12-25 19:05:48.730603077 +0100
@@ -16,8 +16,8 @@
 #
 
 
-%define pyversion 0.9.0
-%define distversion 0.9
+%define pyversion 0.9.1
+%define distversion 0.9.1
 %if 0%{?suse_version} > 1500
 %bcond_without libalternatives
 %else

++++++ jupyter_server_fileid-0.9.0.tar.gz -> jupyter_server_fileid-0.9.1.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jupyter_server_fileid-0.9.0/.readthedocs.yaml 
new/jupyter_server_fileid-0.9.1/.readthedocs.yaml
--- old/jupyter_server_fileid-0.9.0/.readthedocs.yaml   1970-01-01 
01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/.readthedocs.yaml   2020-02-02 
01:00:00.000000000 +0100
@@ -0,0 +1,35 @@
+# Read the Docs configuration file for Sphinx projects
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+# Set the OS, Python version and other tools you might need
+build:
+  os: ubuntu-22.04
+  tools:
+    python: "3.12"
+    # You can also specify other tool versions:
+    # nodejs: "20"
+    # rust: "1.70"
+    # golang: "1.20"
+
+# Build documentation in the "docs/" directory with Sphinx
+sphinx:
+  configuration: docs/conf.py
+  # You can configure Sphinx to use a different builder, for instance use the 
dirhtml builder for simpler URLs
+  # builder: "dirhtml"
+  # Fail on all warnings to avoid broken references
+  # fail_on_warning: true
+
+# Optionally build your docs in additional formats such as PDF and ePub
+# formats:
+#   - pdf
+#   - epub
+
+# Optional but recommended, declare the Python requirements required
+# to build your documentation
+# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
+python:
+  install:
+    - requirements: docs/requirements.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jupyter_server_fileid-0.9.0/CHANGELOG.md 
new/jupyter_server_fileid-0.9.1/CHANGELOG.md
--- old/jupyter_server_fileid-0.9.0/CHANGELOG.md        2020-02-02 
01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/CHANGELOG.md        2020-02-02 
01:00:00.000000000 +0100
@@ -2,6 +2,28 @@
 
 <!-- <START NEW CHANGELOG ENTRY> -->
 
+## 0.9.1
+
+([Full 
Changelog](https://github.com/jupyter-server/jupyter_server_fileid/compare/v0.9.0...a5e65c99791a20e4684c55f631d2d7fef3c3fdad))
+
+### Bugs fixed
+
+- Add RTD config to fix CI 
[#73](https://github.com/jupyter-server/jupyter_server_fileid/pull/73) 
([@dlqqq](https://github.com/dlqqq))
+
+### Other merged PRs
+
+- Add a simple REST API for fetching a file's ID 
[#72](https://github.com/jupyter-server/jupyter_server_fileid/pull/72) 
([@Zsailer](https://github.com/Zsailer))
+- Allow db_path to be set to ":memory:" 
[#70](https://github.com/jupyter-server/jupyter_server_fileid/pull/70) 
([@cmd-ntrf](https://github.com/cmd-ntrf))
+- provides a summary description for pip 
[#68](https://github.com/jupyter-server/jupyter_server_fileid/pull/68) 
([@stonebig](https://github.com/stonebig))
+
+### Contributors to this release
+
+([GitHub contributors page for this 
release](https://github.com/jupyter-server/jupyter_server_fileid/graphs/contributors?from=2023-04-09&to=2023-12-19&type=c))
+
+[@cmd-ntrf](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server_fileid+involves%3Acmd-ntrf+updated%3A2023-04-09..2023-12-19&type=Issues)
 | 
[@codecov](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server_fileid+involves%3Acodecov+updated%3A2023-04-09..2023-12-19&type=Issues)
 | 
[@dlqqq](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server_fileid+involves%3Adlqqq+updated%3A2023-04-09..2023-12-19&type=Issues)
 | 
[@stonebig](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server_fileid+involves%3Astonebig+updated%3A2023-04-09..2023-12-19&type=Issues)
 | 
[@welcome](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server_fileid+involves%3Awelcome+updated%3A2023-04-09..2023-12-19&type=Issues)
 | 
[@Zsailer](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server_fileid+involves%3AZsailer+updated%3A2023-04-09..2023-12-19&type=Issues)
+
+<!-- <END NEW CHANGELOG ENTRY> -->
+
 ## 0.9.0
 
 ([Full 
Changelog](https://github.com/jupyter-server/jupyter_server_fileid/compare/v0.8.0...505806162b4df60b4cbb461cfec1266b81df32ce))
@@ -17,8 +39,6 @@
 
 
[@dleen](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server_fileid+involves%3Adleen+updated%3A2023-02-23..2023-04-09&type=Issues)
 | 
[@dlqqq](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server_fileid+involves%3Adlqqq+updated%3A2023-02-23..2023-04-09&type=Issues)
 
-<!-- <END NEW CHANGELOG ENTRY> -->
-
 ## 0.8.0
 
 ([Full 
Changelog](https://github.com/jupyter-server/jupyter_server_fileid/compare/v0.7.0...542ccebfcf7713a81a4f2fbd07e8227573c3a282))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jupyter_server_fileid-0.9.0/PKG-INFO 
new/jupyter_server_fileid-0.9.1/PKG-INFO
--- old/jupyter_server_fileid-0.9.0/PKG-INFO    2020-02-02 01:00:00.000000000 
+0100
+++ new/jupyter_server_fileid-0.9.1/PKG-INFO    2020-02-02 01:00:00.000000000 
+0100
@@ -1,6 +1,7 @@
 Metadata-Version: 2.1
 Name: jupyter_server_fileid
-Version: 0.9.0
+Version: 0.9.1
+Summary: Jupyter Server extension providing an implementation of the File ID 
service.
 Project-URL: Home, https://github.com/jupyter-server/jupyter_server_fileid
 Author-email: "David L. Qiu" <[email protected]>
 License: BSD 3-Clause License
@@ -51,6 +52,7 @@
 Requires-Dist: jupyter-server[test]<3,>=1.15; extra == 'test'
 Requires-Dist: pytest; extra == 'test'
 Requires-Dist: pytest-cov; extra == 'test'
+Requires-Dist: pytest-jupyter; extra == 'test'
 Description-Content-Type: text/markdown
 
 # jupyter_server_fileid
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jupyter_server_fileid-0.9.0/conftest.py 
new/jupyter_server_fileid-0.9.1/conftest.py
--- old/jupyter_server_fileid-0.9.0/conftest.py 2020-02-02 01:00:00.000000000 
+0100
+++ new/jupyter_server_fileid-0.9.1/conftest.py 2020-02-02 01:00:00.000000000 
+0100
@@ -1 +1,5 @@
-pytest_plugins = ["jupyter_server.pytest_plugin", 
"jupyter_server_fileid.pytest_plugin"]
+pytest_plugins = [
+    "jupyter_server.pytest_plugin",
+    "jupyter_server_fileid.pytest_plugin",
+    "pytest_jupyter",
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jupyter_server_fileid-0.9.0/jupyter_server_fileid/__init__.py 
new/jupyter_server_fileid-0.9.1/jupyter_server_fileid/__init__.py
--- old/jupyter_server_fileid-0.9.0/jupyter_server_fileid/__init__.py   
2020-02-02 01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/jupyter_server_fileid/__init__.py   
2020-02-02 01:00:00.000000000 +0100
@@ -1,7 +1,7 @@
 """A Jupyter Server extension providing an implementation of the File ID 
service."""
 from .extension import FileIdExtension
 
-__version__ = "0.9.0"
+__version__ = "0.9.1"
 
 
 def _jupyter_server_extension_points():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jupyter_server_fileid-0.9.0/jupyter_server_fileid/extension.py 
new/jupyter_server_fileid-0.9.1/jupyter_server_fileid/extension.py
--- old/jupyter_server_fileid-0.9.0/jupyter_server_fileid/extension.py  
2020-02-02 01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/jupyter_server_fileid/extension.py  
2020-02-02 01:00:00.000000000 +0100
@@ -1,7 +1,8 @@
 from jupyter_events.logger import EventLogger
 from jupyter_server.extension.application import ExtensionApp
-from traitlets import Type
+from traitlets import Instance, Type
 
+from jupyter_server_fileid.handler import FileIDHandler, FilePathHandler
 from jupyter_server_fileid.manager import ArbitraryFileIdManager, 
BaseFileIdManager
 
 
@@ -10,7 +11,7 @@
 
     file_id_manager_class = Type(
         klass=BaseFileIdManager,
-        help="""File ID manager instance to use.
+        help="""File ID manager class to use.
 
         Defaults to ArbitraryFileIdManager.
         """,
@@ -18,20 +19,25 @@
         default_value=ArbitraryFileIdManager,
     )
 
+    file_id_manager = Instance(
+        klass=BaseFileIdManager, help="An instance of the File ID manager.", 
allow_none=True
+    )
+
+    handlers = [("/api/fileid/id", FileIDHandler), ("/api/fileid/path", 
FilePathHandler)]
+
     def initialize_settings(self):
         self.log.info(f"Configured File ID manager: 
{self.file_id_manager_class.__name__}")
-        file_id_manager = self.file_id_manager_class(
+        self.file_id_manager = self.file_id_manager_class(
             log=self.log, root_dir=self.serverapp.root_dir, config=self.config
         )
-        self.settings.update({"file_id_manager": file_id_manager})
+        self.settings.update({"file_id_manager": self.file_id_manager})
 
         # attach listener to contents manager events (requires 
jupyter_server~=2)
         if "event_logger" in self.settings:
             self.initialize_event_listeners()
 
     def initialize_event_listeners(self):
-        file_id_manager = self.settings["file_id_manager"]
-        handlers_by_action = file_id_manager.get_handlers_by_action()
+        handlers_by_action = self.file_id_manager.get_handlers_by_action()
 
         async def cm_listener(logger: EventLogger, schema_id: str, data: dict) 
-> None:
             handler = handlers_by_action[data["action"]]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jupyter_server_fileid-0.9.0/jupyter_server_fileid/handler.py 
new/jupyter_server_fileid-0.9.1/jupyter_server_fileid/handler.py
--- old/jupyter_server_fileid-0.9.0/jupyter_server_fileid/handler.py    
1970-01-01 01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/jupyter_server_fileid/handler.py    
2020-02-02 01:00:00.000000000 +0100
@@ -0,0 +1,61 @@
+from jupyter_server.auth.decorator import authorized
+from jupyter_server.base.handlers import APIHandler
+from tornado import web
+from tornado.escape import json_encode
+
+from .manager import BaseFileIdManager
+
+
+class BaseHandler(APIHandler):
+    auth_resource = "contents"
+
+    @property
+    def file_id_manager(self) -> BaseFileIdManager:
+        return self.settings.get("file_id_manager")
+
+
+class FileIDHandler(BaseHandler):
+    """A handler that fetches a file ID from the file path."""
+
+    @web.authenticated
+    @authorized
+    def get(self):
+        try:
+            path = self.get_argument("path")
+            id = self.file_id_manager.get_id(path)
+            # If the path cannot be found, it returns None. Raise a helpful
+            # error to the client.
+            if id is None:
+                raise web.HTTPError(
+                    404,
+                    log_message=f"The ID for file, {path}, could not be 
found.",
+                    reason=f"The ID for file, {path}, could not be found.",
+                )
+            self.write(json_encode({"id": id, "path": path}))
+        except web.MissingArgumentError:
+            raise web.HTTPError(
+                400, log_message="'path' parameter was not provided in the 
request."
+            )
+
+
+class FilePathHandler(BaseHandler):
+    """A handler that fetches a file path from the file ID."""
+
+    @web.authenticated
+    @authorized
+    def get(self):
+        try:
+            id = self.get_argument("id")
+            path = self.file_id_manager.get_path(id)
+            # If the ID cannot be found, it returns None. Raise a helpful
+            # error to the client.
+            if path is None:
+                error_msg = f"The path for file, {id}, could not be found."
+                raise web.HTTPError(
+                    404,
+                    log_message=error_msg,
+                    reason=error_msg,
+                )
+            self.write(json_encode({"id": id, "path": path}))
+        except web.MissingArgumentError:
+            raise web.HTTPError(400, log_message="'id' parameter was not 
provided in the request.")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jupyter_server_fileid-0.9.0/jupyter_server_fileid/manager.py 
new/jupyter_server_fileid-0.9.1/jupyter_server_fileid/manager.py
--- old/jupyter_server_fileid-0.9.0/jupyter_server_fileid/manager.py    
2020-02-02 01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/jupyter_server_fileid/manager.py    
2020-02-02 01:00:00.000000000 +0100
@@ -61,19 +61,20 @@
         help=(
             "The path of the DB file used by File ID manager implementations. "
             "Defaults to `jupyter_data_dir()/file_id_manager.db`."
+            "You can set it to ':memory:' to disable sqlite writing to the 
filesystem."
         ),
         config=True,
     )
 
     @validate("db_path")
     def _validate_db_path(self, proposal):
-        if proposal["value"] is None:
-            raise TraitError(f"BaseFileIdManager : {proposal['trait'].name} 
must not be None")
-        if not os.path.isabs(proposal["value"]):
-            raise TraitError(
-                f"BaseFileIdManager : {proposal['trait'].name} must be an 
absolute path"
-            )
-        return proposal["value"]
+        db_path = proposal["value"]
+        if db_path == ":memory:" or os.path.isabs(db_path):
+            return db_path
+
+        raise TraitError(
+            f"BaseFileIdManager : {proposal['trait'].name} must be an absolute 
path or \":memory:\""
+        )
 
     JOURNAL_MODES = ["DELETE", "TRUNCATE", "PERSIST", "MEMORY", "WAL", "OFF"]
     db_journal_mode = Unicode(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jupyter_server_fileid-0.9.0/pyproject.toml 
new/jupyter_server_fileid-0.9.1/pyproject.toml
--- old/jupyter_server_fileid-0.9.0/pyproject.toml      2020-02-02 
01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/pyproject.toml      2020-02-02 
01:00:00.000000000 +0100
@@ -7,6 +7,7 @@
 authors = [{name = "David L. Qiu", email = "[email protected]"}]
 dynamic = ["version"]
 readme = "README.md"
+description = "Jupyter Server extension providing an implementation of the 
File ID service."
 requires-python = ">=3.7"
 keywords = ["Jupyter", "Extension"]
 classifiers = [
@@ -28,6 +29,7 @@
 test = [
   "pytest",
   "pytest-cov",
+  "pytest-jupyter",
   "jupyter_server[test]>=1.15, <3"
 ]
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jupyter_server_fileid-0.9.0/tests/test_handler.py 
new/jupyter_server_fileid-0.9.1/tests/test_handler.py
--- old/jupyter_server_fileid-0.9.0/tests/test_handler.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/tests/test_handler.py       2020-02-02 
01:00:00.000000000 +0100
@@ -0,0 +1,91 @@
+from unittest.mock import MagicMock
+
+import pytest
+from tornado.escape import json_decode
+from tornado.httpclient import HTTPClientError
+
+from jupyter_server_fileid.manager import BaseFileIdManager
+
+
+class MockFileIdManager(BaseFileIdManager):
+    _normalize_path = MagicMock()
+    _from_normalized_path = MagicMock()
+    index = MagicMock()
+    move = MagicMock()
+    copy = MagicMock()
+    delete = MagicMock()
+    save = MagicMock()
+    get_handlers_by_action = MagicMock()
+    get_path = MagicMock(return_value="mock_path")
+    get_id = MagicMock(return_value="mock_id")
+
+
[email protected]
+def jp_server_config():
+    yield {
+        "ServerApp": {"jpserver_extensions": {"jupyter_server_fileid": True}},
+        "FileIdExtension": {"file_id_manager_class": MockFileIdManager},
+    }
+
+
[email protected]
+def file_id_extension(jp_serverapp):
+    ext_pkg = 
jp_serverapp.extension_manager.extensions["jupyter_server_fileid"]
+    ext_point = ext_pkg.extension_points["jupyter_server_fileid"]
+    return ext_point.app
+
+
+async def test_file_id_handler(jp_fetch, file_id_extension):
+    response = await jp_fetch("api/fileid/id", params={"path": "test"})
+    file_id_extension.file_id_manager.get_id.assert_called_once()
+    body = json_decode(response.body)
+    assert "id" in body
+    assert body["id"] == "mock_id"
+
+
+async def test_file_path_handler(jp_fetch, file_id_extension):
+    response = await jp_fetch("api/fileid/path", params={"id": "test"})
+    file_id_extension.file_id_manager.get_path.assert_called_once()
+    body = json_decode(response.body)
+    assert "path" in body
+    assert body["path"] == "mock_path"
+
+
+async def test_missing_query_param_in_id_handler(jp_fetch):
+    with pytest.raises(HTTPClientError) as err:
+        response = await jp_fetch("api/fileid/id")
+
+    assert err.value.code == 400
+
+
+async def test_missing_query_param_in_path_handler(jp_fetch):
+    with pytest.raises(HTTPClientError) as err:
+        response = await jp_fetch("api/fileid/path")
+
+    assert err.value.code == 400
+
+
+async def test_resource_not_found_in_id_handler(jp_fetch, monkeypatch):
+    def mock_get_id_with_no_entry(self, path):
+        return None
+
+    monkeypatch.setattr(MockFileIdManager, "get_id", mock_get_id_with_no_entry)
+
+    with pytest.raises(HTTPClientError) as err:
+        await jp_fetch("api/fileid/id", params={"path": "test"})
+
+    assert err.value.code == 404
+    assert err.value.message.startswith("The ID for file")
+
+
+async def test_resource_not_found_in_path_handler(jp_fetch, monkeypatch):
+    def mock_get_path_with_no_entry(self, id):
+        return None
+
+    monkeypatch.setattr(MockFileIdManager, "get_path", 
mock_get_path_with_no_entry)
+
+    with pytest.raises(HTTPClientError) as err:
+        await jp_fetch("api/fileid/path", params={"id": "test"})
+
+    assert err.value.code == 404
+    assert err.value.message.startswith("The path for file")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jupyter_server_fileid-0.9.0/tests/test_manager.py 
new/jupyter_server_fileid-0.9.1/tests/test_manager.py
--- old/jupyter_server_fileid-0.9.0/tests/test_manager.py       2020-02-02 
01:00:00.000000000 +0100
+++ new/jupyter_server_fileid-0.9.1/tests/test_manager.py       2020-02-02 
01:00:00.000000000 +0100
@@ -148,6 +148,10 @@
         )
 
 
+def test_memory_db_path(jp_root_dir, any_fid_manager_class):
+    any_fid_manager_class(root_dir=str(jp_root_dir), db_path=":memory:")
+
+
 def test_different_roots(
     any_fid_manager_class, fid_db_path, jp_root_dir, test_path, test_path_child
 ):

Reply via email to