Skip to content

Commit 97c72f3

Browse files
github-actions[bot]quentin-quix
andauthored
Update documentation (#488)
Co-authored-by: quentin-quix <171557156+quentin-quix@users.noreply.github.com>
1 parent b4180e1 commit 97c72f3

File tree

6 files changed

+725
-134
lines changed

6 files changed

+725
-134
lines changed

docs/api-reference/application.md

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class Application()
1111
```
1212

13-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L61)
13+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L63)
1414

1515
The main Application class.
1616

@@ -74,7 +74,7 @@ def __init__(broker_address: Optional[Union[str, ConnectionConfig]] = None,
7474
on_message_processed: Optional[MessageProcessedCallback] = None,
7575
consumer_poll_timeout: float = 1.0,
7676
producer_poll_timeout: float = 0.0,
77-
loglevel: Optional[LogLevel] = "INFO",
77+
loglevel: Optional[Union[int, LogLevel]] = "INFO",
7878
auto_create_topics: bool = True,
7979
use_changelog_topics: bool = True,
8080
quix_config_builder: Optional[QuixKafkaConfigsBuilder] = None,
@@ -84,7 +84,7 @@ def __init__(broker_address: Optional[Union[str, ConnectionConfig]] = None,
8484
processing_guarantee: ProcessingGuarantee = "at-least-once")
8585
```
8686

87-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L99)
87+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L101)
8888

8989

9090
<br>
@@ -184,7 +184,7 @@ def Quix(
184184
on_message_processed: Optional[MessageProcessedCallback] = None,
185185
consumer_poll_timeout: float = 1.0,
186186
producer_poll_timeout: float = 0.0,
187-
loglevel: Optional[LogLevel] = "INFO",
187+
loglevel: Optional[Union[int, LogLevel]] = "INFO",
188188
quix_config_builder: Optional[QuixKafkaConfigsBuilder] = None,
189189
auto_create_topics: bool = True,
190190
use_changelog_topics: bool = True,
@@ -196,7 +196,7 @@ def Quix(
196196
) -> Self
197197
```
198198

199-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L353)
199+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L350)
200200

201201
>***NOTE:*** DEPRECATED: use Application with `quix_sdk_token` argument instead.
202202

@@ -307,7 +307,7 @@ def topic(name: str,
307307
timestamp_extractor: Optional[TimestampExtractor] = None) -> Topic
308308
```
309309

310-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L494)
310+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L491)
311311

312312
Create a topic definition.
313313

@@ -385,10 +385,11 @@ topic = app.topic("input-topic", timestamp_extractor=custom_ts_extractor)
385385
#### Application.dataframe
386386

387387
```python
388-
def dataframe(topic: Topic) -> StreamingDataFrame
388+
def dataframe(topic: Optional[Topic] = None,
389+
source: Optional[BaseSource] = None) -> StreamingDataFrame
389390
```
390391

391-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L574)
392+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L571)
392393

393394
A simple helper method that generates a `StreamingDataFrame`, which is used
394395

@@ -438,7 +439,7 @@ to be used as an input topic.
438439
def stop(fail: bool = False)
439440
```
440441

441-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L613)
442+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L617)
442443

443444
Stop the internal poll loop and the message processing.
444445

@@ -465,7 +466,7 @@ to unhandled exception, and it shouldn't commit the current checkpoint.
465466
def get_producer() -> Producer
466467
```
467468

468-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L636)
469+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L662)
469470

470471
Create and return a pre-configured Producer instance.
471472
The Producer is initialized with params passed to Application.
@@ -500,7 +501,7 @@ with app.get_producer() as producer:
500501
def get_consumer(auto_commit_enable: bool = True) -> Consumer
501502
```
502503

503-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L666)
504+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L692)
504505

505506
Create and return a pre-configured Consumer instance.
506507
The Consumer is initialized with params passed to Application.
@@ -549,10 +550,34 @@ with app.get_consumer() as consumer:
549550
def clear_state()
550551
```
551552

552-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L713)
553+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L739)
553554

554555
Clear the state of the application.
555556

557+
<a id="quixstreams.app.Application.add_source"></a>
558+
559+
<br><br>
560+
561+
#### Application.add\_source
562+
563+
```python
564+
def add_source(source: BaseSource, topic: Optional[Topic] = None) -> Topic
565+
```
566+
567+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L745)
568+
569+
Add a source to the application.
570+
571+
See :class:`quixstreams.sources.base.BaseSource` for more details.
572+
573+
574+
<br>
575+
***Arguments:***
576+
577+
- `source`: a :class:`quixstreams.sources.BaseSource` instance
578+
- `topic`: the :class:`quixstreams.models.Topic` instance the source will produce to
579+
Default: the source default
580+
556581
<a id="quixstreams.app.Application.run"></a>
557582

558583
<br><br>
@@ -563,7 +588,7 @@ Clear the state of the application.
563588
def run(dataframe: StreamingDataFrame)
564589
```
565590

566-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L719)
591+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L764)
567592

568593
Start processing data from Kafka using provided `StreamingDataFrame`
569594

@@ -603,7 +628,7 @@ app.run(dataframe=df)
603628
class ApplicationConfig(BaseSettings)
604629
```
605630

