You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2023/02/11 10:51:42 UTC

[streampipes] 01/01: chore: improve python docs and fix some minor inconsistencies

This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch chore/improve-python-docs
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 5e09109d45807b21b1f301e6085d3dc60427ceda
Author: bossenti <bo...@posteo.de>
AuthorDate: Sat Feb 11 11:51:09 2023 +0100

    chore: improve python docs and fix some minor inconsistencies
    
    Signed-off-by: bossenti <bo...@posteo.de>
---
 streampipes-client-python/README.md                | 10 ++--
 ...ive-data-from-the-streampipes-data-stream.ipynb |  4 +-
 ...ine-learning-on-a-streampipes-data-stream.ipynb |  2 +-
 .../docs/getting-started/quickstart.md             | 66 +++++++---------------
 streampipes-client-python/docs/index.md            | 52 +++++++----------
 5 files changed, 48 insertions(+), 86 deletions(-)

diff --git a/streampipes-client-python/README.md b/streampipes-client-python/README.md
index eef32abd8..67e94aaae 100644
--- a/streampipes-client-python/README.md
+++ b/streampipes-client-python/README.md
@@ -47,16 +47,16 @@ As a quick example, we demonstrate how to set up and configure a StreamPipes cli
 
 You can simply install the StreamPipes library by running the following command
 ```bash
-%pip install streampipes
+pip install streampipes
 
 # if you want to have the current development state you can also execute
-%pip install git+https://github.com/apache/streampipes.git#subdirectory=streampipes-client-python
+pip install git+https://github.com/apache/streampipes.git#subdirectory=streampipes-client-python
 ```
 
 ```python
->> > from streampipes.client import StreamPipesClient
->> > from streampipes.client.client_config import StreamPipesClientConfig
->> > from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
+>>> from streampipes.client import StreamPipesClient
+>>> from streampipes.client.config import StreamPipesClientConfig
+>>> from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
 
 >>> config = StreamPipesClientConfig(
 ...     credential_provider = StreamPipesApiKeyCredentials(
diff --git a/streampipes-client-python/docs/examples/3-getting-live-data-from-the-streampipes-data-stream.ipynb b/streampipes-client-python/docs/examples/3-getting-live-data-from-the-streampipes-data-stream.ipynb
index c05162df5..b8eeb0d6b 100644
--- a/streampipes-client-python/docs/examples/3-getting-live-data-from-the-streampipes-data-stream.ipynb
+++ b/streampipes-client-python/docs/examples/3-getting-live-data-from-the-streampipes-data-stream.ipynb
@@ -6,7 +6,7 @@
    "metadata": {},
    "source": [
     "# Getting live data from the StreamPipes data stream\n",
-    "In the last example ([Extracting Data from the StreamPipes data lake]()) we learned how to extract the stored data from a StreamPipes data lake. This tutorial is about the StreamPipes data stream and shows how to get the live data from a stream. Therefore we first create the `client` instance as before."
+    "In the last example ([Extracting Data from the StreamPipes data lake]()) we learned how to extract the stored data from a StreamPipes data lake. This tutorial is about the StreamPipes data stream and shows how to get the live data from a stream. Therefore, we first create the `client` instance as before."
    ]
   },
   {
@@ -15,7 +15,7 @@
    "metadata": {},
    "source": [
     "**Note**  \n",
-    "At the moment the python client only supports NATS as messaging protocol, so make sure to use the `docker-compose.nats.yml` file when starting StreamPipes. You also have to insert the port mapping to this file when working locally:\n",
+    "At the moment we only supports NATS as messaging protocol when working with StreamPipes Functions, so make sure to use the `docker-compose.nats.yml` file when starting StreamPipes. You also have to insert the port mapping to this file when working locally:\n",
     "```\n",
     "nats:\n",
     "    ...\n",
