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 2022/11/17 22:00:30 UTC

[incubator-streampipes] branch feature/STREAMPIPES-627 created (now 58aa62c06)

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

bossenti pushed a change to branch feature/STREAMPIPES-627
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


      at 58aa62c06 [STREAMPIPES-627] add docstring hooks

This branch includes the following new commits:

     new fcf63e578 [STREAMPIPES-627] add CI job for code style checks
     new 2e7be6975 [STREAMPIPES-627] add CI job for unit tests for supported python versions
     new 58aa62c06 [STREAMPIPES-627] add docstring hooks

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-streampipes] 01/03: [STREAMPIPES-627] add CI job for code style checks

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch feature/STREAMPIPES-627
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit fcf63e57847cd6322bf974322a6d1d8ff251eda6
Author: bossenti <bo...@posteo.de>
AuthorDate: Sun Nov 13 19:58:32 2022 +0100

    [STREAMPIPES-627] add CI job for code style checks
---
 .github/workflows/pr-validation.yml | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml
index 484fb2dad..71c21322f 100644
--- a/.github/workflows/pr-validation.yml
+++ b/.github/workflows/pr-validation.yml
@@ -77,3 +77,36 @@ jobs:
           wait-on-timeout: 120
           spec: cypress/tests/**/*.smoke.spec.ts
           working-directory: ui
+
+  python-quality-checks:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: 3.8
+
+      - name: Cache Python dependencies
+        uses: actions/cache@v2
+        with:
+          path: ~/.cache/pip
+          key: ${{ runner.os }}-pip${{ hashFiles('**/setup.py') }}
+          restore-keys: |
+            ${{ runner.os }}-pip-
+
+      - name: Install Python dependencies
+        run: |
+          cd ./streampipes-client-python
+          python -m pip install --upgrade pip
+          pip install wheel
+          pip install -e ".[dev]"
+
+      - name: Run style & code checks
+        run: |
+          cd ./streampipes-client-python
+          pre-commit run --files streampipes_client/*
+          pre-commit run --files tests/*
+          make mypy
+          make lint


[incubator-streampipes] 02/03: [STREAMPIPES-627] add CI job for unit tests for supported python versions

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch feature/STREAMPIPES-627
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 2e7be69753a5d7aed224d221814d183be35d7be7
Author: bossenti <bo...@posteo.de>
AuthorDate: Sun Nov 13 20:13:37 2022 +0100

    [STREAMPIPES-627] add CI job for unit tests for supported python versions
---
 .github/workflows/pr-validation.yml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml
index 71c21322f..325d47dba 100644
--- a/.github/workflows/pr-validation.yml
+++ b/.github/workflows/pr-validation.yml
@@ -110,3 +110,40 @@ jobs:
           pre-commit run --files tests/*
           make mypy
           make lint
+
+
+  python-unit-tests:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        python: [3.8, 3.9, "3.10"]
+        os: [ubuntu-latest, macos-latest]
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Set up Python v${{ matrix.python }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python }}
+
+      - name: Cache Python dependencies
+        uses: actions/cache@v2
+        with:
+          path: ~~.cache/pip
+          key: ${{ runner.os }}-${{ matrix.python }}-pip-${{ hashFiles('**/setup.py') }}
+          restore-keys: |
+            ${{ runner.os }}-${{ matrix.python }}-pip-
+
+      - name: Install Python dependencies
+        run: |
+          cd ./streampipes-client-python
+          python -m pip install --upgrade pip
+          pip install wheel
+          pip install -e ".[dev]"
+
+      - name: Run unit-tests
+        run: |
+          cd ./streampipes-client-python
+          make unit-tests
\ No newline at end of file


[incubator-streampipes] 03/03: [STREAMPIPES-627] add docstring hooks

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch feature/STREAMPIPES-627
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 58aa62c06f018b1841bade75c5ebcfd3cc613367
Author: bossenti <bo...@posteo.de>
AuthorDate: Sun Nov 13 21:05:42 2022 +0100

    [STREAMPIPES-627] add docstring hooks
