switch-api 0.6.30__tar.gz → 0.6.31__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.
- {switch_api-0.6.30 → switch_api-0.6.31}/HISTORY.md +13 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/PKG-INFO +14 -1
- {switch_api-0.6.30 → switch_api-0.6.31}/setup.py +1 -1
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/__init__.py +1 -1
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/pipeline/automation.py +12 -1
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api.egg-info/PKG-INFO +14 -1
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api.egg-info/SOURCES.txt +2 -1
- switch_api-0.6.31/tests/test_timer_deployment.py +62 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/AUTHORS.rst +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/LICENCE +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/MANIFEST.in +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/README.md +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/pyproject.toml +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/setup.cfg +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_authentication/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_authentication/_authentication.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_authentication/_credentials_store/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_authentication/_credentials_store/_credentials_store.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_authentication/_msal/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_authentication/_msal/_custom_application.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_compute/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_compute/_commands.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_compute/_compute.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_compute/_iotservice.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_compute/_models.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_compute/_utils.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_guide/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_guide/main.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_guide/processor.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_utils/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_utils/_constants.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_utils/_marketplace.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_utils/_mqtt.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_utils/_platform.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_utils/_sql.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_utils/_utils.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/analytics/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/analytics/analytics.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/cache/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/cache/cache.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/controls/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/controls/_constants.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/controls/_enums.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/controls/_mqtt.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/controls/controls.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/dataset/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/dataset/dataset.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/email/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/email/email_sender.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/error_handlers/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/error_handlers/error_handlers.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/extensions/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/extensions/extensions.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/extensions/field_meta.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/extensions/helpers.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/extensions/pipeline.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/initialize.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/integration/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/integration/_utils.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/integration/helpers.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/integration/integration.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/pipeline/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/pipeline/definitions.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/pipeline/pipeline.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/platform_insights/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/platform_insights/platform_insights.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/realtime/__init__.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/realtime/_mqtt.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/realtime/_redis.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api/realtime/realtime.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api.egg-info/dependency_links.txt +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api.egg-info/requires.txt +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/switch_api.egg-info/top_level.txt +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/tests/test_authentication.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/tests/test_controls.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/tests/test_dataset.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/tests/test_error_handlers.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/tests/test_initialize.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/tests/test_integration.py +0 -0
- {switch_api-0.6.30 → switch_api-0.6.31}/tests/test_pipeline.py +0 -0
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# History
|
|
2
2
|
|
|
3
|
+
#0.6.31
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
In the `pipeline` module:
|
|
8
|
+
|
|
9
|
+
- Added optional `email`, `ftp`, `upload`, and `webhook` delivery settings to `Automation.deploy_on_timer()`, allowing scheduled data feeds to retain additional delivery methods.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Timer deployment requests include all four delivery settings while retaining `sourceType: Timer`. Omitted settings, `None`, or empty dictionaries clear the corresponding stored configuration; resupply each setting that should remain enabled.
|
|
14
|
+
- Existing positional arguments and driver `settings` retain their meaning.
|
|
15
|
+
|
|
3
16
|
#0.6.30
|
|
4
17
|
|
|
5
18
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: switch_api
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.31
|
|
4
4
|
Summary: A complete package for data ingestion into the Switch Automation Platform.
|
|
5
5
|
Author: Switch Automation Pty Ltd.
|
|
6
6
|
License: MIT License
|
|
@@ -58,6 +58,19 @@ pip install switch_api
|
|
|
58
58
|
|
|
59
59
|
# History
|
|
60
60
|
|
|
61
|
+
#0.6.31
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
In the `pipeline` module:
|
|
66
|
+
|
|
67
|
+
- Added optional `email`, `ftp`, `upload`, and `webhook` delivery settings to `Automation.deploy_on_timer()`, allowing scheduled data feeds to retain additional delivery methods.
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
|
|
71
|
+
- Timer deployment requests include all four delivery settings while retaining `sourceType: Timer`. Omitted settings, `None`, or empty dictionaries clear the corresponding stored configuration; resupply each setting that should remain enabled.
|
|
72
|
+
- Existing positional arguments and driver `settings` retain their meaning.
|
|
73
|
+
|
|
61
74
|
#0.6.30
|
|
62
75
|
|
|
63
76
|
### Added
|
|
@@ -16,7 +16,7 @@ setup(
|
|
|
16
16
|
long_description_content_type='text/markdown',
|
|
17
17
|
license='MIT License',
|
|
18
18
|
name="switch_api",
|
|
19
|
-
version="0.6.
|
|
19
|
+
version="0.6.31",
|
|
20
20
|
packages=find_packages(include=["switch_api", "switch_api.*"]),
|
|
21
21
|
install_requires=['pandas==1.5.3', 'requests', 'azure-storage-blob', 'pandera[io]==0.7.1', 'azure-servicebus',
|
|
22
22
|
'msal>=1.11.0', 'paho-mqtt==1.6.1', 'uvicorn==0.22.0', 'fastapi==0.98.0', 'pyodbc==4.0.39', 'cachetools==5.5.0',
|
|
@@ -1366,7 +1366,9 @@ class Automation:
|
|
|
1366
1366
|
cron_schedule: str, queue_name: QUEUE_NAME = "task", settings: dict = None,
|
|
1367
1367
|
schedule_timezone: SCHEDULE_TIMEZONE = 'Local', timezone_offset_minutes: int = None,
|
|
1368
1368
|
data_feed_name: str = None, task_priority: TASK_PRIORITY = 'standard',
|
|
1369
|
-
task_framework: TASK_FRAMEWORK = 'TaskInsightsEngine'
|
|
1369
|
+
task_framework: TASK_FRAMEWORK = 'TaskInsightsEngine',
|
|
1370
|
+
email: dict = None, ftp: dict = None, upload: dict = None,
|
|
1371
|
+
webhook: dict = None):
|
|
1370
1372
|
"""Deploy driver to run on timer.
|
|
1371
1373
|
|
|
1372
1374
|
Parameters
|
|
@@ -1403,6 +1405,11 @@ class Automation:
|
|
|
1403
1405
|
'PythonScriptFramework' for the old task runner engine.
|
|
1404
1406
|
'TaskInsightsEngine' for the new task running in container apps.
|
|
1405
1407
|
|
|
1408
|
+
email, ftp, upload, webhook : dict, optional
|
|
1409
|
+
Independent delivery settings using API camelCase field names; each defaults to None.
|
|
1410
|
+
Timer updates replace all four: None or an empty object clears the corresponding setting.
|
|
1411
|
+
Upload requires a nonempty uploadUrl or ingestUrl; the server generates the actual URLs.
|
|
1412
|
+
|
|
1406
1413
|
Returns
|
|
1407
1414
|
-------
|
|
1408
1415
|
pandas.Dataframe
|
|
@@ -1505,6 +1512,10 @@ class Automation:
|
|
|
1505
1512
|
"timezoneOffsetMinutes": timezone_offset_minutes,
|
|
1506
1513
|
"scheduleTimezone": schedule_timezone
|
|
1507
1514
|
},
|
|
1515
|
+
"email": email,
|
|
1516
|
+
"ftp": ftp,
|
|
1517
|
+
"upload": upload,
|
|
1518
|
+
"webhook": webhook,
|
|
1508
1519
|
"settings": settings
|
|
1509
1520
|
}
|
|
1510
1521
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: switch_api
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.31
|
|
4
4
|
Summary: A complete package for data ingestion into the Switch Automation Platform.
|
|
5
5
|
Author: Switch Automation Pty Ltd.
|
|
6
6
|
License: MIT License
|
|
@@ -58,6 +58,19 @@ pip install switch_api
|
|
|
58
58
|
|
|
59
59
|
# History
|
|
60
60
|
|
|
61
|
+
#0.6.31
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
In the `pipeline` module:
|
|
66
|
+
|
|
67
|
+
- Added optional `email`, `ftp`, `upload`, and `webhook` delivery settings to `Automation.deploy_on_timer()`, allowing scheduled data feeds to retain additional delivery methods.
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
|
|
71
|
+
- Timer deployment requests include all four delivery settings while retaining `sourceType: Timer`. Omitted settings, `None`, or empty dictionaries clear the corresponding stored configuration; resupply each setting that should remain enabled.
|
|
72
|
+
- Existing positional arguments and driver `settings` retain their meaning.
|
|
73
|
+
|
|
61
74
|
#0.6.30
|
|
62
75
|
|
|
63
76
|
### Added
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Offline payload regression tests for both Timer deployment helpers."""
|
|
2
|
+
import ast
|
|
3
|
+
import itertools
|
|
4
|
+
import json
|
|
5
|
+
import logging
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from types import SimpleNamespace
|
|
8
|
+
import unittest
|
|
9
|
+
from unittest.mock import Mock
|
|
10
|
+
import uuid
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TimerDeploymentTests(unittest.TestCase):
|
|
14
|
+
def test_delivery_settings(self):
|
|
15
|
+
root = Path(__file__).resolve().parents[1]
|
|
16
|
+
for relative, is_api in (
|
|
17
|
+
('switch_api/pipeline/automation.py', True),
|
|
18
|
+
('switch_guides/switch_guides/pipeline/automation.py', False),
|
|
19
|
+
):
|
|
20
|
+
# Execute the actual helper in isolation from unrelated Azure/task imports.
|
|
21
|
+
tree = ast.parse((root / relative).read_text(encoding='utf-8'))
|
|
22
|
+
owner = next(n for n in tree.body if isinstance(n, ast.ClassDef) and n.name == 'Automation') if is_api else tree
|
|
23
|
+
function = next(n for n in owner.body if isinstance(n, ast.FunctionDef) and n.name == 'deploy_on_timer')
|
|
24
|
+
function.decorator_list = []
|
|
25
|
+
function.returns = None
|
|
26
|
+
for argument in function.args.args:
|
|
27
|
+
argument.annotation = None
|
|
28
|
+
requests = SimpleNamespace(post=Mock(return_value=SimpleNamespace(status_code=200, reason='OK', text='', request=SimpleNamespace(url='https://example.invalid'))))
|
|
29
|
+
namespace = dict(uuid=uuid, logger=logging.getLogger(__name__), requests=requests,
|
|
30
|
+
pandas=SimpleNamespace(DataFrame=lambda: None))
|
|
31
|
+
for name, values in dict(EXPECTED_DELIVERY=('Daily',), SCHEDULE_TIMEZONE=('Local',),
|
|
32
|
+
QUEUE_NAME=('task',), TASK_FRAMEWORK=('TaskInsightsEngine',),
|
|
33
|
+
TASK_PRIORITY=('standard',)).items():
|
|
34
|
+
namespace[name] = SimpleNamespace(__args__=values)
|
|
35
|
+
exec(compile(ast.fix_missing_locations(ast.Module(body=[function], type_ignores=[])), relative, 'exec'), namespace)
|
|
36
|
+
deploy = namespace['deploy_on_timer']
|
|
37
|
+
inputs = SimpleNamespace(api_base_url='https://example.invalid', bearer_token='test',
|
|
38
|
+
api_headers=SimpleNamespace(default={}), api_projects_endpoint='https://example.invalid/projects',
|
|
39
|
+
api_project_id=str(uuid.uuid4()))
|
|
40
|
+
task = SimpleNamespace(id=uuid.uuid4(), mapping_entities=['Readings']) if is_api else str(uuid.uuid4())
|
|
41
|
+
args = (task, inputs, uuid.uuid4(), 'Daily', '0 * * * *')
|
|
42
|
+
configurations = dict(email={'emailAddressDomain': 'example.invalid'},
|
|
43
|
+
ftp={'ftpUserName': 'test-user', 'ftpPassword': 'test-only'},
|
|
44
|
+
upload={'uploadUrl': 'enabled'},
|
|
45
|
+
webhook={'clientSigningSecret': 'test-only'})
|
|
46
|
+
for enabled in itertools.product((False, True), repeat=4):
|
|
47
|
+
optional = {key: value for (key, value), include in zip(configurations.items(), enabled) if include}
|
|
48
|
+
with self.subTest(helper=relative, enabled=enabled):
|
|
49
|
+
deploy(*args, settings={'custom': 'value'}, **optional)
|
|
50
|
+
payload = json.loads(json.dumps(requests.post.call_args.kwargs['json']))
|
|
51
|
+
self.assertEqual(payload['sourceType'], 'Timer')
|
|
52
|
+
self.assertEqual(payload['timer'], dict(cronSchedule='0 * * * *', timezoneOffsetMinutes=0, scheduleTimezone='Local'))
|
|
53
|
+
self.assertEqual(payload['settings'], {'custom': 'value'})
|
|
54
|
+
for key in configurations:
|
|
55
|
+
self.assertEqual(payload[key], optional.get(key))
|
|
56
|
+
deploy(*args, **dict.fromkeys(configurations, {}))
|
|
57
|
+
for key in configurations:
|
|
58
|
+
self.assertEqual(requests.post.call_args.kwargs['json'][key], {})
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if __name__ == '__main__':
|
|
62
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_authentication/_credentials_store/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{switch_api-0.6.30 → switch_api-0.6.31}/switch_api/_authentication/_msal/_custom_application.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|