From 72fc5431bbba291143934e1487a3f5cbce4bd9fb Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 21 Feb 2023 11:59:34 +0400 Subject: [PATCH 1/5] Fix CI --- .github/workflows/ci.yml | 9 +++++++-- elastic_transport/_async_transport.py | 1 - elastic_transport/_node/_http_requests.py | 2 -- elastic_transport/_node/_http_urllib3.py | 2 -- elastic_transport/_transport.py | 1 - elastic_transport/client_utils.py | 2 +- noxfile.py | 10 ++++++++-- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e63d2b1..12feda5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,10 +39,15 @@ jobs: 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-dev"] + os: ["ubuntu-latest"] experimental: [false] + include: + - python-version: "3.6" + experimental: false + os: ubuntu-20.04 - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} name: test-${{ matrix.python-version }} continue-on-error: ${{ matrix.experimental }} steps: diff --git a/elastic_transport/_async_transport.py b/elastic_transport/_async_transport.py index a335292..e78ef24 100644 --- a/elastic_transport/_async_transport.py +++ b/elastic_transport/_async_transport.py @@ -244,7 +244,6 @@ async def perform_request( # type: ignore[override,return] 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 --git a/elastic_transport/_node/_http_requests.py b/elastic_transport/_node/_http_requests.py index 1cae377..f1e1672 100644 --- a/elastic_transport/_node/_http_requests.py +++ b/elastic_transport/_node/_http_requests.py @@ -61,7 +61,6 @@ def init_poolmanager( 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 @@ def init_poolmanager( # 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 --git a/elastic_transport/_node/_http_urllib3.py b/elastic_transport/_node/_http_urllib3.py index 15dcd00..565d9d5 100644 --- a/elastic_transport/_node/_http_urllib3.py +++ b/elastic_transport/_node/_http_urllib3.py @@ -70,7 +70,6 @@ def __init__(self, config: NodeConfig): # 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 +136,6 @@ def perform_request( headers: Optional[HttpHeaders] = None, request_timeout: Union[DefaultType, Optional[float]] = DEFAULT, ) -> NodeApiResponse: - if self.path_prefix: target = f"{self.path_prefix}{target}" diff --git a/elastic_transport/_transport.py b/elastic_transport/_transport.py index c236dd5..94a85ff 100644 --- a/elastic_transport/_transport.py +++ b/elastic_transport/_transport.py @@ -314,7 +314,6 @@ def perform_request( # type: ignore[return] 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 --git a/elastic_transport/client_utils.py b/elastic_transport/client_utils.py index 2a9de77..fe0f882 100644 --- a/elastic_transport/client_utils.py +++ b/elastic_transport/client_utils.py @@ -198,7 +198,7 @@ def url_to_node_config( # 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 --git a/noxfile.py b/noxfile.py index 6c152e5..3aa5711 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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,13 @@ def format(session): @nox.session def lint(session): session.install( - "flake8", "black", "isort", "mypy", "types-requests", "types-certifi" + "flake8", + "black~=23.0", + "isort", + "mypy==1.0.1", + "types-urllib3", + "types-requests", + "types-certifi", ) session.install(".[develop]") session.run("black", "--check", "--target-version=py36", *SOURCE_FILES) From a04b506d0737310c03ef6ed4f4055a025e6c87c3 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 21 Feb 2023 12:02:03 +0400 Subject: [PATCH 2/5] Fix workflow syntax --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12feda5..f271d4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,10 +42,10 @@ jobs: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] os: ["ubuntu-latest"] experimental: [false] - include: - - python-version: "3.6" - experimental: false - os: ubuntu-20.04 + include: + - python-version: "3.6" + experimental: false + os: ubuntu-20.04 runs-on: ${{ matrix.os }} name: test-${{ matrix.python-version }} From b8b65f012508a3d9e2e00160f318707b66a469c2 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 21 Feb 2023 12:06:15 +0400 Subject: [PATCH 3/5] Add 3.12 and remove 3.11 workarounds --- .github/workflows/ci.yml | 7 ------- noxfile.py | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f271d4d..491183f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,10 +72,3 @@ jobs: 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 - 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 --git a/noxfile.py b/noxfile.py index 3aa5711..f54a3b1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -56,7 +56,7 @@ def lint(session): session.run("mypy", "--strict", "--show-error-codes", "elastic_transport/") -@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]) +@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]) def test(session): session.install(".[develop]") session.run( From dd45a5f92ee8a4db9d7a1c0518131625a22ee181 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 21 Feb 2023 12:08:43 +0400 Subject: [PATCH 4/5] Disable extensions again for 3.12-dev --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 491183f..7a027dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,11 +59,10 @@ jobs: 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 @@ -72,3 +71,7 @@ jobs: run: "nox -rs test-${PYTHON_VERSION%-dev}" env: PYTHON_VERSION: ${{ matrix.python-version }} + # Required for development versions of Python + AIOHTTP_NO_EXTENSIONS: 1 + FROZENLIST_NO_EXTENSIONS: 1 + YARL_NO_EXTENSIONS: 1 From 24bb8344c7a3b07c0f6a025e845fdbe790e3911a Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 21 Feb 2023 12:12:18 +0400 Subject: [PATCH 5/5] Add missing PyPI classifiers --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 567c0b7..1a95c2f 100644 --- a/setup.py +++ b/setup.py @@ -80,6 +80,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", ],