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 16:32:56 UTC
[incubator-streampipes] 01/10: [STREAMPIPES-607] finalize Python setup
This is an automated email from the ASF dual-hosted git repository.
bossenti pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 05cb33188f836cd0bd47b500a2968a4ba0107490
Author: bossenti <bo...@posteo.de>
AuthorDate: Sun Nov 13 13:59:37 2022 +0100
[STREAMPIPES-607] finalize Python setup
---
streampipes-client-python/.coveragerc | 7 ++++
streampipes-client-python/.gitignore | 3 +-
streampipes-client-python/.pre-commit-config.yaml | 43 ++++++++++++----------
streampipes-client-python/Makefile | 28 ++++++++++++--
streampipes-client-python/setup.py | 16 +++++---
.../streampipes_client/__version__.py | 5 ++-
6 files changed, 71 insertions(+), 31 deletions(-)
diff --git a/streampipes-client-python/.coveragerc b/streampipes-client-python/.coveragerc
new file mode 100644
index 000000000..f424661f2
--- /dev/null
+++ b/streampipes-client-python/.coveragerc
@@ -0,0 +1,7 @@
+[run]
+omit = test/* \
+ *\__*__.py
+
+[report]
+skip_empty = true
+skip_covered = true
\ No newline at end of file
diff --git a/streampipes-client-python/.gitignore b/streampipes-client-python/.gitignore
index 0cd13ceab..964ce71cc 100644
--- a/streampipes-client-python/.gitignore
+++ b/streampipes-client-python/.gitignore
@@ -186,7 +186,6 @@ cover/
.pybuilder/
target/
-# Jupyter Notebook
# IPython
@@ -216,6 +215,8 @@ venv/
ENV/
env.bak/
venv.bak/
+build/
+Scripts/
# Spyder project settings
.spyderproject
diff --git a/streampipes-client-python/.pre-commit-config.yaml b/streampipes-client-python/.pre-commit-config.yaml
index 1eccb226e..d1538f1ee 100644
--- a/streampipes-client-python/.pre-commit-config.yaml
+++ b/streampipes-client-python/.pre-commit-config.yaml
@@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
-files: streampipes_client, tests
+files: streampipes_client/|tests/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
@@ -28,32 +27,36 @@ repos:
- repo: local
hooks:
- - id: black
- name: black
+ - id: pyupgrade
+ name: pyupgrade
language: python
- types: [python]
- entry: black
+ types: [ python ]
+ entry: pyupgrade --py38 --keep-runtime-typing
- - id: isort
- name: isort
+ - id: autoflake
+ name: autoflake
language: python
- types: [python]
- entry: isort
+ types: [ python ]
+ entry: autoflake --remove-all-unused-imports --expand-star-imports --in-place
- - id: flake8
- name: flake8
+ - id: isort
+ name: isort
language: python
- types: [python]
- entry: flake8
+ types: [ python ]
+ entry: isort --profile black
+ verbose: true
- - id: mypy
- name: mypy
+ - id: black
+ name: black
language: python
types: [python]
- entry: mypy
+ entry: black --line-length=120
+ require_serial: true
- - id: pyupgrade
- name: pyupgrade
+ - id: isort
+ name: isort
language: python
types: [python]
- entry: pyupgrade --py38-plus
\ No newline at end of file
+ entry: isort --profile black
+ require_serial: true
+ verbose: true
\ No newline at end of file
diff --git a/streampipes-client-python/Makefile b/streampipes-client-python/Makefile
index 309ad627f..11d27cfad 100644
--- a/streampipes-client-python/Makefile
+++ b/streampipes-client-python/Makefile
@@ -17,14 +17,36 @@
COMMIT_HASH := $(shell eval git rev-parse HEAD)
-format:
- pre-commit run --all-files
+.PHONY: check
+check: mypy lint unit-tests
+.PHONY: doc
doc:
mkdocs build
+.PHONY: lint
+lint:
+ flake8 streampipes_client --max-line-length 120
+
+.PHONY: doc
livedoc: doc
mkdocs serve --dirtyreload
+.PHONY: mypy
+mypy:
+ mypy streampipes_client --warn-unused-ignores --warn-redundant-casts --pretty
+
+.PHONY: rebase
rebase:
- git fetch && git rebase origin/dev
\ No newline at end of file
+ git fetch && git rebase origin/dev
+
+.PHONY: reformat-all
+reformat-all:
+ pyupgrade --py38 --keep-runtime-typing
+ autoflake -r --remove-all-unused-imports --expand-star-imports --in-place streampipes_client tests
+ isort --profile black streampipes_client tests
+ black --line-length=120 streampipes_client tests
+
+.PHONY: unit-tests
+unit-tests:
+ pytest --cov=streampipes_client tests/ --cov-fail-under=90 --cov-report term-missing --no-cov-on-fail
diff --git a/streampipes-client-python/setup.py b/streampipes-client-python/setup.py
index 4c1a74fff..f36a88fda 100644
--- a/streampipes-client-python/setup.py
+++ b/streampipes-client-python/setup.py
@@ -31,19 +31,26 @@ REQUIRES_PYTHON = ">=3.8.0"
# Package requirements.
base_packages = [
+ "pandas>=1.5.1",
+ "pydantic>=1.10.2",
+ "requests>=2.28.1",
]
dev_packages = base_packages + [
+ "autoflake>=1.7.7",
+ "black>=22.10.0",
+ "flake8>=5.0.4",
+ "isort>=5.10.1",
"mypy>=0.990",
+ "pandas-stubs>=1.5.1.221024",
"pre-commit>=2.20.0",
"pytest>=7.2.0",
"pytest-cov>=4.0.0",
- "black>=22.10.0",
- "flake8>=5.0.4",
- "isort>=5.10.1",
+ "pyupgrade>=3.2.2",
+ "types-requests>=2.28.11.4",
]
-docs_packages = [ #todo Cedric check versions
+docs_packages = [
"mkdocs>=1.2.3",
"mkdocs-material>=8.1.11",
"mkdocstrings[python]>=0.19.0",
@@ -79,7 +86,6 @@ setuptools.setup(
"test": dev_packages,
"docs": docs_packages,
"all": dev_packages + docs_packages,
- ":python_version == '3.8'": ["dataclasses"], # todo check if required
},
include_package_data=True,
license="Apache License 2.0",
diff --git a/streampipes-client-python/streampipes_client/__version__.py b/streampipes-client-python/streampipes_client/__version__.py
index 3496c1813..7eef49c16 100644
--- a/streampipes-client-python/streampipes_client/__version__.py
+++ b/streampipes-client-python/streampipes_client/__version__.py
@@ -14,7 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+#
-VERSION = (0, 0, 1)
+VERSION = (0, 71, 0) # pragma: no cover
-__version__ = ".".join(map(str, VERSION)) # noqa: F401
+__version__ = ".".join(map(str, VERSION)) # noqa: F401 # pragma: no cover