From 41f43dff9000c22b2bbb0ef69e8752f42f4b22b6 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 11 Aug 2023 11:30:40 +0400 Subject: [PATCH 1/5] Drop support for Python 3.6 --- .ci/test-matrix.yml | 1 - .github/workflows/ci.yml | 16 ++-------------- docs/guide/configuration.asciidoc | 9 +-------- docs/guide/getting-started.asciidoc | 2 +- docs/sphinx/async.rst | 19 +++++++------------ noxfile.py | 6 +----- setup.py | 3 +-- 7 files changed, 13 insertions(+), 43 deletions(-) diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index 29c587cb3..6ef665313 100644 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -5,7 +5,6 @@ TEST_SUITE: - platinum PYTHON_VERSION: - - "3.6" - "3.7" - "3.8" - "3.9" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bcdc103c..912f1d913 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,19 +38,10 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] experimental: [false] nox-session: [""] runs-on: ["ubuntu-latest"] - include: - - python-version: 3.6 - experimental: false - nox-session: test-3.6 - runs-on: "ubuntu-20.04" - - python-version: 3.11-dev - experimental: true - nox-session: test-3.11 - runs-on: "ubuntu-latest" runs-on: ${{ matrix.runs-on }} name: test-${{ matrix.python-version }} @@ -71,10 +62,7 @@ jobs: env: PYTHON_VERSION: ${{ matrix.python-version }} NOX_SESSION: ${{ matrix.nox-session }} - # 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 --git a/docs/guide/configuration.asciidoc b/docs/guide/configuration.asciidoc index f084754e8..cb467dc0d 100644 --- a/docs/guide/configuration.asciidoc +++ b/docs/guide/configuration.asciidoc @@ -53,19 +53,12 @@ es = Elasticsearch( [discrete] ==== TLS versions -Configuring the minimum TLS version to connect to is done via the `ssl_version` parameter. By default this is set to a minimum value of TLSv1.2. In Python 3.7+ you can use the new `ssl.TLSVersion` enumeration to specify versions. +Configuring the minimum TLS version to connect to is done via the `ssl_version` parameter. By default this is set to a minimum value of TLSv1.2. Use the `ssl.TLSVersion` enumeration to specify versions. [source,python] ------------------------------------ import ssl -# Python 3.6 -es = Elasticsearch( - ..., - ssl_version=ssl.PROTOCOL_TSLv1_2 -) - -# Python 3.7+ es = Elasticsearch( ..., ssl_version=ssl.TLSVersion.TLSv1_2 diff --git a/docs/guide/getting-started.asciidoc b/docs/guide/getting-started.asciidoc index 4fd275aa0..aef383f5d 100644 --- a/docs/guide/getting-started.asciidoc +++ b/docs/guide/getting-started.asciidoc @@ -8,7 +8,7 @@ operations with it. [discrete] === Requirements -* https://www.python.org/[Python] 3.6 or newer +* https://www.python.org/[Python] 3.7 or newer * https://pip.pypa.io/en/stable/[`pip`], installed by default alongside Python [discrete] diff --git a/docs/sphinx/async.rst b/docs/sphinx/async.rst index 3cc4427ac..d3215db23 100644 --- a/docs/sphinx/async.rst +++ b/docs/sphinx/async.rst @@ -3,22 +3,17 @@ Using Asyncio with Elasticsearch .. py:module:: elasticsearch -Starting in ``elasticsearch-py`` v7.8.0 for Python 3.6+ the ``elasticsearch`` package supports async/await with +The ``elasticsearch`` package supports async/await with `Asyncio `_ and `Aiohttp `_. You can either install ``aiohttp`` directly or use the ``[async]`` extra: .. code-block:: bash - $ python -m pip install elasticsearch>=7.8.0 aiohttp + $ python -m pip install elasticsearch aiohttp # - OR - - $ python -m pip install elasticsearch[async]>=7.8.0 - - .. note:: - Async functionality is a new feature of this library in v7.8.0+ so - `please open an issue `_ - if you find an issue or have a question about async support. + $ python -m pip install elasticsearch[async] Getting Started with Async -------------------------- @@ -69,10 +64,10 @@ Frequently Asked Questions NameError / ImportError when importing ``AsyncElasticsearch``? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If when trying to use ``AsyncElasticsearch`` and you're receiving a ``NameError`` or ``ImportError`` -you should ensure that you're running Python 3.6+ (check with ``$ python --version``) and -that you have ``aiohttp`` installed in your environment (check with ``$ python -m pip freeze | grep aiohttp``). -If either of the above conditions is not met then async support won't be available. +If when trying to use ``AsyncElasticsearch`` and you're receiving a ``NameError`` or +``ImportError`` you should ensure that you have ``aiohttp`` installed in your +environment (check with ``$ python -m pip freeze | grep aiohttp``). Otherwise, async +support won't be available. What about the ``elasticsearch-async`` package? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/noxfile.py b/noxfile.py index c59b06c7b..47f51a706 100644 --- a/noxfile.py +++ b/noxfile.py @@ -30,7 +30,7 @@ ) -@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]) +@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"]) def test(session): session.install(".") session.install("-r", "dev-requirements.txt") @@ -47,10 +47,6 @@ def test(session): "--cache-clear", "-vv", ] - # Python 3.6+ is required for async - if python_version < (3, 6): - pytest_argv.append("--ignore=test_elasticsearch/test_async/") - session.run(*pytest_argv) diff --git a/setup.py b/setup.py index a79c6b097..95c869d6a 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,6 @@ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", @@ -91,7 +90,7 @@ "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ], - python_requires=">=3.6, <4", + python_requires=">=3.7, <4", install_requires=install_requires, extras_require={ "requests": ["requests>=2.4.0, <3.0.0"], From b5dc90d9940a63d6b152e60fac2ae55fdc6f6574 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 11 Aug 2023 11:42:50 +0400 Subject: [PATCH 2/5] Bump Black target-version to 3.7 --- utils/run-black.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/run-black.py b/utils/run-black.py index 76c62a1a7..671bfcbaf 100644 --- a/utils/run-black.py +++ b/utils/run-black.py @@ -58,7 +58,7 @@ def run_on_directory(dir: str, check: bool) -> None: def run_on_file(file: str, check: bool) -> None: try: subprocess.check_call( - f"black --target-version=py36 {'--check ' if check else ''}{file}", + f"black --target-version=py37 {'--check ' if check else ''}{file}", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, From d4a6881b6dfa576c86f8205982db1be91c3a50b1 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 24 Aug 2023 16:36:26 +0400 Subject: [PATCH 3/5] Fix lint --- noxfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 47f51a706..f184e2ae4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -35,7 +35,6 @@ def test(session): session.install(".") session.install("-r", "dev-requirements.txt") - python_version = tuple(int(x) for x in session.python.split(".")) junit_xml = os.path.join(SOURCE_DIR, "junit", "elasticsearch-py-junit.xml") pytest_argv = [ "pytest", From 1874b52e78726453c9479f6ee600d10c1dd939c0 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 15 Jan 2024 15:49:04 +0100 Subject: [PATCH 4/5] Fix aiohttp missing FAQ --- docs/sphinx/async.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/sphinx/async.rst b/docs/sphinx/async.rst index 4326f7eb9..262d25bae 100644 --- a/docs/sphinx/async.rst +++ b/docs/sphinx/async.rst @@ -62,13 +62,13 @@ in the ``examples/fastapi-apm`` directory. Frequently Asked Questions -------------------------- -NameError / ImportError when importing ``AsyncElasticsearch``? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +ValueError when initializing ``AsyncElasticsearch``? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If when trying to use ``AsyncElasticsearch`` and you're receiving a ``NameError`` or -``ImportError`` you should ensure that you have ``aiohttp`` installed in your -environment (check with ``$ python -m pip freeze | grep aiohttp``). Otherwise, async -support won't be available. +If when trying to use ``AsyncElasticsearch`` you receive ``ValueError: You must +have 'aiohttp' installed to use AiohttpHttpNode`` you should ensure that you +have ``aiohttp`` installed in your environment (check with ``$ python -m pip +freeze | grep aiohttp``). Otherwise, async support won't be available. What about the ``elasticsearch-async`` package? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From cc9f10242cb91abec9ff2a5c9ad95a8ffffa71b3 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 15 Jan 2024 16:36:05 +0100 Subject: [PATCH 5/5] Bump Python version in quickstart --- docs/sphinx/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/quickstart.rst b/docs/sphinx/quickstart.rst index db01edffd..68a1c52ba 100644 --- a/docs/sphinx/quickstart.rst +++ b/docs/sphinx/quickstart.rst @@ -9,7 +9,7 @@ operations like indexing or searching documents. Requirements ------------ -- `Python `_ 3.6 or newer +- `Python `_ 3.7 or newer - `pip `_