Skip to content

Commit

Permalink
Merge branch 'main' into avoid-body-decode
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel (dB.) Doubrovkine <[email protected]>
  • Loading branch information
dblock authored Nov 12, 2023
2 parents 6e5bd2c + 7878364 commit 117447c
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 50 deletions.
5 changes: 5 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
project:
default:
threshold: 0.1%
19 changes: 0 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,3 @@ jobs:
- name: Check with Twine
working-directory: dist
run: twine check *

test-docs-build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Check if Sphinx docs are built
run: |
pip install -e .[docs]
cd docs
make html
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: Build & Deploy Doc
on:
push:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
name: Build & Deploy Docs
on: [push, pull_request, workflow_dispatch]

jobs:
build-and-deploy:
Expand All @@ -15,19 +10,17 @@ jobs:
with:
python-version: 3.7

- name: Install
- name: Install Dependencies
run: |
python -m pip install -U pip
pip install --progress-bar off -U .[docs]
python3.7 -m pip install nox
- name: Make
run: |
cd docs
make html
cd ..
nox -rs docs
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Deprecated point-in-time APIs (list_all_point_in_time, create_point_in_time, delete_point_in_time) and Security Client APIs (health_check and update_audit_config) ([#502](https://github.com/opensearch-project/opensearch-py/pull/502))
### Removed
- Removed leftover support for Python 2.7 ([#548](https://github.com/opensearch-project/opensearch-py/pull/548))
- Removed leftover support for Python 3.6 ([#576](https://github.com/opensearch-project/opensearch-py/pull/576))
### Fixed
- Fixed automatically built and deployed docs ([575](https://github.com/opensearch-project/opensearch-py/pull/575))
- Avoid decoding request body unless it needs to be logged ([#571](https://github.com/opensearch-project/opensearch-py/pull/571))
### Security
### Dependencies
Expand All @@ -47,6 +49,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Security
### Dependencies
- Bumps `urllib3` from >=1.21.1, <2 to >=1.26.9 ([#518](https://github.com/opensearch-project/opensearch-py/pull/518))
- Bumps `urllib3` from >=1.26.17 to >=1.26.18 ([#576](https://github.com/opensearch-project/opensearch-py/pull/576))

## [2.3.1]
### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ OpenSearch Python Client
- [License](https://github.com/opensearch-project/opensearch-py#license)
- [Copyright](https://github.com/opensearch-project/opensearch-py#copyright)

## Welcome!
# Welcome!

**opensearch-py** is [a community-driven, open source fork](https://aws.amazon.com/blogs/opensource/introducing-opensearch/)
of elasticsearch-py licensed under the [Apache v2.0 License](https://github.com/opensearch-project/opensearch-py/blob/main/LICENSE.txt).
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXOPTS ?= -W
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ async def index(
:arg if_seq_no: only perform the operation if the last operation
that has changed the document has the specified sequence number.
:arg op_type: Explicit operation type. Defaults to `index` for
requests with an explicit document ID, and to `create`for requests
requests with an explicit document ID, and to `create` for requests
without an explicit document ID. Valid choices are index, create.
:arg pipeline: The pipeline id to preprocess incoming documents
with.
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def index(
:arg if_seq_no: only perform the operation if the last operation
that has changed the document has the specified sequence number.
:arg op_type: Explicit operation type. Defaults to `index` for
requests with an explicit document ID, and to `create`for requests
requests with an explicit document ID, and to `create` for requests
without an explicit document ID. Valid choices are index, create.
:arg pipeline: The pipeline id to preprocess incoming documents
with.
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
if package == module_dir or package.startswith(module_dir + ".")
]
install_requires = [
"urllib3>=1.26.17",
"urllib3>=1.26.18",
"requests>=2.4.0, <3.0.0",
"six",
"python-dateutil",
Expand Down Expand Up @@ -113,7 +113,7 @@
tests_require=tests_require,
extras_require={
"develop": tests_require + docs_require + generate_require,
"docs": docs_require,
"docs": docs_require + async_require,
"async": async_require,
"kerberos": ["requests_kerberos"],
},
Expand Down
5 changes: 2 additions & 3 deletions test_opensearchpy/test_async/test_http_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@

import mock
import pytest
from _pytest.mark.structures import MarkDecorator
from multidict import CIMultiDict

from opensearchpy._async._extra_imports import aiohttp # type: ignore
from opensearchpy._async.compat import get_running_loop
from opensearchpy.connection.http_async import AsyncHttpConnection

pytestmark: MarkDecorator = pytest.mark.asyncio


class TestAsyncHttpConnection:
def test_auth_as_tuple(self) -> None:
Expand All @@ -60,6 +57,7 @@ def auth_fn() -> None:
c = AsyncHttpConnection(http_auth=auth_fn)
assert callable(c._http_auth)

@pytest.mark.asyncio # type: ignore
@mock.patch("aiohttp.ClientSession.request", new_callable=mock.Mock)
async def test_basicauth_in_request_session(self, mock_request: Any) -> None:
async def do_request(*args: Any, **kwargs: Any) -> Any:
Expand Down Expand Up @@ -91,6 +89,7 @@ async def do_request(*args: Any, **kwargs: Any) -> Any:
fingerprint=None,
)

@pytest.mark.asyncio # type: ignore
@mock.patch("aiohttp.ClientSession.request", new_callable=mock.Mock)
async def test_callable_in_request_session(self, mock_request: Any) -> None:
def auth_fn(*args: Any, **kwargs: Any) -> Any:
Expand Down
18 changes: 12 additions & 6 deletions test_opensearchpy/test_async/test_plugins_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.

from unittest import TestCase

import warnings

import pytest
from _pytest.mark.structures import MarkDecorator

from opensearchpy._async.client import AsyncOpenSearch

pytestmark: MarkDecorator = pytest.mark.asyncio


class TestPluginsClient(TestCase):
class TestPluginsClient:
async def test_plugins_client(self) -> None:
with self.assertWarns(Warning) as w:
with warnings.catch_warnings(record=True) as w:
client = AsyncOpenSearch()
# testing double-init here
client.plugins.__init__(client) # type: ignore
self.assertEqual(
str(w.warnings[0].message),
"Cannot load `alerting` directly to AsyncOpenSearch as it already exists. Use `AsyncOpenSearch.plugin.alerting` instead.",
assert (
str(w[0].message)
== "Cannot load `alerting` directly to AsyncOpenSearch as it already exists. Use `AsyncOpenSearch.plugin.alerting` instead."
)
4 changes: 1 addition & 3 deletions test_opensearchpy/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ def test_serializes_numpy_floats(self) -> None:
np.float32,
np.float64,
):
self.assertRegexpMatches(
ser.dumps({"d": np_type(1.2)}), r'^\{"d":1\.2[\d]*}$'
)
self.assertRegex(ser.dumps({"d": np_type(1.2)}), r'^\{"d":1\.2[\d]*}$')

def test_serializes_numpy_datetime(self) -> None:
requires_numpy_and_pandas()
Expand Down

0 comments on commit 117447c

Please sign in to comment.