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

Fix for 592 #594

Merged
merged 4 commits into from
Nov 16, 2023
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 .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
PIP_DISABLE_PIP_VERSION_CHECK: 1
- name: Install Dependencies
run: |
python -m pip install -r dev-requirements.txt
python -m pip install nox
- name: Run Tests
run: |
python setup.py test
python -m nox -rs test-${{ matrix.entry.python-version }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unified-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
stack_version: ['2.4.0']
stack_version: ['2.4.1']

steps:
- name: Checkout
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# CHANGELOG
Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [2.4.1]
### Added
### Changed
### Deprecated
### Removed
### Fixed
- Fix dependency on `aiohttp` ([#594](https://github.com/opensearch-project/opensearch-py/pull/594))
### Security

## [2.4.0]
### Added
- Added generating imports and headers to API generator ([#467](https://github.com/opensearch-project/opensearch-py/pull/467))
Expand Down
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ The release process is standard across repositories in this org and is run by a
1. The [release-drafter.yml](.github/workflows/release-drafter.yml) will be automatically kicked off and a draft release will be created.
1. This draft release triggers the [jenkins release workflow](https://build.ci.opensearch.org/job/opensearch-py-release/) as a result of which opensearch-py client is released on [PyPi](https://pypi.org/project/opensearch-py/).
1. Once the above release workflow is successful, the drafted release on GitHub is published automatically.
1. Increment "version" in [_version.py](./opensearchpy/_version.py) to the next patch release, e.g. v2.1.1. See [example](https://github.com/opensearch-project/opensearch-py/pull/167).
1. Add an "Unreleased" section to CHANGELOG, and increment version to the next patch release, e.g. v2.1.1. See [example](https://github.com/opensearch-project/opensearch-py/pull/593).
2 changes: 1 addition & 1 deletion benchmarks/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]) # type: ignore
def test(session: Any) -> None:
session.install(".")
# ensure client can be imported without aiohttp
session.run("python", "-c", "import opensearchpy\nprint(opensearchpy.OpenSearch())")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reproduces #592 without the fix.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have full faith that this should work, but looking through the tests I don't think we do a nox test in any of the CIs. I think we really need to add that.

# ensure client can be imported with aiohttp
session.install(".[async]")
session.run(
"python", "-c", "import opensearchpy\nprint(opensearchpy.AsyncOpenSearch())"
)

session.install("-r", "dev-requirements.txt")

session.run("python", "setup.py", "test")
Expand Down
36 changes: 19 additions & 17 deletions opensearchpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@
logger = logging.getLogger("opensearch")
logger.addHandler(logging.NullHandler())

from ._async.client import AsyncOpenSearch
from ._async.http_aiohttp import AIOHttpConnection, AsyncConnection
from ._async.transport import AsyncTransport
from .client import OpenSearch
from .connection import (
AsyncHttpConnection,
Connection,
RequestsHttpConnection,
Urllib3HttpConnection,
Expand All @@ -76,12 +72,7 @@
UnknownDslObject,
ValidationException,
)
from .helpers import (
AWSV4SignerAsyncAuth,
AWSV4SignerAuth,
RequestsAWSV4SignerAuth,
Urllib3AWSV4SignerAuth,
)
from .helpers import AWSV4SignerAuth, RequestsAWSV4SignerAuth, Urllib3AWSV4SignerAuth
from .helpers.aggs import A
from .helpers.analysis import analyzer, char_filter, normalizer, token_filter, tokenizer
from .helpers.document import Document, InnerDoc, MetaField
Expand Down Expand Up @@ -159,7 +150,6 @@
"JSONSerializer",
"Connection",
"RequestsHttpConnection",
"AsyncHttpConnection",
"Urllib3HttpConnection",
"ImproperlyConfigured",
"OpenSearchException",
Expand All @@ -178,7 +168,6 @@
"AWSV4SignerAuth",
"Urllib3AWSV4SignerAuth",
"RequestsAWSV4SignerAuth",
"AWSV4SignerAsyncAuth",
"A",
"AttrDict",
"AttrList",
Expand Down Expand Up @@ -251,10 +240,23 @@
"normalizer",
"token_filter",
"tokenizer",
"AIOHttpConnection",
"AsyncConnection",
"AsyncTransport",
"AsyncOpenSearch",
"AsyncHttpConnection",
"__versionstr__",
]

try:
from ._async.client import AsyncOpenSearch
from ._async.http_aiohttp import AIOHttpConnection, AsyncConnection
from ._async.transport import AsyncTransport
from .connection import AsyncHttpConnection
from .helpers import AWSV4SignerAsyncAuth

__all__ += [
"AIOHttpConnection",
"AsyncConnection",
"AsyncTransport",
"AsyncOpenSearch",
"AsyncHttpConnection",
"AWSV4SignerAsyncAuth",
]
except (ImportError, SyntaxError):
pass

Check warning on line 262 in opensearchpy/__init__.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/__init__.py#L261-L262

Added lines #L261 - L262 were not covered by tests
2 changes: 1 addition & 1 deletion opensearchpy/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
# specific language governing permissions and limitations
# under the License.

__versionstr__: str = "2.4.0"
__versionstr__: str = "2.4.1"
11 changes: 9 additions & 2 deletions opensearchpy/connection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


from .base import Connection
from .http_async import AsyncHttpConnection
from .http_requests import RequestsHttpConnection
from .http_urllib3 import Urllib3HttpConnection, create_ssl_context

Expand All @@ -36,5 +35,13 @@
"RequestsHttpConnection",
"Urllib3HttpConnection",
"create_ssl_context",
"AsyncHttpConnection",
]

try:
from .http_async import AsyncHttpConnection

__all__ += [
"AsyncHttpConnection",
]
except (ImportError, SyntaxError):
pass

Check warning on line 47 in opensearchpy/connection/__init__.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/connection/__init__.py#L46-L47

Added lines #L46 - L47 were not covered by tests
Loading