Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropped support for python 3.6, 3.7 and added support for python 3.12 #717

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ TEST_SUITE:
- oss

PYTHON_VERSION:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

PYTHON_CONNECTION_CLASS:
- Urllib3HttpConnection
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Install dependencies
run: |
python3.7 -m pip install nox
python3.8 -m pip install nox
- name: Lint the code
run: nox -s lint

Expand All @@ -24,13 +24,13 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Install dependencies
run: |
python3.7 -m pip install nox
python3.8 -m pip install nox
- name: Run the api generator
run: nox -s generate

Expand All @@ -39,16 +39,16 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Install build tools
run: |
python3.7 -m pip install --upgrade build
python3.8 -m pip install --upgrade build
- name: Build project for distribution
run: |
python3.7 -m build
python3.8 -m build

twine-check:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8

- name: Install Dependencies
run: |
python3.7 -m pip install nox
python3.8 -m pip install nox

- name: Make
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ jobs:
strategy:
matrix:
entry:
- { os: 'ubuntu-20.04', python-version: "3.6" }
- { os: 'ubuntu-latest', python-version: "3.7" }
- { os: 'ubuntu-latest', python-version: "3.8" }
- { os: 'ubuntu-latest', python-version: "3.9" }
- { os: 'ubuntu-latest', python-version: "3.10" }
- { os: 'ubuntu-latest', python-version: "3.11" }
- { os: 'macos-latest', python-version: "3.11" }
- { os: 'windows-latest', python-version: "3.11" }
- { os: 'ubuntu-latest', python-version: "3.12" }
- { os: 'macos-latest', python-version: "3.12" }
- { os: 'windows-latest', python-version: "3.12" }

name: test (os=${{ matrix.entry.os }}, python=${{ matrix.entry.python-version }})
continue-on-error: ${{ matrix.entry.experimental || false }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/update_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
fetch-depth: 0
- name: Config git to rebase
run: git config --global pull.rebase true
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Install dependencies
run: |
python3.7 -m pip install nox
python3.8 -m pip install nox
- name: Generate API
run: nox -s generate
- name: Get current date
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

python:
version: 3.7
version: 3.8
install:
- method: pip
path: .
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]
### Added
- Added support for Python 3.12 ([#717](https://github.com/opensearch-project/opensearch-py/pull/717))
### Changed
### Deprecated
### Removed
- Removed support for Python 3.6, 3.7 ([#717](https://github.com/opensearch-project/opensearch-py/pull/717))
### Fixed
### Updated APIs
### Security
### Dependencies
- Bumps `aiohttp` from >=3,<4 to >=3.9.2,<4 ([#717](https://github.com/opensearch-project/opensearch-py/pull/717))
- Bumps `black` to >=24.3.0 ([#717](https://github.com/opensearch-project/opensearch-py/pull/717))

## [2.5.0]
### Added
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## Prerequisites

Python 3.6 or newer is required.
Python 3.8 or newer is required.

```
$ python --version
Expand Down
261 changes: 96 additions & 165 deletions benchmarks/poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion benchmarks/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "Apache 2.0"
readme = "README.md"

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

Expand Down
5 changes: 3 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sphinx_rtd_theme
jinja2
pytz
deepmerge
setuptools

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

isort
black
black>=24.3.0
twine

# Requirements for testing [async] extra
aiohttp
aiohttp>=3.9.2, <4
pytest-asyncio<=0.23.5
unasync
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
)


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


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


@nox.session(python=["3.7"]) # type: ignore
@nox.session(python=["3.8"]) # type: ignore
def lint(session: Any) -> None:
"""
runs isort, black, flake8, pylint, and mypy to check the files according to each utility's function
Expand Down
8 changes: 5 additions & 3 deletions opensearchpy/_async/client/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ async def stats(
"""
return await self.transport.perform_request(
"GET",
"/_cluster/stats"
if node_id in SKIP_IN_PATH
else _make_path("_cluster", "stats", "nodes", node_id),
(
"/_cluster/stats"
if node_id in SKIP_IN_PATH
else _make_path("_cluster", "stats", "nodes", node_id)
),
params=params,
headers=headers,
)
Expand Down
18 changes: 1 addition & 17 deletions opensearchpy/_async/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,8 @@
# under the License.


import asyncio
from asyncio import get_running_loop

from ..compat import * # noqa

# Hack supporting Python 3.6 asyncio which didn't have 'get_running_loop()'.
# Essentially we want to get away from having users pass in a loop to us.
# Instead we should call 'get_running_loop()' whenever we need
# the currently running loop.
# See: https://aiopg.readthedocs.io/en/stable/run_loop.html#implementation
try:
from asyncio import get_running_loop
except ImportError:

def get_running_loop() -> asyncio.AbstractEventLoop:
loop = asyncio.get_event_loop()
if not loop.is_running():
raise RuntimeError("no running event loop")
return loop


__all__ = ["get_running_loop"]
8 changes: 5 additions & 3 deletions opensearchpy/_async/plugins/alerting.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ async def get_destination(
"""
return await self.transport.perform_request(
"GET",
_make_path("_plugins", "_alerting", "destinations", destination_id)
if destination_id
else _make_path("_plugins", "_alerting", "destinations"),
(
_make_path("_plugins", "_alerting", "destinations", destination_id)
if destination_id
else _make_path("_plugins", "_alerting", "destinations")
),
params=params,
headers=headers,
)
Expand Down
6 changes: 1 addition & 5 deletions opensearchpy/_async/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import asyncio
import logging
import sys
from itertools import chain
from typing import Any, Collection, Mapping, Optional, Type, Union

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

# execute sniff requests in parallel, wait for first to return
done, tasks = await asyncio.wait(
tasks, return_when=asyncio.FIRST_COMPLETED, **wait_kwargs
tasks, return_when=asyncio.FIRST_COMPLETED
)
# go through all the finished tasks
for t in done:
Expand Down
8 changes: 5 additions & 3 deletions opensearchpy/client/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ def stats(
"""
return self.transport.perform_request(
"GET",
"/_cluster/stats"
if node_id in SKIP_IN_PATH
else _make_path("_cluster", "stats", "nodes", node_id),
(
"/_cluster/stats"
if node_id in SKIP_IN_PATH
else _make_path("_cluster", "stats", "nodes", node_id)
),
params=params,
headers=headers,
)
Expand Down
10 changes: 7 additions & 3 deletions opensearchpy/helpers/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,13 @@ def get_definition(self) -> Any:
if "filters" in d:
d["filters"] = [
# comma delimited string given by user
fs if isinstance(fs, six.string_types) else
# list of strings or TokenFilter objects
", ".join(f.to_dict() if hasattr(f, "to_dict") else f for f in fs)
(
fs
if isinstance(fs, six.string_types)
else
# list of strings or TokenFilter objects
", ".join(f.to_dict() if hasattr(f, "to_dict") else f for f in fs)
)
for fs in self.filters
]
return d
Expand Down
8 changes: 5 additions & 3 deletions opensearchpy/plugins/alerting.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ def get_destination(
"""
return self.transport.perform_request(
"GET",
_make_path("_plugins", "_alerting", "destinations", destination_id)
if destination_id
else _make_path("_plugins", "_alerting", "destinations"),
(
_make_path("_plugins", "_alerting", "destinations", destination_id)
if destination_id
else _make_path("_plugins", "_alerting", "destinations")
),
params=params,
headers=headers,
)
Expand Down
Loading
Loading