Skip to content

Commit 30352e5

Browse files
committed
Fixed doc version to epytext
1 parent eb9d148 commit 30352e5

File tree

5 files changed

+62
-66
lines changed

5 files changed

+62
-66
lines changed

.github/workflows/run-tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ jobs:
4141

4242
- name: Run tests
4343
run: uv run pytest
44+
45+
- name: Verify documentation
46+
run: uv run pydoctor --config pydoctor.ini

pydoctor.ini

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ project-url = https://github.com/oxia-db/oxia-client-python
44
make-html = True
55
html-output = docs/api
66
add-package = ./src/oxia
7-
docformat = restructuredtext
7+
docformat = epytext
88
process-types = True
99
privacy =
10-
HIDDEN:oxia.internal
10+
HIDDEN:oxia.internal.**
1111
HIDDEN:oxia.client_test
1212
HIDDEN:oxia.client
13-
HIDDEN:oxia.defs
14-
HIDDEN:oxia.internal.proto.io.streamnative.oxia.proto
15-
13+
HIDDEN:oxia.defs

src/oxia/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@
1515
"""
1616
Oxia Client SDK for Python.
1717
18-
Usage example:
19-
20-
.. code-block:: python
18+
Usage example::
2119
2220
client = oxia.Client('oxia://localhost:6648', namespace='default')
23-
2421
key, version = client.put('my-key', 'my-value')
25-
2622
key, value, version = client.get('my-key')
2723
"""
2824

src/oxia/client.py

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def version_id(self) -> int:
7373
the current version. It does not accept any parameters and simply outputs
7474
the version ID as an integer.
7575
76-
:return: The version ID.
76+
@return: The version ID.
7777
"""
7878
return self._version_id
7979

@@ -88,7 +88,7 @@ def modified_timestamp(self) -> datetime.datetime:
8888
"""
8989
Get the time when the record was last modified.
9090
91-
:return: The last modification timestamp.
91+
@return: The last modification timestamp.
9292
"""
9393
return self._modified_timestamp
9494

@@ -97,15 +97,15 @@ def modifications_count(self) -> int:
9797
Get the number of modifications to the record since it was last created.
9898
If the record gets deleted and recreated, the ModificationsCount will restart at 0.
9999
100-
:return: The number of modifications.
100+
@return: The number of modifications.
101101
"""
102102
return self._modifications_count
103103

104104
def is_ephemeral(self) -> bool:
105105
"""
106106
Check if the record is ephemeral.
107107
108-
:return: True if the record is ephemeral, False otherwise.
108+
@return: True if the record is ephemeral, False otherwise.
109109
"""
110110
return self._session_id is not None
111111

@@ -115,7 +115,7 @@ def session_id(self) -> int:
115115
For ephemeral records, this is the identifier of the session to which this record lifecycle
116116
is attached to. Non-ephemeral records will always report 0.
117117
118-
:return: The session ID.
118+
@return: The session ID.
119119
"""
120120
return self._session_id
121121

@@ -125,7 +125,7 @@ def client_identity(self) -> str:
125125
For ephemeral records, this is the unique identity of the Oxia client that did last modify it.
126126
It will be empty for all non-ephemeral records.
127127
128-
:return: The client identity.
128+
@return: The client identity.
129129
"""
130130
return self._client_identity
131131