---
 streampipes-client-python/.pre-commit-config.yaml          |  8 ++++++++
 streampipes-client-python/setup.py                         |  1 +
 .../streampipes_client/model/common.py                     |  6 ++++++
 .../model/container/resource_container.py                  | 14 ++++++++++++++
 4 files changed, 29 insertions(+)

diff --git a/streampipes-client-python/.pre-commit-config.yaml b/streampipes-client-python/.pre-commit-config.yaml
index 76b282994..d353a24d7 100644
--- a/streampipes-client-python/.pre-commit-config.yaml
+++ b/streampipes-client-python/.pre-commit-config.yaml
@@ -24,9 +24,17 @@ repos:
       - id: end-of-file-fixer
       - id: trailing-whitespace
       - id: mixed-line-ending
+      - id: check-docstring-first
+      - id: check-merge-conflict
 
   - repo: local
     hooks:
+      - id: interrogate
+        name: interrogate
+        language: python
+        types: [ python ]
+        entry:  interrogate -vv --fail-under 95 --omit-covered-files --ignore-init-method --ignore-module --ignore-magic
+
       - id: pyupgrade
         name: pyupgrade
         language: python
diff --git a/streampipes-client-python/setup.py b/streampipes-client-python/setup.py
index f36a88fda..ee1d50c28 100644
--- a/streampipes-client-python/setup.py
+++ b/streampipes-client-python/setup.py
@@ -40,6 +40,7 @@ dev_packages = base_packages + [
     "autoflake>=1.7.7",
     "black>=22.10.0",
     "flake8>=5.0.4",
+    "interrogate>=1.5.0",
     "isort>=5.10.1",
     "mypy>=0.990",
     "pandas-stubs>=1.5.1.221024",
diff --git a/streampipes-client-python/streampipes_client/model/common.py b/streampipes-client-python/streampipes_client/model/common.py
index c9eec9a18..dd1cd393d 100644
--- a/streampipes-client-python/streampipes_client/model/common.py
+++ b/streampipes-client-python/streampipes_client/model/common.py
@@ -38,9 +38,15 @@ def _snake_to_camel_case(snake_case_string: str) -> str:
 
 
 class BasicModel(BaseModel):
+    """Basic model class used for the whole Python StreamPipes data model."""
+
     element_id: Optional[StrictStr]
 
     class Config:
+        """Configuration class for Pydantic.
+        Defines alias generator to convert field names from camelCase (API) to snake_case (Python codebase).
+        """
+
         alias_generator = _snake_to_camel_case
 
 
diff --git a/streampipes-client-python/streampipes_client/model/container/resource_container.py b/streampipes-client-python/streampipes_client/model/container/resource_container.py
index 90bf2b109..0b16c430e 100644
--- a/streampipes-client-python/streampipes_client/model/container/resource_container.py
+++ b/streampipes-client-python/streampipes_client/model/container/resource_container.py
@@ -56,6 +56,13 @@ class StreamPipesDataModelError(Exception):
         super().__init__(self._generate_error_message())
 
     def _generate_error_message(self) -> str:
+        """Generate a specific error message for this exception.
+        Error message contains information derived from the specific `ValidationError`.
+
+        Returns
+        -------
+        The error description (`str`)
+        """
         return (
             f"\nOops, there seems to be a problem with our internal StreamPipes data model.\n"
             f"This should not occur, but unfortunately did.\n"
@@ -89,6 +96,13 @@ class StreamPipesResourceContainerJSONError(Exception):
         super().__init__(self._generate_error_message())
 
     def _generate_error_message(self) -> str:
+        """Generate a specific error message for this exception.
+        Error message contains information about the related container model and the causing JSON string.
+
+        Returns
+        -------
+        The error description (`str`)
+        """
         return (
             f"\nOops, there seems to be a problem when parsing the response of the StreamPipes API."
             f"This should not occur, but unfortunately did.\n"