Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .ci/Dockerfile.client
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ RUN python -m pip install \
-r dev-requirements.txt

COPY . .
RUN python -m pip install -e .
RUN python -m pip install -e .[tests]
6 changes: 4 additions & 2 deletions .ci/run-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ OPENSEARCH_REQUIRED_VERSION="2.12.0"
COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`
if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then
docker run \
--tty \
--network=${network_name} \
--env "STACK_VERSION=${STACK_VERSION}" \
--env "OPENSEARCH_URL=${opensearch_url}" \
Expand All @@ -48,9 +49,10 @@ if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then
--name opensearch-py \
--rm \
opensearch-project/opensearch-py \
python setup.py test
python test_opensearchpy/run_tests.py
else
docker run \
--tty \
--network=${network_name} \
--env "STACK_VERSION=${STACK_VERSION}" \
--env "OPENSEARCH_URL=${opensearch_url}" \
Expand All @@ -63,7 +65,7 @@ else
--name opensearch-py \
--rm \
opensearch-project/opensearch-py \
python setup.py test
python test_opensearchpy/run_tests.py
fi

unset TEST_PATTERN
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine
python -m pip install twine build
- name: Build source distribution
run: python setup.py sdist bdist_wheel
run: pyproject-build
- name: Check with Twine
working-directory: dist
run: twine check *
4 changes: 2 additions & 2 deletions .github/workflows/integration-unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ jobs:
mkdir -p junit
python -m pip install -U --no-cache-dir --disable-pip-version-check pip
python -m pip install --no-cache-dir --disable-pip-version-check -r dev-requirements.txt
python -m pip install -e .
python setup.py test
python -m pip install -e .[tests]
python test_opensearchpy/run_tests.py
working-directory: opensearch-py
3 changes: 1 addition & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ jobs:
run: |
python -m pip install --upgrade build
- name: Build project for distribution
run: |
python -m build
run: pyproject-build
- name: upload windows dists
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Updated opensearch-py APIs to reflect [opensearch-api-specification@578a78d](https://github.com/opensearch-project/opensearch-api-specification/commit/578a78dcec746e81da88f81ad442ab1836db7694)
### Changed
- Rename `DenseVector` field type to `KnnVector` ([925](https://github.com/opensearch-project/opensearch-py/pull/925))
- Migrate `setup.py` to a `pyproject.toml` ([951](https://github.com/opensearch-project/opensearch-py/pull/951))
### Deprecated
### Removed
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export OPENSEARCH_PASSWORD=myStrongPassword123!
If you have one running.

```
python setup.py test
python test_opensearchpy/run_tests.py
```

To run tests in a specific test file.

```
python setup.py test -s test_opensearchpy/test_connection/test_base_connection.py
python test_opensearchpy/run_tests.py -s test_opensearchpy/test_connection/test_base_connection.py
```

If you want to auto-start one, the following will start a new instance and run tests against the latest version of OpenSearch.
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include CONTRIBUTING.md
include LICENSE
include MANIFEST.in
include README.md
include setup.py
include pyproject.toml
recursive-include opensearch* py.typed

prune test_opensearch
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ push:
PYTHON_VERSION=${PYTHON_VERSION} docker-compose push client

run_tests:
OPENSEARCH_VERSION=${OPENSEARCH_VERSION} PYTHON_VERSION=${PYTHON_VERSION} docker-compose -p "${OPEN_VERSION}-${PYTHON_VERSION}" run client python setup.py test
OPENSEARCH_VERSION=${OPENSEARCH_VERSION} PYTHON_VERSION=${PYTHON_VERSION} docker-compose -p "${OPEN_VERSION}-${PYTHON_VERSION}" run client python test_opensearchpy/run_tests.py

start_opensearch:
OPENSEARCH_VERSION=${OPENSEARCH_VERSION} docker-compose up -d opensearch
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pytz
deepmerge
Events
setuptools==71.1.0
build

numpy; python_version<="3.12"
pandas; python_version<="3.12"
Expand Down
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import nox

SOURCE_FILES = (
"setup.py",
"noxfile.py",
"opensearchpy/",
"test_opensearchpy/",
Expand All @@ -44,7 +43,7 @@
@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"
runs all tests with a fresh python environment
:param session: current nox session
"""
session.install(".")
Expand All @@ -56,9 +55,10 @@ def test(session: Any) -> None:
"python", "-c", "import opensearchpy\nprint(opensearchpy.AsyncOpenSearch())"
)

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

session.run("python", "setup.py", "test")
session.run("python", "test_opensearchpy/run_tests.py")


@nox.session(python=["3.8"]) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/_async/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(
self,
hosts: Optional[str] = None,
transport_class: Type[Transport] = Transport,
**kwargs: Any
**kwargs: Any,
) -> None:
"""
:arg hosts: list of nodes, or a single node, we should connect to.
Expand Down
8 changes: 4 additions & 4 deletions opensearchpy/_async/helpers/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def _process_bulk_chunk(
raise_on_error: bool = True,
ignore_status: Any = (),
*args: Any,
**kwargs: Any
**kwargs: Any,
) -> AsyncGenerator[Tuple[bool, Any], None]:
"""
Send a bulk request to opensearch and process the output.
Expand Down Expand Up @@ -159,7 +159,7 @@ async def async_streaming_bulk(
yield_ok: bool = True,
ignore_status: Any = (),
*args: Any,
**kwargs: Any
**kwargs: Any,
) -> AsyncGenerator[Tuple[bool, Any], None]:
"""
Streaming bulk consumes actions from the iterable passed in and yields
Expand Down Expand Up @@ -261,7 +261,7 @@ async def async_bulk(
stats_only: bool = False,
ignore_status: Optional[Union[int, Collection[int]]] = (),
*args: Any,
**kwargs: Any
**kwargs: Any,
) -> Tuple[int, Union[int, List[Any]]]:
"""
Helper for the :meth:`~opensearchpy.AsyncOpenSearch.bulk` api that provides
Expand Down Expand Up @@ -322,7 +322,7 @@ async def async_scan(
request_timeout: Any = None,
clear_scroll: bool = True,
scroll_kwargs: Any = None,
**kwargs: Any
**kwargs: Any,
) -> Any:
"""
Simple abstraction on top of the
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/_async/helpers/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(
template: Any,
index: Any = None,
order: Any = None,
**kwargs: Any
**kwargs: Any,
) -> None:
if index is None:
self._index = AsyncIndex(template, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions opensearchpy/_async/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(
retry_on_status: Any = (502, 503, 504),
retry_on_timeout: bool = False,
send_get_body_as: str = "GET",
**kwargs: Any
**kwargs: Any,
) -> None:
"""
:arg hosts: list of dictionaries, each containing keyword arguments to
Expand Down Expand Up @@ -141,7 +141,7 @@ def __init__(
retry_on_status=retry_on_status,
retry_on_timeout=retry_on_timeout,
send_get_body_as=send_get_body_as,
**kwargs
**kwargs,
)

# Since we defer connections / sniffing to not occur
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(
self,
hosts: Optional[str] = None,
transport_class: Type[Transport] = Transport,
**kwargs: Any
**kwargs: Any,
) -> None:
"""
:arg hosts: list of nodes, or a single node, we should connect to.
Expand Down
4 changes: 2 additions & 2 deletions opensearchpy/helpers/faceted_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_value_filter(self, filter_value: Any) -> Any:
"gte": filter_value,
"lt": filter_value + self._params["interval"],
}
}
},
)


Expand Down Expand Up @@ -244,7 +244,7 @@ def get_value_filter(self, filter_value: Any) -> Any:
filter_value
),
}
}
},
)


Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/helpers/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(
template: Any,
index: Any = None,
order: Any = None,
**kwargs: Any
**kwargs: Any,
) -> None:
if index is None:
self._index = Index(template, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __init__(
retry_on_timeout: bool = False,
send_get_body_as: str = "GET",
metrics: Metrics = MetricsNone(),
**kwargs: Any
**kwargs: Any,
) -> None:
"""
:arg hosts: list of dictionaries, each containing keyword arguments to
Expand Down
110 changes: 110 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[build-system]
requires = ["setuptools==71.1.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "opensearch-py"
description = "Python client for OpenSearch"
readme = "README.md"
requires-python = ">=3.8,<4"
license = { text = "Apache-2.0" }
authors = [
{ name = "Aleksei Atavin", email = "[email protected]" },
{ name = "Denis Zalevskiy", email = "[email protected]" },
{ name = "Rushi Agrawal", email = "[email protected]" },
{ name = "Shephali Mittal", email = "[email protected]" },
]
maintainers = [
{ name = "Aleksei Atavin", email = "[email protected]" },
{ name = "Denis Zalevskiy", email = "[email protected]" },
{ name = "Rushi Agrawal", email = "[email protected]" },
{ name = "Shephali Mittal", email = "[email protected]" },
]
dynamic = ["version"]

classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]

dependencies = [
'urllib3>=1.26.19,<1.27; python_version < "3.10"',
'urllib3>=1.26.19,!=2.2.0,!=2.2.1,<3; python_version >= "3.10"',
"requests>=2.32.0,<3.0.0",
"python-dateutil",
"certifi>=2024.07.04",
"Events",
]

[project.optional-dependencies]
tests = [
"requests>=2.0.0,<3.0.0",
"coverage<8.0.0",
"pyyaml",
"pytest>=3.0.0",
"pytest-cov",
"pytz",
"botocore",
"pytest-mock<4.0.0",
]
async = [
"aiohttp>=3.10.11,<4",
]
docs = [
"sphinx",
"sphinx_rtd_theme",
"myst_parser",
"sphinx_copybutton",
# re-add async dependencies
"aiohttp>=3.10.11,<4",
]
develop = [
"black>=24.3.0",
"jinja2",
# re-add tests dependencies
"requests>=2.0.0,<3.0.0",
"coverage<8.0.0",
"pyyaml",
"pytest>=3.0.0",
"pytest-cov",
"pytz",
"botocore",
"pytest-mock<4.0.0",
# re-add docs dependencies
"sphinx",
"sphinx_rtd_theme",
"myst_parser",
"sphinx_copybutton",
# re-add async dependencies
"aiohttp>=3.10.11,<4",
]
kerberos = ["requests_kerberos"]

[project.urls]
Documentation = "https://opensearch.org/docs/clients/python"
Source = "https://github.com/opensearch-project/opensearch-py"
"Issue Tracker" = "https://github.com/opensearch-project/opensearch-py/issues"

[tool.setuptools]
zip-safe = false

[tool.setuptools.package-data]
"opensearchpy" = ["py.typed"]

[tool.setuptools.dynamic]
version = { attr = "opensearchpy._version.__versionstr__" }

[tool.setuptools.packages.find]
where = ["."]
include = ["opensearchpy*"]
exclude = ["test_opensearchpy*"]
20 changes: 0 additions & 20 deletions setup.cfg

This file was deleted.

Loading
Loading