Skip to content

Commit e082e62

Browse files
committed
Dropped support for python 3.6, 3.7 and added support for python 3.12
Signed-off-by: saimedhi <saimedhi@amazon.com>
1 parent 8a00963 commit e082e62

25 files changed

+260
-425
lines changed

.ci/test-matrix.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ TEST_SUITE:
22
- oss
33

44
PYTHON_VERSION:
5-
- "3.6"
6-
- "3.7"
75
- "3.8"
86
- "3.9"
97
- "3.10"
8+
- "3.11"
9+
- "3.12"
1010

1111
PYTHON_CONNECTION_CLASS:
1212
- Urllib3HttpConnection

.github/workflows/ci.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
steps:
1010
- name: Checkout Repository
1111
uses: actions/checkout@v3
12-
- name: Set up Python 3.7
12+
- name: Set up Python 3.8
1313
uses: actions/setup-python@v4
1414
with:
15-
python-version: 3.7
15+
python-version: 3.8
1616
- name: Install dependencies
1717
run: |
18-
python3.7 -m pip install nox
18+
python3.8 -m pip install nox
1919
- name: Lint the code
2020
run: nox -s lint
2121

@@ -24,13 +24,13 @@ jobs:
2424
steps:
2525
- name: Checkout Repository
2626
uses: actions/checkout@v3
27-
- name: Set up Python 3.7
27+
- name: Set up Python 3.8
2828
uses: actions/setup-python@v4
2929
with:
30-
python-version: 3.7
30+
python-version: 3.8
3131
- name: Install dependencies
3232
run: |
33-
python3.7 -m pip install nox
33+
python3.8 -m pip install nox
3434
- name: Run the api generator
3535
run: nox -s generate
3636

@@ -39,16 +39,16 @@ jobs:
3939
steps:
4040
- name: Checkout Repository
4141
uses: actions/checkout@v3
42-
- name: Set up Python 3.7
42+
- name: Set up Python 3.8
4343
uses: actions/setup-python@v4
4444
with:
45-
python-version: 3.7
45+
python-version: 3.8
4646
- name: Install build tools
4747
run: |
48-
python3.7 -m pip install --upgrade build
48+
python3.8 -m pip install --upgrade build
4949
- name: Build project for distribution
5050
run: |
51-
python3.7 -m build
51+
python3.8 -m build
5252
5353
twine-check:
5454
runs-on: ubuntu-latest

.github/workflows/docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ jobs:
88
- uses: actions/checkout@v2
99
- uses: actions/setup-python@v2
1010
with:
11-
python-version: 3.7
11+
python-version: 3.8
1212

1313
- name: Install Dependencies
1414
run: |
15-
python3.7 -m pip install nox
15+
python3.8 -m pip install nox
1616
1717
- name: Make
1818
run: |

.github/workflows/test.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ jobs:
77
strategy:
88
matrix:
99
entry:
10-
- { os: 'ubuntu-20.04', python-version: "3.6" }
11-
- { os: 'ubuntu-latest', python-version: "3.7" }
1210
- { os: 'ubuntu-latest', python-version: "3.8" }
1311
- { os: 'ubuntu-latest', python-version: "3.9" }
1412
- { os: 'ubuntu-latest', python-version: "3.10" }
1513
- { os: 'ubuntu-latest', python-version: "3.11" }
1614
- { os: 'macos-latest', python-version: "3.11" }
1715
- { os: 'windows-latest', python-version: "3.11" }
16+
- { os: 'ubuntu-latest', python-version: "3.12" }
17+
- { os: 'macos-latest', python-version: "3.12" }
18+
- { os: 'windows-latest', python-version: "3.12" }
1819

1920
name: test (os=${{ matrix.entry.os }}, python=${{ matrix.entry.python-version }})
2021
continue-on-error: ${{ matrix.entry.experimental || false }}

