Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-elastic-transport for
openSUSE:Factory checked in at 2023-12-04 22:59:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-elastic-transport (Old)
and /work/SRC/openSUSE:Factory/.python-elastic-transport.new.25432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-elastic-transport"
Mon Dec 4 22:59:22 2023 rev:6 rq:1130493 version:8.10.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-elastic-transport/python-elastic-transport.changes
2023-05-10 16:16:41.650325081 +0200
+++
/work/SRC/openSUSE:Factory/.python-elastic-transport.new.25432/python-elastic-transport.changes
2023-12-04 22:59:24.779048187 +0100
@@ -1,0 +2,10 @@
+Sat Dec 2 17:07:21 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 8.10.0:
+ * Support urllib3 2.x in addition to urllib3 1.26.x (#121)
+ * Add 409 to `NOT_DEAD_NODE_HTTP_STATUSES` (#120)
+ * Fixed an issue where a large number of consecutive failures
+ to connect to a node would raise an `OverflowError`.
+ * Fixed an issue to ensure that `ApiResponse` can be pickled.
+
+-------------------------------------------------------------------
Old:
----
elastic-transport-python-8.4.0.tar.gz
New:
----
elastic-transport-python-8.10.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-elastic-transport.spec ++++++
--- /var/tmp/diff_new_pack.jWlB6J/_old 2023-12-04 22:59:26.187100002 +0100
+++ /var/tmp/diff_new_pack.jWlB6J/_new 2023-12-04 22:59:26.199100443 +0100
@@ -16,10 +16,9 @@
#
-%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-elastic-transport
-Version: 8.4.0
+Version: 8.10.0
Release: 0
Summary: Transport classes and utilities shared among Python Elastic
client libraries
License: Apache-2.0
@@ -29,8 +28,7 @@
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-certifi
-# Removed upper limit to work with urllib3 >= 2.0.0 --
gh#elastic/elastic-transport-python#102
-Requires: (python-urllib3 >= 1.26.2)
+Requires: python-urllib3
BuildArch: noarch
%if 0%{python_version_nodots} < 37
Requires: python-dataclasses
@@ -45,7 +43,7 @@
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module trustme}
-BuildRequires: %{python_module urllib3 >= 1.26.2}
+BuildRequires: %{python_module urllib3}
# /SECTION
%python_subpackages
++++++ elastic-transport-python-8.4.0.tar.gz ->
elastic-transport-python-8.10.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/.github/workflows/backport.yml
new/elastic-transport-python-8.10.0/.github/workflows/backport.yml
--- old/elastic-transport-python-8.4.0/.github/workflows/backport.yml
2022-08-25 16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/.github/workflows/backport.yml
2023-10-30 06:12:20.000000000 +0100
@@ -1,16 +1,26 @@
name: Backport
on:
- pull_request:
+ pull_request_target:
types:
- closed
- labeled
jobs:
backport:
- runs-on: ubuntu-latest
name: Backport
+ runs-on: ubuntu-latest
+ # Only react to merged PRs for security reasons.
+ # See
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
+ if: >
+ github.event.pull_request.merged
+ && (
+ github.event.action == 'closed'
+ || (
+ github.event.action == 'labeled'
+ && contains(github.event.label.name, 'backport')
+ )
+ )
steps:
- - name: Backport
- uses: tibdex/backport@v1
+ - uses: tibdex/backport@9565281eda0731b1d20c4025c43339fb0a23812e # v2.0.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/.github/workflows/ci.yml
new/elastic-transport-python-8.10.0/.github/workflows/ci.yml
--- old/elastic-transport-python-8.4.0/.github/workflows/ci.yml 2022-08-25
16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/.github/workflows/ci.yml
2023-10-30 06:12:20.000000000 +0100
@@ -10,15 +10,13 @@
- name: Checkout repository
uses: actions/checkout@v1
- name: Set up Python 3.x
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
- run: |
- python3 -m pip install setuptools wheel twine
+ run: python3 -m pip install setuptools wheel twine
- name: Build dists
- run: |
- python3 utils/build-dists.py
+ run: python3 utils/build-dists.py
lint:
runs-on: ubuntu-latest
@@ -26,23 +24,27 @@
- name: Checkout Repository
uses: actions/checkout@v1
- name: Set up Python 3.x
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
- run: |
- python3 -m pip install nox
+ run: python3 -m pip install nox
- name: Lint the code
run: nox -s lint
+ env:
+ # Workaround for development versions
+ # https://github.com/aio-libs/aiohttp/issues/7675
+ AIOHTTP_NO_EXTENSIONS: 1
test:
strategy:
fail-fast: false
matrix:
- python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11-dev"]
+ python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
+ os: ["ubuntu-latest"]
experimental: [false]
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
name: test-${{ matrix.python-version }}
continue-on-error: ${{ matrix.experimental }}
steps:
@@ -54,11 +56,10 @@
with:
python-version: ${{ matrix.python-version }}
- - name: Set up Python 3.7 to run nox
- if: matrix.python-version != '3.7'
+ - name: Set up Python 3.x to run nox
uses: actions/setup-python@v2
with:
- python-version: 3.7
+ python-version: 3.x
- name: Install Dependencies
run: python -m pip install --upgrade nox
@@ -67,10 +68,7 @@
run: "nox -rs test-${PYTHON_VERSION%-dev}"
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- # TEMPORARY for 3.11
- # https://github.com/aio-libs/aiohttp/issues/6600
+ # Required for development versions of Python
AIOHTTP_NO_EXTENSIONS: 1
- # https://github.com/aio-libs/frozenlist/issues/285
FROZENLIST_NO_EXTENSIONS: 1
- # https://github.com/aio-libs/yarl/issues/680
YARL_NO_EXTENSIONS: 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elastic-transport-python-8.4.0/.readthedocs.yml
new/elastic-transport-python-8.10.0/.readthedocs.yml
--- old/elastic-transport-python-8.4.0/.readthedocs.yml 2022-08-25
16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/.readthedocs.yml 2023-10-30
06:12:20.000000000 +0100
@@ -1,12 +1,20 @@
version: 2
-sphinx:
- configuration: docs/sphinx/conf.py
+
+build:
+ os: ubuntu-22.04
+ tools:
+ # To work around https://github.com/aio-libs/aiohttp/issues/7675, we need
+ # to set AIOHTTP_NO_EXTENSIONS to 1 but it has to be done in
+ #
https://readthedocs.org/dashboard/elastic-transport-python/environmentvariables/
+ # because of https://github.com/readthedocs/readthedocs.org/issues/6311
+ python: "3"
python:
- version: "3.8"
install:
- method: pip
path: .
extra_requirements:
- develop
- - requirements: docs/sphinx/requirements.txt
+
+sphinx:
+ fail_on_warning: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elastic-transport-python-8.4.0/CHANGELOG.md
new/elastic-transport-python-8.10.0/CHANGELOG.md
--- old/elastic-transport-python-8.4.0/CHANGELOG.md 2022-08-25
16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/CHANGELOG.md 2023-10-30
06:12:20.000000000 +0100
@@ -1,5 +1,21 @@
# Changelog
+## 8.10.0
+
+- Support urllib3 2.x in addition to urllib3 1.26.x
([#121](https://github.com/elastic/elastic-transport-python/pull/121))
+- Add 409 to `NOT_DEAD_NODE_HTTP_STATUSES`
([#120](https://github.com/elastic/elastic-transport-python/pull/120))
+
+## 8.4.1
+
+- Fixed an issue where a large number of consecutive failures to connect to a
node would raise an `OverflowError`.
+- Fixed an issue to ensure that `ApiResponse` can be pickled.
+
+## 8.4.0
+
+### Added
+
+- Added method for clients to use default ports for URL scheme.
+
## 8.1.2
### Fixed
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elastic-transport-python-8.4.0/README.md
new/elastic-transport-python-8.10.0/README.md
--- old/elastic-transport-python-8.4.0/README.md 2022-08-25
16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/README.md 2023-10-30
06:12:20.000000000 +0100
@@ -2,7 +2,7 @@
[](https://pypi.org/elastic-transport)
[](https://pypi.org/elastic-transport)
-[](https://pepy.tech/project/elastic-transport)
+[](https://pepy.tech/project/elastic-transport)
[](https://github.com/elastic/elastic-transport-python/actions)
Transport classes and utilities shared among Python Elastic client libraries
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/docs/sphinx/requirements.txt
new/elastic-transport-python-8.10.0/docs/sphinx/requirements.txt
--- old/elastic-transport-python-8.4.0/docs/sphinx/requirements.txt
2022-08-25 16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/docs/sphinx/requirements.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-sphinx
-furo
-sphinx-autodoc-typehints
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/_async_transport.py
new/elastic-transport-python-8.10.0/elastic_transport/_async_transport.py
--- old/elastic-transport-python-8.4.0/elastic_transport/_async_transport.py
2022-08-25 16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/elastic_transport/_async_transport.py
2023-10-30 06:12:20.000000000 +0100
@@ -244,7 +244,6 @@
errors: List[Exception] = []
for attempt in range(max_retries + 1):
-
# If we sniff before requests are made we want to do so before
# 'node_pool.get()' is called so our sniffed nodes show up in the
pool.
if self._sniff_before_requests:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/_node/_http_requests.py
new/elastic-transport-python-8.10.0/elastic_transport/_node/_http_requests.py
---
old/elastic-transport-python-8.4.0/elastic_transport/_node/_http_requests.py
2022-08-25 16:46:42.000000000 +0200
+++
new/elastic-transport-python-8.10.0/elastic_transport/_node/_http_requests.py
2023-10-30 06:12:20.000000000 +0100
@@ -61,7 +61,6 @@
block: bool = False,
**pool_kwargs: Any,
) -> None:
-
if self._node_config.scheme == "https":
ssl_context = ssl_context_from_node_config(self._node_config)
pool_kwargs.setdefault("ssl_context", ssl_context)
@@ -71,7 +70,6 @@
# about the fingerprint of the certificates, not whether they
form
# a verified chain to a trust anchor.
if self._node_config.ssl_assert_fingerprint:
-
# Manually disable these in the right order on the
SSLContext
# so urllib3 won't think we want conflicting things.
ssl_context.check_hostname = False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/_node/_http_urllib3.py
new/elastic-transport-python-8.10.0/elastic_transport/_node/_http_urllib3.py
--- old/elastic-transport-python-8.4.0/elastic_transport/_node/_http_urllib3.py
2022-08-25 16:46:42.000000000 +0200
+++
new/elastic-transport-python-8.10.0/elastic_transport/_node/_http_urllib3.py
2023-10-30 06:12:20.000000000 +0100
@@ -21,6 +21,11 @@
import warnings
from typing import Any, Dict, Optional, Union
+try:
+ from importlib import metadata
+except ImportError:
+ import importlib_metadata as metadata # type: ignore[import,no-redef]
+
import urllib3
from urllib3.exceptions import ConnectTimeoutError, NewConnectionError,
ReadTimeoutError
from urllib3.util.retry import Retry
@@ -47,7 +52,7 @@
class Urllib3HttpNode(BaseNode):
"""Default synchronous node class using the ``urllib3`` library via HTTP"""
- _CLIENT_META_HTTP_CLIENT = ("ur", client_meta_version(urllib3.__version__))
+ _CLIENT_META_HTTP_CLIENT = ("ur",
client_meta_version(metadata.version("urllib3")))
def __init__(self, config: NodeConfig):
super().__init__(config)
@@ -70,7 +75,6 @@
# about the fingerprint of the certificates, not whether they form
# a verified chain to a trust anchor.
elif config.ssl_assert_fingerprint:
-
# Manually disable these in the right order on the SSLContext
# so urllib3 won't think we want conflicting things.
ssl_context.check_hostname = False
@@ -137,7 +141,6 @@
headers: Optional[HttpHeaders] = None,
request_timeout: Union[DefaultType, Optional[float]] = DEFAULT,
) -> NodeApiResponse:
-
if self.path_prefix:
target = f"{self.path_prefix}{target}"
@@ -161,13 +164,13 @@
else:
body_to_send = None
- response = self.pool.urlopen( # type: ignore[no-untyped-call]
+ response = self.pool.urlopen(
method,
target,
body=body_to_send,
retries=Retry(False),
headers=request_headers,
- **kw,
+ **kw, # type: ignore[arg-type]
)
response_headers = HttpHeaders(response.headers)
data = response.data
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/_node/_urllib3_chain_certs.py
new/elastic-transport-python-8.10.0/elastic_transport/_node/_urllib3_chain_certs.py
---
old/elastic-transport-python-8.4.0/elastic_transport/_node/_urllib3_chain_certs.py
2022-08-25 16:46:42.000000000 +0200
+++
new/elastic-transport-python-8.10.0/elastic_transport/_node/_urllib3_chain_certs.py
2023-10-30 06:12:20.000000000 +0100
@@ -36,7 +36,21 @@
__all__ = ["HTTPSConnectionPool"]
+class HTTPSConnection(urllib3.connection.HTTPSConnection):
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
+ self._elastic_assert_fingerprint: Optional[str] = None
+ super().__init__(*args, **kwargs)
+
+ def connect(self) -> None:
+ super().connect()
+ # Hack to prevent a warning within HTTPSConnectionPool._validate_conn()
+ if self._elastic_assert_fingerprint:
+ self.is_verified = True
+
+
class HTTPSConnectionPool(urllib3.HTTPSConnectionPool):
+ ConnectionCls = HTTPSConnection
+
"""HTTPSConnectionPool implementation which supports ``assert_fingerprint``
on certificates within the chain instead of only the leaf cert using
private
APIs in CPython 3.10+
@@ -60,18 +74,26 @@
f", should be one of '{valid_lengths}'"
)
- if assert_fingerprint:
- # Falsey but not None. This is a hack to skip fingerprinting by
urllib3
- # but still set 'is_verified=True' within
HTTPSConnectionPool._validate_conn()
- kwargs["assert_fingerprint"] = ""
+ if self._elastic_assert_fingerprint:
+ # Skip fingerprinting by urllib3 as we'll do it ourselves
+ kwargs["assert_fingerprint"] = None
super().__init__(*args, **kwargs)
- def _validate_conn(self, conn: urllib3.connection.HTTPSConnection) -> None:
+ def _new_conn(self) -> HTTPSConnection:
+ """
+ Return a fresh :class:`urllib3.connection.HTTPSConnection`.
+ """
+ conn: HTTPSConnection = super()._new_conn() # type: ignore[assignment]
+ # Tell our custom connection if we'll assert fingerprint ourselves
+ conn._elastic_assert_fingerprint = self._elastic_assert_fingerprint
+ return conn
+
+ def _validate_conn(self, conn: HTTPSConnection) -> None: # type:
ignore[override]
"""
Called right before a request is made, after the socket is created.
"""
- super(HTTPSConnectionPool, self)._validate_conn(conn) # type:
ignore[misc]
+ super(HTTPSConnectionPool, self)._validate_conn(conn)
if self._elastic_assert_fingerprint:
hash_func =
_HASHES_BY_LENGTH[len(self._elastic_assert_fingerprint)]
@@ -89,7 +111,7 @@
# See: https://github.com/python/cpython/pull/25467
fingerprints = [
hash_func(cert.public_bytes(_ENCODING_DER)).digest()
- for cert in conn.sock._sslobj.get_verified_chain()
+ for cert in conn.sock._sslobj.get_verified_chain() #
type: ignore[union-attr]
]
except RERAISE_EXCEPTIONS: # pragma: nocover
raise
@@ -100,7 +122,7 @@
# Only add the peercert in front of the chain if it's not there
for some reason.
# This is to make sure old behavior of 'ssl_assert_fingerprint'
still works.
- peercert_fingerprint =
hash_func(conn.sock.getpeercert(True)).digest()
+ peercert_fingerprint =
hash_func(conn.sock.getpeercert(True)).digest() # type: ignore[union-attr]
if peercert_fingerprint not in fingerprints: # pragma: nocover
fingerprints.insert(0, peercert_fingerprint)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/_node_pool.py
new/elastic-transport-python-8.10.0/elastic_transport/_node_pool.py
--- old/elastic-transport-python-8.4.0/elastic_transport/_node_pool.py
2022-08-25 16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/elastic_transport/_node_pool.py
2023-10-30 06:12:20.000000000 +0100
@@ -238,10 +238,13 @@
pass
consecutive_failures = self._dead_consecutive_failures[node.config] + 1
self._dead_consecutive_failures[node.config] = consecutive_failures
- timeout = min(
- self._dead_node_backoff_factor * (2 ** (consecutive_failures - 1)),
- self._max_dead_node_backoff,
- )
+ try:
+ timeout = min(
+ self._dead_node_backoff_factor * (2 ** (consecutive_failures -
1)),
+ self._max_dead_node_backoff,
+ )
+ except OverflowError:
+ timeout = self._max_dead_node_backoff
self._dead_nodes.put((now + timeout, node))
_logger.warning(
"Node %r has failed for %i times in a row, putting on %i second
timeout",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/_response.py
new/elastic-transport-python-8.10.0/elastic_transport/_response.py
--- old/elastic-transport-python-8.4.0/elastic_transport/_response.py
2022-08-25 16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/elastic_transport/_response.py
2023-10-30 06:12:20.000000000 +0100
@@ -23,6 +23,7 @@
Iterator,
List,
NoReturn,
+ Tuple,
TypeVar,
Union,
overload,
@@ -97,6 +98,12 @@
def __getattr__(self, attr: str) -> Any:
return getattr(self._body, attr)
+ def __getstate__(self) -> Tuple[_BodyType, ApiResponseMeta]:
+ return self._body, self._meta
+
+ def __setstate__(self, state: Tuple[_BodyType, ApiResponseMeta]) -> None:
+ self._body, self._meta = state
+
def __len__(self) -> int:
return len(self._body)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/_transport.py
new/elastic-transport-python-8.10.0/elastic_transport/_transport.py
--- old/elastic-transport-python-8.4.0/elastic_transport/_transport.py
2022-08-25 16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/elastic_transport/_transport.py
2023-10-30 06:12:20.000000000 +0100
@@ -68,7 +68,7 @@
# 'errors' for marking a node as dead. These errors typically
# mean everything is fine server-wise and instead the API call
# in question responded successfully.
-NOT_DEAD_NODE_HTTP_STATUSES = {None, 400, 401, 402, 403, 404}
+NOT_DEAD_NODE_HTTP_STATUSES = {None, 400, 401, 402, 403, 404, 409}
DEFAULT_CLIENT_META_SERVICE = ("et", client_meta_version(__version__))
_logger = logging.getLogger("elastic_transport.transport")
@@ -314,7 +314,6 @@
errors: List[Exception] = []
for attempt in range(max_retries + 1):
-
# If we sniff before requests are made we want to do so before
# 'node_pool.get()' is called so our sniffed nodes show up in the
pool.
if self._sniff_before_requests:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/_version.py
new/elastic-transport-python-8.10.0/elastic_transport/_version.py
--- old/elastic-transport-python-8.4.0/elastic_transport/_version.py
2022-08-25 16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/elastic_transport/_version.py
2023-10-30 06:12:20.000000000 +0100
@@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.
-__version__ = "8.4.0"
+__version__ = "8.10.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/elastic_transport/client_utils.py
new/elastic-transport-python-8.10.0/elastic_transport/client_utils.py
--- old/elastic-transport-python-8.4.0/elastic_transport/client_utils.py
2022-08-25 16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/elastic_transport/client_utils.py
2023-10-30 06:12:20.000000000 +0100
@@ -136,17 +136,17 @@
def to_str(
value: Union[str, bytes], encoding: str = "utf-8", errors: str = "strict"
) -> str:
- if type(value) == bytes:
+ if isinstance(value, bytes):
return value.decode(encoding, errors)
- return value # type: ignore[return-value]
+ return value
def to_bytes(
value: Union[str, bytes], encoding: str = "utf-8", errors: str = "strict"
) -> bytes:
- if type(value) == str:
+ if isinstance(value, str):
return value.encode(encoding, errors)
- return value # type: ignore[return-value]
+ return value
# Python 3.7 added '~' to the safe list for urllib.parse.quote()
@@ -198,7 +198,7 @@
# Only fill in a default port for HTTP and HTTPS
# when we know the scheme is one of those two.
- parsed_port: Optional[int] = parsed_url.port # type: ignore[assignment]
+ parsed_port: Optional[int] = parsed_url.port
if (
parsed_url.port is None
and parsed_url.scheme is not None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elastic-transport-python-8.4.0/noxfile.py
new/elastic-transport-python-8.10.0/noxfile.py
--- old/elastic-transport-python-8.4.0/noxfile.py 2022-08-25
16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/noxfile.py 2023-10-30
06:12:20.000000000 +0100
@@ -29,7 +29,7 @@
@nox.session()
def format(session):
- session.install("black", "isort", "pyupgrade")
+ session.install("black~=23.0", "isort", "pyupgrade")
session.run("black", "--target-version=py36", *SOURCE_FILES)
session.run("isort", *SOURCE_FILES)
session.run("python", "utils/license-headers.py", "fix", *SOURCE_FILES)
@@ -40,7 +40,16 @@
@nox.session
def lint(session):
session.install(
- "flake8", "black", "isort", "mypy", "types-requests", "types-certifi"
+ "flake8",
+ "black~=23.0",
+ "isort",
+ "mypy==1.5.1",
+ "types-requests",
+ "types-certifi",
+ )
+ # https://github.com/python/typeshed/issues/10786
+ session.run(
+ "python", "-m", "pip", "uninstall", "--yes", "types-urllib3",
silent=True
)
session.install(".[develop]")
session.run("black", "--check", "--target-version=py36", *SOURCE_FILES)
@@ -50,7 +59,7 @@
session.run("mypy", "--strict", "--show-error-codes", "elastic_transport/")
[email protected](python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"])
[email protected](python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"])
def test(session):
session.install(".[develop]")
session.run(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elastic-transport-python-8.4.0/setup.py
new/elastic-transport-python-8.10.0/setup.py
--- old/elastic-transport-python-8.4.0/setup.py 2022-08-25 16:46:42.000000000
+0200
+++ new/elastic-transport-python-8.10.0/setup.py 2023-10-30
06:12:20.000000000 +0100
@@ -37,10 +37,8 @@
long_description=long_description,
long_description_content_type="text/markdown",
version=version,
- author="Elastic",
- author_email="[email protected]",
- maintainer="Seth Michael Larson",
- maintainer_email="[email protected]",
+ author="Elastic Client Library Maintainers",
+ author_email="[email protected]",
url="https://github.com/elastic/elastic-transport-python",
project_urls={
"Source Code": "https://github.com/elastic/elastic-transport-python",
@@ -50,9 +48,10 @@
package_data={"elastic_transport": ["py.typed"]},
packages=packages,
install_requires=[
- "urllib3>=1.26.2, <2",
+ "urllib3>=1.26.2, <3",
"certifi",
"dataclasses; python_version<'3.7'",
+ "importlib-metadata; python_version<'3.8'",
],
python_requires=">=3.6",
extras_require={
@@ -66,6 +65,10 @@
"mock",
"requests",
"aiohttp",
+ # Override Read the Docs default (sphinx<2)
+ "sphinx>2",
+ "furo",
+ "sphinx-autodoc-typehints",
],
},
classifiers=[
@@ -80,6 +83,8 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elastic-transport-python-8.4.0/tests/test_logging.py
new/elastic-transport-python-8.10.0/tests/test_logging.py
--- old/elastic-transport-python-8.4.0/tests/test_logging.py 2022-08-25
16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/tests/test_logging.py 2023-10-30
06:12:20.000000000 +0100
@@ -72,7 +72,7 @@
"< HTTP/1.1 200 OK",
"< Access-Control-Allow-Credentials: true",
"< Access-Control-Allow-Origin: *",
- "< Connection: keep-alive",
+ "< Connection: close",
"< Content-Type: application/json",
"< {",
' "args": {}, ',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/tests/test_node_pool.py
new/elastic-transport-python-8.10.0/tests/test_node_pool.py
--- old/elastic-transport-python-8.4.0/tests/test_node_pool.py 2022-08-25
16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/tests/test_node_pool.py 2023-10-30
06:12:20.000000000 +0100
@@ -193,6 +193,12 @@
assert pool._dead_nodes.queue == [(3.5, node)]
assert pool.get() is node
+ pool.mark_dead(node, _now=0)
+
+ pool._dead_consecutive_failures = {node.config: 13292}
+ assert pool._dead_nodes.queue == [(3.5, node)]
+
+ assert pool.get() is node
pool.mark_live(node)
assert pool._dead_consecutive_failures == {}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elastic-transport-python-8.4.0/tests/test_response.py
new/elastic-transport-python-8.10.0/tests/test_response.py
--- old/elastic-transport-python-8.4.0/tests/test_response.py 2022-08-25
16:46:42.000000000 +0200
+++ new/elastic-transport-python-8.10.0/tests/test_response.py 2023-10-30
06:12:20.000000000 +0100
@@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.
+import pickle
+
import pytest
from elastic_transport import (
@@ -139,3 +141,19 @@
resp = ObjectApiResponse(meta=meta, body={}, body_cls=int)
assert resp == {}
+
+
[email protected](
+ "response_cls, body",
+ [
+ (TextApiResponse, "Hello World"),
+ (BinaryApiResponse, b"Hello World"),
+ (ObjectApiResponse, {"Hello": "World"}),
+ (ListApiResponse, ["Hello", "World"]),
+ ],
+)
+def test_pickle(response_cls, body):
+ resp = response_cls(meta=meta, body=body)
+ pickled_resp = pickle.loads(pickle.dumps(resp))
+ assert pickled_resp == resp
+ assert pickled_resp.meta == resp.meta