keboola.component 1.6.13__tar.gz → 1.8.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {keboola.component-1.6.13 → keboola_component-1.8.2}/LICENSE +1 -1
- {keboola.component-1.6.13/src/keboola.component.egg-info → keboola_component-1.8.2}/PKG-INFO +19 -6
- keboola_component-1.8.2/pyproject.toml +53 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2/src/keboola.component.egg-info}/PKG-INFO +19 -6
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola.component.egg-info/SOURCES.txt +7 -3
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola.component.egg-info/requires.txt +1 -1
- keboola_component-1.8.2/tests/test_base.py +107 -0
- keboola_component-1.8.2/tests/test_dao.py +853 -0
- keboola_component-1.8.2/tests/test_interface.py +1052 -0
- keboola_component-1.8.2/tests/test_schema.py +118 -0
- keboola_component-1.8.2/tests/test_sync_actions.py +28 -0
- keboola.component-1.6.13/setup.py +0 -51
- keboola.component-1.6.13/src/keboola.component.egg-info/not-zip-safe +0 -1
- {keboola.component-1.6.13 → keboola_component-1.8.2}/README.md +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/setup.cfg +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola/component/__init__.py +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola/component/base.py +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola/component/dao.py +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola/component/exceptions.py +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola/component/interface.py +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola/component/sync_actions.py +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola/component/table_schema.py +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola.component.egg-info/dependency_links.txt +0 -0
- {keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola.component.egg-info/top_level.txt +0 -0
{keboola.component-1.6.13/src/keboola.component.egg-info → keboola_component-1.8.2}/PKG-INFO
RENAMED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: keboola.component
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.2
|
|
4
4
|
Summary: General library for Python applications running in Keboola Connection environment
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Author-email: support@keboola.com
|
|
5
|
+
Author-email: Keboola KDS Team <support@keboola.com>
|
|
6
|
+
License-Expression: MIT
|
|
8
7
|
Project-URL: Documentation, https://keboola.github.io/python-component/interface.html
|
|
8
|
+
Project-URL: Repository, https://github.com/keboola/python-component
|
|
9
9
|
Project-URL: Component Template project, https://github.com/keboola/cookiecutter-python-component
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier:
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
18
|
Classifier: Operating System :: OS Independent
|
|
13
19
|
Classifier: Intended Audience :: Developers
|
|
14
20
|
Classifier: Intended Audience :: Information Technology
|
|
@@ -19,7 +25,14 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
19
25
|
Requires-Python: >=3.8
|
|
20
26
|
Description-Content-Type: text/markdown
|
|
21
27
|
License-File: LICENSE
|
|
28
|
+
Requires-Dist: pygelf
|
|
29
|
+
Requires-Dist: pytz<2021.0
|
|
30
|
+
Requires-Dist: deprecated
|
|
31
|
+
Dynamic: license-file
|
|
22
32
|
|
|
33
|
+
# Keboola Python Component library
|
|
34
|
+
|
|
35
|
+
## Introduction
|
|
23
36
|
|
|
24
37
|

|
|
25
38
|
[](https://codeclimate.com/github/keboola/python-component)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "keboola.component"
|
|
3
|
+
version = "1.8.2" # replaced by the actual version based on the release tag in github actions
|
|
4
|
+
dependencies = [
|
|
5
|
+
"pygelf",
|
|
6
|
+
"pytz<2021.0",
|
|
7
|
+
"deprecated",
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Keboola KDS Team", email = "support@keboola.com" }
|
|
13
|
+
]
|
|
14
|
+
description = "General library for Python applications running in Keboola Connection environment"
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
license = "MIT"
|
|
17
|
+
license-files = [ "LICENSE" ]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.8",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"Intended Audience :: Information Technology",
|
|
30
|
+
"Intended Audience :: Education",
|
|
31
|
+
"Topic :: Software Development :: Libraries",
|
|
32
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
33
|
+
"Development Status :: 5 - Production/Stable",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Documentation = "https://keboola.github.io/python-component/interface.html"
|
|
38
|
+
Repository = "https://github.com/keboola/python-component"
|
|
39
|
+
"Component Template project" = "https://github.com/keboola/cookiecutter-python-component"
|
|
40
|
+
|
|
41
|
+
[dependency-groups]
|
|
42
|
+
dev = [
|
|
43
|
+
"flake8>=5.0.4",
|
|
44
|
+
"pytest>=8.3.5",
|
|
45
|
+
"ruff>=0.13.2",
|
|
46
|
+
"pdoc3",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[[tool.uv.index]]
|
|
50
|
+
name = "testpypi"
|
|
51
|
+
url = "https://test.pypi.org/simple/"
|
|
52
|
+
publish-url = "https://test.pypi.org/legacy/"
|
|
53
|
+
explicit = true
|
{keboola.component-1.6.13 → keboola_component-1.8.2/src/keboola.component.egg-info}/PKG-INFO
RENAMED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: keboola.component
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.2
|
|
4
4
|
Summary: General library for Python applications running in Keboola Connection environment
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Author-email: support@keboola.com
|
|
5
|
+
Author-email: Keboola KDS Team <support@keboola.com>
|
|
6
|
+
License-Expression: MIT
|
|
8
7
|
Project-URL: Documentation, https://keboola.github.io/python-component/interface.html
|
|
8
|
+
Project-URL: Repository, https://github.com/keboola/python-component
|
|
9
9
|
Project-URL: Component Template project, https://github.com/keboola/cookiecutter-python-component
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier:
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
18
|
Classifier: Operating System :: OS Independent
|
|
13
19
|
Classifier: Intended Audience :: Developers
|
|
14
20
|
Classifier: Intended Audience :: Information Technology
|
|
@@ -19,7 +25,14 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
19
25
|
Requires-Python: >=3.8
|
|
20
26
|
Description-Content-Type: text/markdown
|
|
21
27
|
License-File: LICENSE
|
|
28
|
+
Requires-Dist: pygelf
|
|
29
|
+
Requires-Dist: pytz<2021.0
|
|
30
|
+
Requires-Dist: deprecated
|
|
31
|
+
Dynamic: license-file
|
|
22
32
|
|
|
33
|
+
# Keboola Python Component library
|
|
34
|
+
|
|
35
|
+
## Introduction
|
|
23
36
|
|
|
24
37
|

|
|
25
38
|
[](https://codeclimate.com/github/keboola/python-component)
|
{keboola.component-1.6.13 → keboola_component-1.8.2}/src/keboola.component.egg-info/SOURCES.txt
RENAMED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
|
-
|
|
3
|
+
pyproject.toml
|
|
4
4
|
src/keboola.component.egg-info/PKG-INFO
|
|
5
5
|
src/keboola.component.egg-info/SOURCES.txt
|
|
6
6
|
src/keboola.component.egg-info/dependency_links.txt
|
|
7
|
-
src/keboola.component.egg-info/not-zip-safe
|
|
8
7
|
src/keboola.component.egg-info/requires.txt
|
|
9
8
|
src/keboola.component.egg-info/top_level.txt
|
|
10
9
|
src/keboola/component/__init__.py
|
|
@@ -13,4 +12,9 @@ src/keboola/component/dao.py
|
|
|
13
12
|
src/keboola/component/exceptions.py
|
|
14
13
|
src/keboola/component/interface.py
|
|
15
14
|
src/keboola/component/sync_actions.py
|
|
16
|
-
src/keboola/component/table_schema.py
|
|
15
|
+
src/keboola/component/table_schema.py
|
|
16
|
+
tests/test_base.py
|
|
17
|
+
tests/test_dao.py
|
|
18
|
+
tests/test_interface.py
|
|
19
|
+
tests/test_schema.py
|
|
20
|
+
tests/test_sync_actions.py
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import unittest
|
|
3
|
+
from io import StringIO
|
|
4
|
+
from unittest.mock import patch
|
|
5
|
+
|
|
6
|
+
from keboola.component import UserException
|
|
7
|
+
from keboola.component.base import ComponentBase, sync_action
|
|
8
|
+
from keboola.component.sync_actions import SelectElement
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MockComponent(ComponentBase):
|
|
12
|
+
def run(self):
|
|
13
|
+
return 'run_executed'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MockComponentFail(ComponentBase):
|
|
17
|
+
def run(self):
|
|
18
|
+
raise UserException("Failed")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TestCommonInterface(unittest.TestCase):
|
|
22
|
+
|
|
23
|
+
def setUp(self):
|
|
24
|
+
path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
25
|
+
'data_examples', 'data1')
|
|
26
|
+
os.environ["KBC_DATADIR"] = path
|
|
27
|
+
|
|
28
|
+
def test_default_arguments_pass(self):
|
|
29
|
+
MockComponent()
|
|
30
|
+
|
|
31
|
+
def test_missing_config_parameters_fail(self):
|
|
32
|
+
with self.assertRaises(UserException):
|
|
33
|
+
MockComponent(required_parameters=['missing'])
|
|
34
|
+
|
|
35
|
+
def test_missing_image_parameters_fail(self):
|
|
36
|
+
with self.assertRaises(UserException):
|
|
37
|
+
c = MockComponent(required_image_parameters=['missing'])
|
|
38
|
+
c.execute_action()
|
|
39
|
+
|
|
40
|
+
def test_missing_action_fail(self):
|
|
41
|
+
path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
42
|
+
'data_examples', 'data_custom_action')
|
|
43
|
+
os.environ["KBC_DATADIR"] = path
|
|
44
|
+
with self.assertRaises(AttributeError):
|
|
45
|
+
MockComponent().execute_action()
|
|
46
|
+
|
|
47
|
+
def test_run_action_passes(self):
|
|
48
|
+
self.assertEqual(MockComponent().execute_action(), 'run_executed')
|
|
49
|
+
|
|
50
|
+
def test_custom_action_passes(self):
|
|
51
|
+
path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
52
|
+
'data_examples', 'data_custom_action')
|
|
53
|
+
os.environ["KBC_DATADIR"] = path
|
|
54
|
+
|
|
55
|
+
class CustomActionComponent(ComponentBase):
|
|
56
|
+
def run(self):
|
|
57
|
+
pass
|
|
58
|
+
|
|
59
|
+
@sync_action('custom_action')
|
|
60
|
+
def test_action(self):
|
|
61
|
+
return [SelectElement("test")]
|
|
62
|
+
|
|
63
|
+
self.assertEqual(CustomActionComponent().execute_action(), [SelectElement("test")])
|
|
64
|
+
|
|
65
|
+
def test_run_action_fails_with_user_error(self):
|
|
66
|
+
with self.assertRaises(UserException):
|
|
67
|
+
MockComponentFail().execute_action()
|
|
68
|
+
|
|
69
|
+
def test_system_action_name_fail(self):
|
|
70
|
+
with self.assertRaises(ValueError):
|
|
71
|
+
class ComponentInvalidActionName(ComponentBase):
|
|
72
|
+
def run(self):
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
@sync_action('run')
|
|
76
|
+
def test_action(self):
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
80
|
+
'data_examples', 'data_custom_action')
|
|
81
|
+
os.environ["KBC_DATADIR"] = path
|
|
82
|
+
|
|
83
|
+
ComponentInvalidActionName().execute_action()
|
|
84
|
+
|
|
85
|
+
@patch('sys.stdout', new_callable=StringIO)
|
|
86
|
+
def test_sync_action_prints_valid_message(self, stdout):
|
|
87
|
+
path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
88
|
+
'data_examples', 'data_custom_action')
|
|
89
|
+
os.environ["KBC_DATADIR"] = path
|
|
90
|
+
|
|
91
|
+
class CustomActionComponent(ComponentBase):
|
|
92
|
+
def run(self):
|
|
93
|
+
pass
|
|
94
|
+
|
|
95
|
+
@sync_action('custom_action')
|
|
96
|
+
def get_columns(self):
|
|
97
|
+
return [SelectElement("value_a", "label_a"),
|
|
98
|
+
SelectElement("value_b")
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
CustomActionComponent().execute_action()
|
|
102
|
+
expected = '[{"value": "value_a", "label": "label_a"}, {"value": "value_b", "label": "value_b"}]'
|
|
103
|
+
self.assertEqual(stdout.getvalue(), expected)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == '__main__':
|
|
107
|
+
unittest.main()
|