diff --git a/streampipes-client-python/docs/examples/4-using-online-machine-learning-on-a-streampipes-data-stream.ipynb b/streampipes-client-python/docs/examples/4-using-online-machine-learning-on-a-streampipes-data-stream.ipynb
index c2de994a9..bd546f17e 100644
--- a/streampipes-client-python/docs/examples/4-using-online-machine-learning-on-a-streampipes-data-stream.ipynb
+++ b/streampipes-client-python/docs/examples/4-using-online-machine-learning-on-a-streampipes-data-stream.ipynb
@@ -6,7 +6,7 @@
    "metadata": {},
    "source": [
     "# Using Online Machine Learning on a StreamPipes data stream\n",
-    "The last example ([Getting live data from the StreamPipes data stream]()) showed how we can connect to a data stream and it would be possible to use Online Machine Learning with this approach and train a model with the incoming events at the `onEvent` method. However the StreamPipes client also provides an easier way to do this with the use of the River library for Online Machine Learning. We will have a look at this now."
+    "The last example ([Getting live data from the StreamPipes data stream]()) showed how we can connect to a data stream, and it would be possible to use Online Machine Learning with this approach and train a model with the incoming events at the `onEvent` method. However, the StreamPipes client also provides an easier way to do this with the use of the River library for Online Machine Learning. We will have a look at this now."
    ]
   },
   {
diff --git a/streampipes-client-python/docs/getting-started/quickstart.md b/streampipes-client-python/docs/getting-started/quickstart.md
index a7ab6dd82..29e4be51a 100644
--- a/streampipes-client-python/docs/getting-started/quickstart.md
+++ b/streampipes-client-python/docs/getting-started/quickstart.md
@@ -21,61 +21,35 @@
 As a quick example, we demonstrate how to set up and configure a StreamPipes client.
 
 ```python
->> > from streampipes.client import StreamPipesClient
->> > from streampipes.client.client_config import StreamPipesClientConfig
->> > from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
-
->> > config = StreamPipesClientConfig(
-    ...
-credential_provider = StreamPipesApiKeyCredentials(
-    ...
-username = "test@streampipes.apache.org",
-           ...
-api_key = "DEMO-KEY",
-          ...         ),
-...
-host_address = "localhost",
-               ...
-http_disabled = True,
-                ...
-port = 80
+>>> from streampipes.client import StreamPipesClient
+>>> from streampipes.client.config import StreamPipesClientConfig
+>>> from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
+
+>>> config = StreamPipesClientConfig(
+...     credential_provider = StreamPipesApiKeyCredentials(
+...         username = "test@streampipes.apache.org",
+...         api_key = "DEMO-KEY",
+...         ),
+...     host_address = "localhost",
+...     http_disabled = True,
+...     port = 80
 ...)
 
->> > client = StreamPipesClient(client_config=config)
->> > client.describe()
+>>> client = StreamPipesClient(client_config=config)
+>>> client.describe()
 
-Hi
-there!
-You
-are
-connected
-to
-a
-StreamPipes
-instance
-running
-at
-http: // localhost: 80.
-The
-following
-StreamPipes
-resources
-are
-available
-with this client:
-    6
-x
-DataStreams
-1
-x
-DataLakeMeasures
+Hi there!
+You are connected to a StreamPipes instance running at http://localhost: 80.
+The following StreamPipes resources are available with this client:
+6x DataStreams
+1x DataLakeMeasures
 ```
 <br>
 Alternatively, you can provide your credentials via environment variables.
 Simply define your credential provider as follows:
 
 ```python
->> > from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
+>>> from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
 
 StreamPipesApiKeyCredentials.from_env(username_env="USER", api_key_env="API-KEY")
 ```
diff --git a/streampipes-client-python/docs/index.md b/streampipes-client-python/docs/index.md
index 093db87bc..d0cf4d5af 100644
--- a/streampipes-client-python/docs/index.md
+++ b/streampipes-client-python/docs/index.md
@@ -26,7 +26,7 @@
 <h4 align="center"><a href="[StreamPipes](https://github.com/apache/streampipes)">StreamPipes</a> is a self-service (Industrial) IoT toolbox to enable non-technical users to connect , analyze and explore IoT data streams.</h4>
 
 <br>
-<h3 align="center">Apache StreamPipes client for Python</h3>
+<h3 align="center">Apache StreamPipes for Python</h3>
 
 <p align="center"> Apache StreamPipes meets Python! We are working highly motivated on a Python-based client to interact with StreamPipes.
 In this way, we would like to unite the power of StreamPipes to easily connect to and read different data sources, especially in the IoT domain,
@@ -47,45 +47,33 @@ As a quick example, we demonstrate how to set up and configure a StreamPipes cli
 In addition, we will get the available data lake measures out of StreamPipes.
 
 ```python
->> > from streampipes.client import StreamPipesClient
->> > from streampipes.client.client_config import StreamPipesClientConfig
->> > from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
-
->> > config = StreamPipesClientConfig(
-    ...
-credential_provider = StreamPipesApiKeyCredentials(
-    ...
-username = "test@streampipes.apache.org",
-           ...
-api_key = "DEMO-KEY",
-          ...         ),
-...
-host_address = "localhost",
-               ...
-http_disabled = True,
-                ...
-port = 80
+>>> from streampipes.client import StreamPipesClient
+>>> from streampipes.client.config import StreamPipesClientConfig
+>>> from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
+
+>>> config = StreamPipesClientConfig(
+...     credential_provider = StreamPipesApiKeyCredentials(
+...         username = "test@streampipes.apache.org",
+...         api_key = "DEMO-KEY",
+...         ),
+...     host_address = "localhost",
+...     http_disabled = True,
+...     port = 80
 ...)
 
->> > client = StreamPipesClient(client_config=config)
+>>> client = StreamPipesClient(client_config=config)
 
 # get all available datat lake measures
->> > measures = client.dataLakeMeasureApi.all()
+>>> measures = client.dataLakeMeasureApi.all()
 
 # get amount of retrieved measures
->> > len(measures)
+>>> len(measures)
 1
 
 # inspect the data lake measures as pandas dataframe
->> > measures.to_pandas()
-measure_name
-timestamp_field...pipeline_is_running
-num_event_properties
-0
-test
-s0::timestamp...
-False
-2
+>>> measures.to_pandas()
+measure_name timestamp_field ... pipeline_is_running num_event_properties
+0 test s0::timestamp ... False 2
 [1 rows x 6 columns]
 ```
 <br>
@@ -93,7 +81,7 @@ Alternatively, you can provide your credentials via environment variables.
 Simply define your credential provider as follows:
 
 ```python
->> > from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
+>>> from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
 
 StreamPipesApiKeyCredentials.from_env(username_env="USER", api_key_env="API-KEY")
 ```