Skip to content

Commit 882cb97

Browse files
committed
Update README.md example and pyproject.toml details
1 parent 2880ab0 commit 882cb97

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed

README.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ docker run -d -p 1408:1408 ghcr.io/oracle/coherence-ce:22.06.3
3131
## Installation
3232

3333
```bash
34-
pip install coherence
34+
python3 -m pip install coherence
3535
```
3636

3737
## Documentation
@@ -46,35 +46,43 @@ issues `put()`, `get()`, `size()` and `remove` operations.
4646

4747
```python
4848
from coherence import NamedCache, Session
49+
import asyncio
4950

50-
# create a new Session to the Coherence server
51-
session: Session = Session(None)
5251

53-
# create a new NamedCache with key of string|int and value of string|int
54-
cache: NamedCache[str, str|int] = await session.get_cache("test")
52+
async def run_test():
5553

56-
# put a new key/value
57-
k: str = "one"
58-
v: str = "only-one"
59-
await cache.put(k, v)
54+
# create a new Session to the Coherence server
55+
session: Session = Session(None)
6056

61-
# get the value for a key in the cache
62-
r = await cache.get(k)
57+
# create a new NamedCache with key of string|int and value of string|int
58+
cache: NamedCache[str, str|int] = await session.get_cache("test")
6359

64-
# print the value got for a key in the cache
65-
print("The value of key \"one\" is " + r)
60+
# put a new key/value
61+
k: str = "one"
62+
v: str = "only-one"
63+
await cache.put(k, v)
6664

67-
k1: str = "two"
68-
v1: int = 2
69-
await cache.put(k1, v1)
70-
r = await cache.get(k1)
71-
print("The value of key \"two\" is " + r)
65+
# get the value for a key in the cache
66+
r = await cache.get(k)
7267

73-
# print the size of the cache
74-
print("Size of the cache test is " + str(await cache.size()))
68+
# print the value got for a key in the cache
69+
print("The value of key \"one\" is " + r)
7570

76-
# remove an entry from the cache
77-
await cache.remove(k1)
71+
k1: str = "two"
72+
v1: int = 2
73+
await cache.put(k1, v1)
74+
r = await cache.get(k1)
75+
print("The value of key \"two\" is " + str(r))
76+
77+
# print the size of the cache
78+
print("Size of the cache test is " + str(await cache.size()))
79+
80+
# remove an entry from the cache
81+
await cache.remove(k1)
82+
83+
84+
# run the test
85+
asyncio.run(run_test())
7886
```
7987
## Help
8088

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ version = "0.9.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
authors = ["Dhiru Pandey <[email protected]>", "Ryan Lubke <[email protected]>"]
10+
readme = "README.md"
11+
classifiers = [
12+
"Programming Language :: Python :: 3",
13+
"License :: OSI Approved :: Universal Permissive License (UPL)",
14+
"Operating System :: OS Independent",
15+
]
16+
[project.urls]
17+
"Homepage" = "https://github.com/oracle/coherenc-py-client"
18+
"Bug Tracker" = "https://github.com/oracle/coherenc-py-client/issues"
1019

1120
[tool.poetry.dependencies]
1221
python = "~3.10"

0 commit comments

Comments
 (0)