Skip to content

Commit d5a291f

Browse files
authored
COH-31421 - Integrate Coherence AI changes to main and release a new version to Pypi (#207)
* COH-31421 - Integrate Coherence AI changes to main and release a new version to Pypi
1 parent 369b9f9 commit d5a291f

File tree

11 files changed

+78
-39
lines changed

11 files changed

+78
-39
lines changed

.github/workflows/validate-nslookup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
poetry-version: ["1.8.4"]
2222
os: [ubuntu-latest]
2323
coherenceVersion:
24-
- 24.09
24+
- 24.09.2
2525
- 22.06.11
2626
base-image:
2727
- gcr.io/distroless/java17-debian11

.github/workflows/validate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
poetry-version: ["1.8.4"]
2222
os: [ubuntu-latest]
2323
coherenceVersion:
24-
- 24.09
24+
- 24.09.2
2525
- 22.06.11
2626
base-image:
2727
- gcr.io/distroless/java17-debian11
2828
profile:
2929
- ",-jakarta,javax"
3030
- ",jakarta,-javax"
3131
exclude:
32-
- coherenceVersion: 24.09
32+
- coherenceVersion: 24.09.2
3333
profile: ",-jakarta,javax"
3434
- coherenceVersion: 22.06.11
3535
profile: ",jakarta,-javax"

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ E2E_TESTS := tests/e2e/test_session.py \
8484
tests/e2e/test_filters.py \
8585
tests/e2e/test_processors.py \
8686
tests/e2e/test_aggregators.py \
87-
tests/e2e/test_near_caching.py \
88-
# tests/e2e/test_ai.py \
87+
tests/e2e/test_near_caching.py
88+
89+
#----------------------------------------------------------------------------------------------------------------------
90+
# AI tests
91+
# ----------------------------------------------------------------------------------------------------------------------
92+
AI_TESTS := tests/e2e/test_ai.py
8993

9094
# ----------------------------------------------------------------------------------------------------------------------
9195
# Clean-up all of the build artifacts
@@ -171,6 +175,13 @@ generate-proto: ## Generate Proto Files
171175
test: ##
172176
pytest -W error --cov src/coherence --cov-report=term --cov-report=html $(UNIT_TESTS) $(E2E_TESTS)
173177

178+
# ----------------------------------------------------------------------------------------------------------------------
179+
# Run tests with code coverage
180+
# ----------------------------------------------------------------------------------------------------------------------
181+
.PHONY: test-with-ai
182+
test-with-ai: ##
183+
pytest -W error --cov src/coherence --cov-report=term --cov-report=html $(UNIT_TESTS) $(E2E_TESTS) $(AI_TESTS)
184+
174185
# ----------------------------------------------------------------------------------------------------------------------
175186
# Run nslookup tests with code coverage
176187
# ----------------------------------------------------------------------------------------------------------------------

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ The Coherence Python Client allows Python applications to act as cache clients t
2020
* Support for storing Python objects as JSON as well as the ability to serialize to Java objects on the server for access from other Coherence language API's
2121

2222
#### Requirements
23-
* [Coherence CE](https://github.com/oracle/coherence) 22.06.11+ or Coherence 14.1.1.2206.11+ Commercial edition with a configured [gRPCProxy](https://docs.oracle.com/en/middleware/standalone/coherence/14.1.1.2206/develop-remote-clients/using-coherence-grpc-server.html).
24-
* Python 3.9.x
23+
* [Coherence CE](https://github.com/oracle/coherence) 22.06.11+ or Coherence 14.1.1.2206.11+, 14.1.2.0+ Commercial edition with a configured [gRPCProxy](https://docs.oracle.com/en/middleware/standalone/coherence/14.1.1.2206/develop-remote-clients/using-coherence-grpc-server.html).
24+
* Usage of module `coherence.ai` requires [Coherence CE](https://github.com/oracle/coherence) 24.09.2+
25+
* Python 3.9.x or later
2526

2627

2728
#### Starting a Coherence Cluster
@@ -31,7 +32,7 @@ For local development, we recommend using the Coherence CE Docker image; it cont
3132
everything necessary for the client to operate correctly.
3233

3334
```bash
34-
docker run -d -p 1408:1408 ghcr.io/oracle/coherence-ce:24.09
35+
docker run -d -p 1408:1408 ghcr.io/oracle/coherence-ce:24.09.02
3536
```
3637

3738
## Installation
@@ -112,7 +113,7 @@ Please consult the [security guide](./SECURITY.md) for our responsible security
112113

113114
## License
114115

115-
Copyright (c) 2023, 2024, Oracle and/or its affiliates.
116+
Copyright (c) 2023, 2025, Oracle and/or its affiliates.
116117

117118
Released under the Universal Permissive License v1.0 as shown at
118119
<https://oss.oracle.com/licenses/upl/>.

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
sys.path.insert(0, os.path.abspath("../src"))
2424

2525
# The full version, including alpha/beta/rc tags
26-
release = "1.1.1"
26+
release = "2.0.0"
2727

2828
# -- Project information -----------------------------------------------------
2929

3030
project = "Python Client for Oracle Coherence. v%s" % release
31-
copyright = "(c) 2022, 2024, Oracle and/or its affiliates."
31+
copyright = "(c) 2022, 2025, Oracle and/or its affiliates."
3232
author = "Oracle"
3333

3434

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://oss.oracle.com/licenses/upl.
44
[tool.poetry]
55
name = "coherence-client"
6-
version = "1.1.1"
6+
version = "2.0.0"
77
description = """The Coherence Python Client allows Python applications to act as cache clients to a \
88
Coherence Cluster using Google's gRPC framework as the network transport."""
99
packages = [

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Copyright (c) 2022, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2022, 2025, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at
33
# https://oss.oracle.com/licenses/upl.
44

55
from distutils.core import setup
66

77
setup(
88
name="coherence-client",
9-
version="1.1.1",
9+
version="2.0.0",
1010
packages=["coherence"],
1111
url="https://github.com/oracle/coherence-py-client",
1212
license="UPL",

src/coherence/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from __future__ import annotations
66

7-
__version__ = "1.1.1"
7+
__version__ = "2.0.0"
88

99
import contextvars
1010
import logging

src/coherence/client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ async def put_if_absent(self, key: K, value: V) -> Optional[V]:
408408
"""
409409

410410
@abc.abstractmethod
411-
async def put_all(self, map: dict[K, V], ttl: Optional[int] = 0) -> None:
411+
async def put_all(self, map: dict[K, V], ttl: Optional[int] = None) -> None:
412412
"""
413413
Copies all mappings from the specified map to this map
414414
@@ -669,7 +669,7 @@ async def put(self, key: K, value: V, ttl: Optional[int] = None) -> Optional[V]:
669669
670670
:param key: the key with which the specified value is to be associated
671671
:param value: the value to be associated with the specified key
672-
:param ttl: the expiry time in millis (optional). If not specific, it will default to the default
672+
:param ttl: the expiry time in millis (optional). If not specified, it will default to the default
673673
ttl defined in the cache options provided when the cache was obtained
674674
:return: resolving to the previous value associated with specified key, or `None` if there was no mapping for
675675
key. A `None` return can also indicate that the map previously associated `None` with the specified key
@@ -685,7 +685,7 @@ async def put_if_absent(self, key: K, value: V, ttl: Optional[int] = None) -> Op
685685
686686
:param key: the key with which the specified value is to be associated
687687
:param value: the value to be associated with the specified key
688-
:param ttl: the expiry time in millis (optional). If not specific, it will default to the default
688+
:param ttl: the expiry time in millis (optional). If not specified, it will default to the default
689689
ttl defined in the cache options provided when the cache was obtained.
690690
:return: resolving to the previous value associated with specified key, or `None` if there was no mapping for
691691
key. A `None` return can also indicate that the map previously associated `None` with the specified key
@@ -1576,8 +1576,9 @@ class Options:
15761576
Environment variable to specify the Coherence gRPC server address for the client to connect to. The
15771577
environment variable is used if address is not passed as an argument in the constructor. If the environment
15781578
variable is not set and address is not passed as an argument then `DEFAULT_ADDRESS` is used. One can also
1579-
use the 'coherence' gRPC resolver address of "coherence:///host:port" to connect to the Coherence Name
1580-
Service, running on the cluster port, and automatically discover the gRPC endpoints.
1579+
use the 'coherence' resolver address of "coherence:///host:port" to connect to the Coherence Name
1580+
Service, running on the cluster port, and automatically discover the gRPC proxy addresses and one of them
1581+
will be randomly picked.
15811582
"""
15821583
ENV_REQUEST_TIMEOUT = "COHERENCE_CLIENT_REQUEST_TIMEOUT"
15831584
"""

tests/e2e/test_ai.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2022, 2025, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at
33
# https://oss.oracle.com/licenses/upl.
44
import random
@@ -93,6 +93,7 @@ async def populate_document_chunk_vectors(vectors: NamedCache[int, DocumentChunk
9393

9494

9595
@pytest.mark.asyncio
96+
@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
9697
async def test_similarity_search_with_index(test_session: Session) -> None:
9798
cache: NamedCache[int, ValueWithVector] = await test_session.get_cache("vector_cache")
9899
cache.add_index(BinaryQuantIndex(Extractors.extract("vector")))
@@ -134,6 +135,7 @@ async def test_similarity_search_with_index(test_session: Session) -> None:
134135

135136

136137
@pytest.mark.asyncio
138+
@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
137139
async def test_similarity_search_with_document_chunk(test_session: Session) -> None:
138140
cache: NamedCache[int, DocumentChunk] = await test_session.get_cache("vector_cache")
139141
dc: DocumentChunk = await populate_document_chunk_vectors(cache)

0 commit comments

Comments
 (0)