From 79efe1216b00bbc7461c3a046ece23a7e8c004e3 Mon Sep 17 00:00:00 2001 From: Delta Regeer Date: Sun, 2 Aug 2026 02:10:53 -0600 Subject: [PATCH] Drop 0.9-era date helper re-exports from the top-level webob package parse_date, parse_date_delta, serialize_date, serialize_date_delta and timedelta_to_seconds moved to webob.datetime_utils in 0.9.7 (0196b09) and have been re-exported from webob for backwards compatibility ever since. They were never documented and never listed in webob.__all__. Import them from webob.datetime_utils instead. The UTC tzinfo object and the year/month/week/day/hour/minute/second timedelta constants are unaffected and remain importable from webob. Also add BaseRequest to webob.__all__. It was already importable from webob, but its absence from __all__ means type checkers reject "from webob import BaseRequest" once WebOb ships a py.typed marker, as proposed in #477. See #457 --- CHANGES.txt | 19 +++++++++++++++++++ src/webob/__init__.py | 8 ++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 852ef293..81240943 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -74,6 +74,25 @@ Backwards Incompatibilities - Drop support for Python 2.7, 3.4, 3.5, 3.6, 3.7, 3.8 and 3.9 +- The date helpers ``parse_date``, ``parse_date_delta``, ``serialize_date``, + ``serialize_date_delta`` and ``timedelta_to_seconds`` are no longer + re-exported from the top-level ``webob`` package. They moved to + ``webob.datetime_utils`` in WebOb 0.9.7 and have been re-exported from + ``webob`` for backwards compatibility ever since, but were never documented + or listed in ``webob.__all__``. Import them from ``webob.datetime_utils`` + instead. + + The ``UTC`` tzinfo object and the ``year``, ``month``, ``week``, ``day``, + ``hour``, ``minute`` and ``second`` timedelta constants are unaffected and + remain importable from ``webob``. + +- ``BaseRequest`` is now listed in ``webob.__all__``. It was already + importable from ``webob``, but its absence from ``__all__`` meant type + checkers would reject ``from webob import BaseRequest`` once WebOb ships a + ``py.typed`` marker. + + See https://github.com/Pylons/webob/issues/457 + Experimental Features ~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/webob/__init__.py b/src/webob/__init__.py index 627b1b52..ee82918e 100644 --- a/src/webob/__init__.py +++ b/src/webob/__init__.py @@ -1,15 +1,10 @@ -from webob.datetime_utils import ( # noqa: F401 +from webob.datetime_utils import ( UTC, day, hour, minute, month, - parse_date, - parse_date_delta, second, - serialize_date, - serialize_date_delta, - timedelta_to_seconds, week, year, ) @@ -18,6 +13,7 @@ from webob.util import html_escape __all__ = [ + "BaseRequest", "Request", "Response", "UTC",