@@ -162,11 +162,11 @@ def __init__(self, service_address: str,
162162
and connection pooling. The constructor is responsible for setting up the required
163163
infrastructure to communicate with the service discovery system and maintain sessions.
164164
165-
:param service_address: The Oxia service address to connect to.
166-
:param namespace: The namespace to which this client belongs. Default is "default".
167-
:param session_timeout_ms: Duration of the session timeout in milliseconds. Default is 30,000 ms.
168-
:param client_identifier: A unique identifier for the client. If None, a default identifier will
169-
be generated internally.
165+
@param service_address: The Oxia service address to connect to.
166+
@param namespace: The namespace to which this client belongs. Default is "default".
167+
@param session_timeout_ms: Duration of the session timeout in milliseconds. Default is 30,000 ms.
168+
@param client_identifier: A unique identifier for the client. If None, a default identifier will
169+
be generated internally.
170170
"""
171171
self._closed = False
172172
self._connections = ConnectionPool()
@@ -189,18 +189,18 @@ def put(self, key: str, value: object,
189189
- Client can assert that the record does not exist by passing [oxia.EXPECTED_RECORD_DOES_NOT_EXIST]
190190
- Client can create an ephemeral record with `ephemeral=True`
191191
192-
:param key: the key to associate with the value
193-
:param value: the value to associate with the key
194-
:type value: str | bytes
195-
:param sequence_keys_deltas: a list of sequence keys to be used as deltas for the key. Oxia will create
196-
new unique keys atomically adding the sequence key deltas to the key.
197-
:param secondary_indexes: a dictionary of secondary indexes to be created for the record.
198-
:param partition_key: the partition key to use (instead of the actual record key)
199-
:param expected_version_id: the expected version id of the record to insert. If not specified, the put operation is not conditional.
200-
:param ephemeral: whether the record should be created as ephemeral. Ephemeral records are deleted when the session expires.
201-
:return: (actual_key, version)
202-
:raises oxia.ex.InvalidOptions: if the sequence_keys_deltas option is used with partition_key
203-
:raises oxia.ex.UnexpectedVersionId: if the expected version id does not match the current version id of the record
192+
@param key: the key to associate with the value
193+
@param value: the value to associate with the key
194+
@type value: str | bytes
195+
@param sequence_keys_deltas: a list of sequence keys to be used as deltas for the key. Oxia will create
196+
new unique keys atomically adding the sequence key deltas to the key.
197+
@param secondary_indexes: a dictionary of secondary indexes to be created for the record.
198+
@param partition_key: the partition key to use (instead of the actual record key)
199+
@param expected_version_id: the expected version id of the record to insert. If not specified, the put operation is not conditional.
200+
@param ephemeral: whether the record should be created as ephemeral. Ephemeral records are deleted when the session expires.
201+
@return: (actual_key, version)
202+
@raises oxia.ex.InvalidOptions: if the sequence_keys_deltas option is used with partition_key
203+
@raises oxia.ex.UnexpectedVersionId: if the expected version id does not match the current version id of the record
204204
"""
205205
shard, stub = self._service_discovery.get_leader(key, partition_key)
206206

@@ -247,12 +247,12 @@ def delete(self, key: str,
247247
The delete operation can be made conditional on that the record hasn't changed from
248248
a specific existing version by passing the [ExpectedVersionId] option.
249249
250-
:param key: the key to delete
251-
:param partition_key: the partition key to use (instead of the actual record key)
252-
:param expected_version_id: the expected version id of the record to delete. If not specified, the delete operation is not conditional.
253-
:return: true if the record was deleted, false otherwise
254-
:raises oxia.ex.KeyNotFound: if the record does not exist
255-
:raises oxia.ex.UnexpectedVersionId: if the expected version id does not match the current version id of the record
250+
@param key: the key to delete
251+
@param partition_key: the partition key to use (instead of the actual record key)
252+
@param expected_version_id: the expected version id of the record to delete. If not specified, the delete operation is not conditional.
253+
@return: true if the record was deleted, false otherwise
254+
@raises oxia.ex.KeyNotFound: if the record does not exist
255+
@raises oxia.ex.UnexpectedVersionId: if the expected version id does not match the current version id of the record
256256
"""
257257
shard, stub = self._service_discovery.get_leader(key, partition_key)
258258

@@ -275,9 +275,9 @@ def delete_range(self, min_key_inclusive: str, max_key_exclusive: str, partitio
275275
Refer to this documentation for the specifics:
276276
https://oxia-db.github.io/docs/features/oxia-key-sorting
277277
278-
:param min_key_inclusive: the minimum key to delete from
279-
:param max_key_exclusive: the maximum key to delete to (exclusive)
280-
:param partition_key: if set, the delete range will be applied to the shard with the specified partition key.
278+
@param min_key_inclusive: the minimum key to delete from
279+
@param max_key_exclusive: the maximum key to delete to (exclusive)
280+
@param partition_key: if set, the delete range will be applied to the shard with the specified partition key.
281281
"""
282282

283283
if partition_key is None:
@@ -307,13 +307,13 @@ def get(self, key: str,
307307
308308
In addition to the value, a version object is also returned, with information about the record state.
309309
310-
:param key: the key to retrieve
311-
:param partition_key: the partition key to use (instead of the actual record key)
312-
:param comparison_type: the comparison type to use
313-
:param include_value: whether to include the value in the result
314-
:param use_index: the name of the secondary index to use
315-
:return: (key, value, version)
316-
:raises oxia.ex.KeyNotFound: if the record does not exist
310+
@param key: the key to retrieve
311+
@param partition_key: the partition key to use (instead of the actual record key)
312+
@param comparison_type: the comparison type to use
313+
@param include_value: whether to include the value in the result
314+
@param use_index: the name of the secondary index to use
315+
@return: (key, value, version)
316+
@raises oxia.ex.KeyNotFound: if the record does not exist
317317
"""
318318
if partition_key is None and \
319319
(comparison_type != ComparisonType.EQUAL
@@ -370,11 +370,11 @@ def list(self, min_key_inclusive: str, max_key_exclusive: str,
370370
Refer to this documentation for the specifics:
371371
https://oxia-db.github.io/docs/features/oxia-key-sorting
372372
373-
:param min_key_inclusive: the minimum key to list from (inclusive).
374-
:param max_key_exclusive: the maximum key to list to (exclusive).
375-
:param partition_key: if set, the list will be applied to the shard with the specified partition key.
376-
:param use_index: if set, the list will be applied to the secondary index with the specified name.
377-
:return: the list of keys within the specified range.
373+
@param min_key_inclusive: the minimum key to list from (inclusive).
374+
@param max_key_exclusive: the maximum key to list to (exclusive).
375+
@param partition_key: if set, the list will be applied to the shard with the specified partition key.
376+
@param use_index: if set, the list will be applied to the secondary index with the specified name.
377+
@return: the list of keys within the specified range.
378378
"""
379379
if partition_key is None:
380380
all_res = []
@@ -411,11 +411,11 @@ def range_scan(self,
411411
Refer to this documentation for the specifics:
412412
https://oxia-db.github.io/docs/features/oxia-key-sorting
413413
414-
:param min_key_inclusive: the minimum key to list from (inclusive).
415-
:param max_key_exclusive: the maximum key to list to (exclusive).
416-
:param partition_key: if set, the range-scan will be applied to the shard with the specified partition key.
417-
:param use_index: if set, the range-scan will be applied to the secondary index with the specified name.
418-
:return: an iterator over the records within the specified range. Each record is a tuple of (key, value, version).
414+
@param min_key_inclusive: the minimum key to list from (inclusive).
415+
@param max_key_exclusive: the maximum key to list to (exclusive).
416+
@param partition_key: if set, the range-scan will be applied to the shard with the specified partition key.
417+
@param use_index: if set, the range-scan will be applied to the secondary index with the specified name.
418+
@return: an iterator over the records within the specified range. Each record is a tuple of (key, value, version).
419419
"""
420420
if partition_key is None:
421421
its = []
@@ -444,9 +444,9 @@ def get_sequence_updates(self, prefix_key: str, partition_key: str = None) -> Se
444444
445445
Multiple updates can be collapsed into one single event with the highest sequence.
446446
447-
:param prefix_key: the prefix for the sequential key.
448-
:param partition_key: the partition key to use (this is required)
449-
:return: a SequenceUpdates object that can be used to iterate over the updates. Should be closed when done.
447+
@param prefix_key: the prefix for the sequential key.
448+
@param partition_key: the partition key to use (this is required)
449+
@return: a SequenceUpdates object that can be used to iterate over the updates. Should be closed when done.
450450
"""
451451
if partition_key is None:
452452
raise oxia.ex.InvalidOptions("get_sequence_updates requires a partition_key")
@@ -457,8 +457,8 @@ def get_notifications(self) -> Iterator[oxia.defs.Notification]:
457457
Creates a new subscription to receive the notifications
458458
from Oxia for any change that is applied to the database
459459
460-
:return: an iterator over the notifications. Each notification is a Notification object.
461-
:rtype: Iterator[oxia.Notification]
460+
@return: an iterator over the notifications. Each notification is a Notification object.
461+
@rtype: Iterator[oxia.Notification]
462462
"""
463463
return Notifications(self._service_discovery)
464464

src/oxia/defs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from enum import Enum, IntEnum
16-
from oxia.internal.proto.io.streamnative.oxia import proto as pb
15+
from enum import Enum
1716

1817
class NotificationType(Enum):
1918
"""NotificationType represents the type of the notification event."""

0 commit comments

Comments
 (0)