From 68f52e025761afb58601898190ea73bad6ff5f78 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Mon, 23 Jun 2025 16:30:57 -0700 Subject: [PATCH 1/2] feat: Deprecate custom NotFoundError in favor of built-in FileNotFoundError --- obstore/pyproject.toml | 2 +- obstore/python/obstore/exceptions/__init__.pyi | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/obstore/pyproject.toml b/obstore/pyproject.toml index 7df79fdf..5977adc6 100644 --- a/obstore/pyproject.toml +++ b/obstore/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "maturin" [project] name = "obstore" requires-python = ">=3.9" -dependencies = ["typing-extensions; python_version < '3.12'"] +dependencies = ["typing-extensions; python_version < '3.13'"] classifiers = [ "Development Status :: 4 - Beta", "Framework :: AsyncIO", diff --git a/obstore/python/obstore/exceptions/__init__.pyi b/obstore/python/obstore/exceptions/__init__.pyi index 391e8f31..13f30f67 100644 --- a/obstore/python/obstore/exceptions/__init__.pyi +++ b/obstore/python/obstore/exceptions/__init__.pyi @@ -2,12 +2,20 @@ # pylance isn't able to find that. So this is an exceptions module with only # `__init__.pyi` to work around pylance's bug. +import sys + +if sys.version_info >= (3, 13): + from warnings import deprecated +else: + from typing_extensions import deprecated + class BaseError(Exception): """The base exception class.""" class GenericError(BaseError): """A fallback error type when no variant matches.""" +@deprecated("builtins.FileNotFoundError is emitted instead.") class NotFoundError(BaseError): """Error when the object is not found at given location.""" From 60146b74db3d8b021222dda7599869108e136266 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Mon, 23 Jun 2025 16:36:40 -0700 Subject: [PATCH 2/2] Note that BaseError is not universally used. --- obstore/python/obstore/exceptions/__init__.pyi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/obstore/python/obstore/exceptions/__init__.pyi b/obstore/python/obstore/exceptions/__init__.pyi index 13f30f67..f19f78ec 100644 --- a/obstore/python/obstore/exceptions/__init__.pyi +++ b/obstore/python/obstore/exceptions/__init__.pyi @@ -10,7 +10,11 @@ else: from typing_extensions import deprecated class BaseError(Exception): - """The base exception class.""" + """The base exception class. + + !!! note + Some operations also raise a built-in `ValueError` or `FileNotFoundError`. + """ class GenericError(BaseError): """A fallback error type when no variant matches."""