606-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L975)
631+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L1049)
607632

608633
Immutable object holding the application configuration
609634

@@ -626,7 +651,7 @@ def settings_customise_sources(
626651
) -> Tuple[PydanticBaseSettingsSource, ...]
627652
```
628653

629-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L1009)
654+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L1083)
630655

631656
Included to ignore reading/setting values from the environment
632657

@@ -640,7 +665,7 @@ Included to ignore reading/setting values from the environment
640665
def copy(**kwargs) -> Self
641666
```
642667

643-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L1022)
668+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/app.py#L1096)
644669

645670
Update the application config and return a copy
646671

docs/api-reference/dataframe.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class StreamingDataFrame(BaseStreaming)
1111
```
1212

13-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L86)
13+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L87)
1414

1515
`StreamingDataFrame` is the main object you will use for ETL work.
1616

@@ -82,7 +82,7 @@ def apply(func: Union[
8282
metadata: bool = False) -> Self
8383
```
8484

85-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L203)
85+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L204)
8686

8787
Apply a function to transform the value and return a new value.
8888

@@ -141,7 +141,7 @@ def update(func: Union[
141141
metadata: bool = False) -> Self
142142
```
143143

144-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L293)
144+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L294)
145145

146146
Apply a function to mutate value in-place or to perform a side effect
147147

@@ -210,7 +210,7 @@ def filter(func: Union[
210210
metadata: bool = False) -> Self
211211
```
212212

213-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L386)
213+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L387)
214214

215215
Filter value using provided function.
216216

@@ -263,7 +263,7 @@ def group_by(key: Union[str, Callable[[Any], Any]],
263263
key_serializer: Optional[SerializerType] = "json") -> Self
264264
```
265265

266-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L473)
266+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L474)
267267

268268
"Groups" messages by re-keying them via the provided group_by operation
269269

@@ -328,7 +328,7 @@ a clone with this operation added (assign to keep its effect).
328328
def contains(key: str) -> StreamingSeries
329329
```
330330

331-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L551)
331+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L552)
332332

333333
Check if the key is present in the Row value.
334334

@@ -368,7 +368,7 @@ or False otherwise.
368368
def to_topic(topic: Topic, key: Optional[Callable[[Any], Any]] = None) -> Self
369369
```
370370

371-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L577)
371+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L578)
372372

373373
Produce current value to a topic. You can optionally specify a new key.
374374

@@ -422,7 +422,7 @@ the updated StreamingDataFrame instance (reassignment NOT required).
422422
def set_timestamp(func: Callable[[Any, Any, int, Any], int]) -> Self
423423
```
424424

425-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L623)
425+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L624)
426426

427427
Set a new timestamp based on the current message value and its metadata.
428428

@@ -476,7 +476,7 @@ def set_headers(
476476
) -> Self
477477
```
478478

479-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L665)
479+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L666)
480480

481481
Set new message headers based on the current message value and metadata.
482482

@@ -526,7 +526,7 @@ a new StreamingDataFrame instance
526526
def print(pretty: bool = True, metadata: bool = False) -> Self
527527
```
528528

529-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L717)
529+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L718)
530530

531531
Print out the current message value (and optionally, the message metadata) to
532532

@@ -582,7 +582,7 @@ def compose(
582582
) -> Dict[str, VoidExecutor]
583583
```
584584

585-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L759)
585+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L760)
586586

587587
Compose all functions of this StreamingDataFrame into one big closure.
588588

@@ -636,7 +636,7 @@ def test(value: Any,
636636
topic: Optional[Topic] = None) -> List[Any]
637637
```
638638

639-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L796)
639+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L797)
640640

641641
A shorthand to test `StreamingDataFrame` with provided value
642642

@@ -674,7 +674,7 @@ def tumbling_window(duration_ms: Union[int, timedelta],
674674
name: Optional[str] = None) -> TumblingWindowDefinition
675675
```
676676

677-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L834)
677+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L835)
678678

679679
Create a tumbling window transformation on this StreamingDataFrame.
680680

@@ -761,7 +761,7 @@ def hopping_window(duration_ms: Union[int, timedelta],
761761
name: Optional[str] = None) -> HoppingWindowDefinition
762762
```
763763

764-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L911)
764+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L912)
765765

766766
Create a hopping window transformation on this StreamingDataFrame.
767767

@@ -855,7 +855,7 @@ def drop(columns: Union[str, List[str]],
855855
errors: Literal["ignore", "raise"] = "raise") -> Self
856856
```
857857

858-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L1004)
858+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L1005)
859859

860860
Drop column(s) from the message value (value must support `del`, like a dict).
861861

@@ -900,7 +900,7 @@ a new StreamingDataFrame instance
900900
def sink(sink: BaseSink)
901901
```
902902

903-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L1049)
903+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/dataframe/dataframe.py#L1050)
904904

905905
Sink the processed data to the specified destination.
906906

0 commit comments

Comments
 (0)