.github/workflows/update_api.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
fetch-depth: 0
1818
- name: Config git to rebase
1919
run: git config --global pull.rebase true
20-
- name: Set up Python 3.7
20+
- name: Set up Python 3.8
2121
uses: actions/setup-python@v4
2222
with:
23-
python-version: 3.7
23+
python-version: 3.8
2424
- name: Install dependencies
2525
run: |
26-
python3.7 -m pip install nox
26+
python3.8 -m pip install nox
2727
- name: Generate API
2828
run: nox -s generate
2929
- name: Get current date

.readthedocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22

33
python:
4-
version: 3.7
4+
version: 3.8
55
install:
66
- method: pip
77
path: .

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
33

44
## [Unreleased]
55
### Added
6+
- Added support for Python 3.12 ([#717](https://github.com/opensearch-project/opensearch-py/pull/717))
67
### Changed
78
### Deprecated
89
### Removed
10+
- Removed support for Python 3.6, 3.7 ([#717](https://github.com/opensearch-project/opensearch-py/pull/717))
911
### Fixed
1012
### Updated APIs
1113
### Security
1214
### Dependencies
15+
- Bumps `aiohttp` from >=3,<4 to >=3.9.2,<4 ([#717](https://github.com/opensearch-project/opensearch-py/pull/717))
16+
- Bumps `black` to >=24.3.0 ([#717](https://github.com/opensearch-project/opensearch-py/pull/717))
1317

1418
## [2.5.0]
1519
### Added

DEVELOPER_GUIDE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## Prerequisites
1212

13-
Python 3.6 or newer is required.
13+
Python 3.8 or newer is required.
1414

1515
```
1616
$ python --version

benchmarks/poetry.lock

+96-165
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "Apache 2.0"
77
readme = "README.md"
88

99
[tool.poetry.dependencies]
10-
python = "^3.7"
10+
python = "^3.8"
1111
opensearch-py = { path = "..", develop=true, extras=["async"] }
1212
richbench = "*"
1313

dev-requirements.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sphinx_rtd_theme
88
jinja2
99
pytz
1010
deepmerge
11+
setuptools
1112

1213
# No wheels for Python 3.10 yet!
1314
numpy; python_version<"3.10"
@@ -16,10 +17,10 @@ pandas; python_version<"3.10"
1617
pyyaml>=5.4
1718

1819
isort
19-
black
20+
black>=24.3.0
2021
twine
2122

2223
# Requirements for testing [async] extra
23-
aiohttp
24+
aiohttp>=3.9.2, <4
2425
pytest-asyncio<=0.23.5
2526
unasync

noxfile.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
)
4242

4343

44-
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]) # type: ignore
44+
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"]) # type: ignore
4545
def test(session: Any) -> None:
4646
"""
4747
runs all tests with a fresh python environment using "python setup.py test"
@@ -61,7 +61,7 @@ def test(session: Any) -> None:
6161
session.run("python", "setup.py", "test")
6262

6363

64-
@nox.session(python=["3.7"]) # type: ignore
64+
@nox.session(python=["3.8"]) # type: ignore
6565
def format(session: Any) -> None:
6666
"""
6767
runs black and isort to format the files accordingly
@@ -77,7 +77,7 @@ def format(session: Any) -> None:
7777
session.notify("lint")
7878

7979

80-
@nox.session(python=["3.7"]) # type: ignore
80+
@nox.session(python=["3.8"]) # type: ignore
8181
def lint(session: Any) -> None:
8282
"""
8383
runs isort, black, flake8, pylint, and mypy to check the files according to each utility's function

opensearchpy/_async/client/cluster.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ async def stats(
206206
"""
207207
return await self.transport.perform_request(
208208
"GET",
209-
"/_cluster/stats"
210-
if node_id in SKIP_IN_PATH
211-
else _make_path("_cluster", "stats", "nodes", node_id),
209+
(
210+
"/_cluster/stats"
211+
if node_id in SKIP_IN_PATH
212+
else _make_path("_cluster", "stats", "nodes", node_id)
213+
),
212214
params=params,
213215
headers=headers,
214216
)

opensearchpy/_async/compat.py

+1-17
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,8 @@
2525
# under the License.
2626

2727

28-
import asyncio
28+
from asyncio import get_running_loop
2929

3030
from ..compat import * # noqa
3131

32-
# Hack supporting Python 3.6 asyncio which didn't have 'get_running_loop()'.
33-
# Essentially we want to get away from having users pass in a loop to us.
34-
# Instead we should call 'get_running_loop()' whenever we need
35-
# the currently running loop.
36-
# See: https://aiopg.readthedocs.io/en/stable/run_loop.html#implementation
37-
try:
38-
from asyncio import get_running_loop
39-
except ImportError:
40-
41-
def get_running_loop() -> asyncio.AbstractEventLoop:
42-
loop = asyncio.get_event_loop()
43-
if not loop.is_running():
44-
raise RuntimeError("no running event loop")
45-
return loop
46-
47-
4832
__all__ = ["get_running_loop"]

opensearchpy/_async/plugins/alerting.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,11 @@ async def get_destination(
147147
"""
148148
return await self.transport.perform_request(
149149
"GET",
150-
_make_path("_plugins", "_alerting", "destinations", destination_id)
151-
if destination_id
152-
else _make_path("_plugins", "_alerting", "destinations"),
150+
(
151+
_make_path("_plugins", "_alerting", "destinations", destination_id)
152+
if destination_id
153+
else _make_path("_plugins", "_alerting", "destinations")
154+
),
153155
params=params,
154156
headers=headers,
155157
)

opensearchpy/_async/transport.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import asyncio
2929
import logging
30-
import sys
3130
from itertools import chain
3231
from typing import Any, Collection, Mapping, Optional, Type, Union
3332

@@ -251,13 +250,10 @@ def _sniff_request(conn: Any) -> Any:
251250
done: Any = ()
252251
try:
253252
while tasks:
254-
# The 'loop' keyword is deprecated in 3.8+ so don't
255-
# pass it to asyncio.wait() unless we're on <=3.7
256-
wait_kwargs = {"loop": self.loop} if sys.version_info < (3, 8) else {}
257253

258254
# execute sniff requests in parallel, wait for first to return
259255
done, tasks = await asyncio.wait(
260-
tasks, return_when=asyncio.FIRST_COMPLETED, **wait_kwargs
256+
tasks, return_when=asyncio.FIRST_COMPLETED
261257
)
262258
# go through all the finished tasks
263259
for t in done:

opensearchpy/client/cluster.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ def stats(
206206
"""
207207
return self.transport.perform_request(
208208
"GET",
209-
"/_cluster/stats"
210-
if node_id in SKIP_IN_PATH
211-
else _make_path("_cluster", "stats", "nodes", node_id),
209+
(
210+
"/_cluster/stats"
211+
if node_id in SKIP_IN_PATH
212+
else _make_path("_cluster", "stats", "nodes", node_id)
213+
),
212214
params=params,
213215
headers=headers,
214216
)

opensearchpy/helpers/analysis.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,13 @@ def get_definition(self) -> Any:
233233
if "filters" in d:
234234
d["filters"] = [
235235
# comma delimited string given by user
236-
fs if isinstance(fs, six.string_types) else
237-
# list of strings or TokenFilter objects
238-
", ".join(f.to_dict() if hasattr(f, "to_dict") else f for f in fs)
236+
(
237+
fs
238+
if isinstance(fs, six.string_types)
239+
else
240+
# list of strings or TokenFilter objects
241+
", ".join(f.to_dict() if hasattr(f, "to_dict") else f for f in fs)
242+
)
239243
for fs in self.filters
240244
]
241245
return d

opensearchpy/plugins/alerting.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ def get_destination(
124124
"""
125125
return self.transport.perform_request(
126126
"GET",
127-
_make_path("_plugins", "_alerting", "destinations", destination_id)
128-
if destination_id
129-
else _make_path("_plugins", "_alerting", "destinations"),
127+
(
128+
_make_path("_plugins", "_alerting", "destinations", destination_id)
129+
if destination_id
130+
else _make_path("_plugins", "_alerting", "destinations")
131+
),
130132
params=params,
131133
headers=headers,
132134
)

0 commit comments

Comments
 (0)