Change deprecation warnings to explicitly mention v2.1.0 for removals
MODIFY
docs/reference/contrib/pyopenssl.rst
docs/reference/contrib/pyopenssl.rst
PyOpenSSL
=========
.. warning::
- DEPRECATED: This module is deprecated and will be removed in a future 2.x release.
+ DEPRECATED: This module is deprecated and will be removed in urllib3 v2.1.0.
Read more in this `issue <https://github.com/urllib3/urllib3/issues/2680>`_.
.. automodule:: urllib3.contrib.pyopenssl

MODIFY
docs/reference/contrib/securetransport.rst
docs/reference/contrib/securetransport.rst
macOS SecureTransport
=====================
.. warning::
- DEPRECATED: This module is deprecated and will be removed in a future 2.x release.
+ DEPRECATED: This module is deprecated and will be removed in urllib3 v2.1.0.
Read more in this `issue <https://github.com/urllib3/urllib3/issues/2681>`_.
`SecureTranport <https://developer.apple.com/documentation/security/secure_transport>`_

MODIFY
src/urllib3/__init__.py
src/urllib3/__init__.py
@@ -51,7 +51,7 @@ except ModuleNotFoundError:
else:
warnings.warn(
"'urllib3[secure]' extra is deprecated and will be removed "
- "in a future release of urllib3 2.x. Read more in this issue: "
+ "in urllib3 v2.1.0. Read more in this issue: "
"https://github.com/urllib3/urllib3/issues/2680",
category=DeprecationWarning,
stacklevel=2,

MODIFY
src/urllib3/connection.py
src/urllib3/connection.py
@@ -427,8 +427,8 @@ class HTTPConnection(_HTTPConnection):
body with chunked encoding and not as one block
"""
warnings.warn(
- "HTTPConnection.request_chunked() is deprecated and will be removed in a "
- "future version. Instead use HTTPConnection.request(..., chunked=True).",
+ "HTTPConnection.request_chunked() is deprecated and will be removed "
+ "in urllib3 v2.1.0. Instead use HTTPConnection.request(..., chunked=True).",
category=DeprecationWarning,
stacklevel=2,
)
@@ -585,9 +585,9 @@ class HTTPSConnection(HTTPConnection):
This method should only be called once, before the connection is used.
"""
warnings.warn(
- "HTTPSConnection.set_cert() is deprecated and will be removed in a "
- "future version. Instead provide the parameters to the HTTPSConnection "
- "constructor.",
+ "HTTPSConnection.set_cert() is deprecated and will be removed "
+ "in urllib3 v2.1.0. Instead provide the parameters to the "
+ "HTTPSConnection constructor.",
category=DeprecationWarning,
stacklevel=2,
)

MODIFY
src/urllib3/contrib/pyopenssl.py
src/urllib3/contrib/pyopenssl.py
@@ -63,7 +63,7 @@ from .. import util
warnings.warn(
"'urllib3.contrib.pyopenssl' module is deprecated and will be removed "
- "in a future release of urllib3 2.x. Read more in this issue: "
+ "in urllib3 v2.1.0. Read more in this issue: "
"https://github.com/urllib3/urllib3/issues/2680",
category=DeprecationWarning,
stacklevel=2,

MODIFY
src/urllib3/contrib/securetransport.py
src/urllib3/contrib/securetransport.py
@@ -94,7 +94,7 @@ from ._securetransport.low_level import (
warnings.warn(
"'urllib3.contrib.securetransport' module is deprecated and will be removed "
- "in a future release of urllib3 2.x. Read more in this issue: "
+ "in urllib3 v2.1.0. Read more in this issue: "
"https://github.com/urllib3/urllib3/issues/2681",
category=DeprecationWarning,
stacklevel=2,

MODIFY
src/urllib3/exceptions.py
src/urllib3/exceptions.py
@@ -161,7 +161,7 @@ class NewConnectionError(ConnectTimeoutError, HTTPError):
def pool(self) -> "HTTPConnection":
warnings.warn(
"The 'pool' property is deprecated and will be removed "
- "in a later urllib3 v2.x release. use 'conn' instead.",
+ "in urllib3 v2.1.0. Use 'conn' instead.",
DeprecationWarning,
stacklevel=2,
)

MODIFY
src/urllib3/fields.py
src/urllib3/fields.py
@@ -51,14 +51,14 @@ def format_header_param_rfc2231(name: str, value: _TYPE_FIELD_VALUE) -> str:
An RFC-2231-formatted unicode string.
.. deprecated:: 2.0.0
- Will be removed in urllib3 v3.0.0. This is not valid for
+ Will be removed in urllib3 v2.1.0. This is not valid for
``multipart/form-data`` header parameters.
"""
import warnings
warnings.warn(
"'format_header_param_rfc2231' is deprecated and will be "
- "removed in urllib3 v3.0.0. This is not valid for "
+ "removed in urllib3 v2.1.0. This is not valid for "
"multipart/form-data header parameters.",
DeprecationWarning,
stacklevel=2,
@@ -110,7 +110,7 @@ def format_multipart_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str:
.. versionchanged:: 2.0.0
Renamed from ``format_header_param_html5`` and
``format_header_param``. The old names will be removed in
- urllib3 v3.0.0.
+ urllib3 v2.1.0.
"""
if isinstance(value, bytes):
value = value.decode("utf-8")
@@ -124,14 +124,14 @@ def format_header_param_html5(name: str, value: _TYPE_FIELD_VALUE) -> str:
"""
.. deprecated:: 2.0.0
Renamed to :func:`format_multipart_header_param`. Will be
- removed in urllib3 v3.0.0.
+ removed in urllib3 v2.1.0.
"""
import warnings
warnings.warn(
"'format_header_param_html5' has been renamed to "
"'format_multipart_header_param'. The old name will be "
- "removed in urllib3 v3.0.0.",
+ "removed in urllib3 v2.1.0.",
DeprecationWarning,
stacklevel=2,
)
@@ -142,14 +142,14 @@ def format_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str:
"""
.. deprecated:: 2.0.0
Renamed to :func:`format_multipart_header_param`. Will be
- removed in urllib3 v3.0.0.
+ removed in urllib3 v2.1.0.
"""
import warnings
warnings.warn(
"'format_header_param' has been renamed to "
"'format_multipart_header_param'. The old name will be "
- "removed in urllib3 v3.0.0.",
+ "removed in urllib3 v2.1.0.",
DeprecationWarning,
stacklevel=2,
)
@@ -171,8 +171,7 @@ class RequestField:
.. versionchanged:: 2.0.0
The ``header_formatter`` parameter is deprecated and will
- be removed in urllib3 v3.0.0. Override :meth:`_render_part`
- instead.
+ be removed in urllib3 v2.1.0.
"""
def __init__(
@@ -195,8 +194,7 @@ class RequestField:
warnings.warn(
"The 'header_formatter' parameter is deprecated and "
- "will be removed in urllib3 v3.0.0. Override the "
- "'_render_part' method instead.",
+ "will be removed in urllib3 v2.1.0.",
DeprecationWarning,
stacklevel=2,
)

MODIFY
src/urllib3/util/ssl_.py
src/urllib3/util/ssl_.py
@@ -266,8 +266,7 @@ def create_urllib3_context(
# keep the maximum version to be it's default value: 'TLSVersion.MAXIMUM_SUPPORTED'
warnings.warn(
"'ssl_version' option is deprecated and will be "
- "removed in a future release of urllib3 2.x. Instead "
- "use 'ssl_minimum_version'",
+ "removed in urllib3 v2.1.0. Instead use 'ssl_minimum_version'",
category=DeprecationWarning,
stacklevel=2,
)

MODIFY
test/test_exceptions.py
test/test_exceptions.py
@@ -60,7 +60,7 @@ class TestNewConnectionError:
assert err.pool is err.conn
msg = (
"The 'pool' property is deprecated and will be removed "
- "in a later urllib3 v2.x release. use 'conn' instead."
+ "in urllib3 v2.1.0. Use 'conn' instead."
)
record = records[0]
assert isinstance(record.message, Warning)

MODIFY
test/with_dummyserver/test_connectionpool.py
test/with_dummyserver/test_connectionpool.py
@@ -1069,7 +1069,7 @@ class TestConnectionPool(HTTPDummyServerTestCase):
with pytest.warns(DeprecationWarning) as w:
conn.request_chunked("GET", "/headers") # type: ignore[attr-defined]
assert len(w) == 1 and str(w[0].message) == (
- "HTTPConnection.request_chunked() is deprecated and will be removed in a future version. "
+ "HTTPConnection.request_chunked() is deprecated and will be removed in urllib3 v2.1.0. "
"Instead use HTTPConnection.request(..., chunked=True)."
)

MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -767,7 +767,7 @@ class TestHTTPS(HTTPSDummyServerTestCase):
conn.set_cert()
assert conn.cert_reqs == ssl.CERT_REQUIRED
assert len(w) == 1 and str(w[0].message) == (
- "HTTPSConnection.set_cert() is deprecated and will be removed in a future version. "
+ "HTTPSConnection.set_cert() is deprecated and will be removed in urllib3 v2.1.0. "
"Instead provide the parameters to the HTTPSConnection constructor."
)
@@ -787,7 +787,7 @@ class TestHTTPS(HTTPSDummyServerTestCase):
conn.ssl_context is not None and conn.ssl_context.verify_mode == verify_mode
)
assert len(w) == 1 and str(w[0].message) == (
- "HTTPSConnection.set_cert() is deprecated and will be removed in a future version. "
+ "HTTPSConnection.set_cert() is deprecated and will be removed in urllib3 v2.1.0. "
"Instead provide the parameters to the HTTPSConnection constructor."
)
@@ -830,7 +830,7 @@ class TestHTTPS(HTTPSDummyServerTestCase):
str(x.message)
== (
"'ssl_version' option is deprecated and will be removed in "
- "a future release of urllib3 2.x. Instead use 'ssl_minimum_version'"
+ "urllib3 v2.1.0. Instead use 'ssl_minimum_version'"
)
for x in w
)

Change deprecation warnings to explicitly mention v2.1.0 for removals