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/17 19:35:52 UTC

[streampipes] branch rel/0.91.0 updated: chore: improve python docs and fix some minor inconsistencies (#1251)

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

bossenti pushed a commit to branch rel/0.91.0
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/rel/0.91.0 by this push:
     new be1468f13 chore: improve python docs and fix some minor inconsistencies (#1251)
be1468f13 is described below

commit be1468f13732edc9271b441997291b6077312c28
Author: Tim <50...@users.noreply.github.com>
AuthorDate: Tue Feb 14 21:42:20 2023 +0100

    chore: improve python docs and fix some minor inconsistencies (#1251)
    
    * chore: improve python docs and fix some minor inconsistencies
    
    Signed-off-by: bossenti <bo...@posteo.de>
    
    * chore: add missing example to docs
    
    Signed-off-by: bossenti <bo...@posteo.de>
    
    ---------
    
    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            | 56 ++++++++----------
 streampipes-client-python/mkdocs.yml               |  3 +-
 6 files changed, 52 insertions(+), 89 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..e0600c9cf 100644
--- a/streampipes-client-python/docs/index.md
+++ b/streampipes-client-python/docs/index.md
@@ -26,9 +26,9 @@
 <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.
+<p align="center"> Apache StreamPipes meets Python! We are working highly motivated on a Python library 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,
 and the amazing universe of data analytics libraries in Python. </p>
 
@@ -36,7 +36,7 @@ and the amazing universe of data analytics libraries in Python. </p>
 
 <br>
 
-**💡 The current version of this Python client is still a beta version.**
+**💡 The current version of this Python library is still a beta version.**
 <br>
 **This means that it is still heavily under development, which may result in frequent and extensive API changes, unstable behavior, etc.**
 <br>
@@ -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")
 ```
diff --git a/streampipes-client-python/mkdocs.yml b/streampipes-client-python/mkdocs.yml
index f3939e6de..edc04206a 100644
--- a/streampipes-client-python/mkdocs.yml
+++ b/streampipes-client-python/mkdocs.yml
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-site_name: Apache StreamPipes Python Client
+site_name: Apache StreamPipes for Python
 repo_url: https://github.com/apache/streampipes
 edit_uri: "https://github.com/apache/streampipes"
 
@@ -84,4 +84,5 @@ nav:
         - Introduction to the StreamPipes Python Client: examples/1-introduction-to-streampipes-python-client.ipynb
         - Extracting Data from the StreamPipes Data Lake: examples/2-extracting-data-from-the-streampipes-data-lake.ipynb
         - Exploring Live Data from a StreamPipes Data Stream: examples/3-getting-live-data-from-the-streampipes-data-stream.ipynb
+        - Applying Online Machine Learning on a StreamPipes Data Stream: examples/4-using-online-machine-learning-on-a-streampipes-data-stream.ipynb
     - Reference: reference/*