diff --git a/.github/workflows/ci-pipeline__dev.yml b/.github/workflows/ci-pipeline__dev.yml index 47f661cb..5fe81056 100644 --- a/.github/workflows/ci-pipeline__dev.yml +++ b/.github/workflows/ci-pipeline__dev.yml @@ -15,7 +15,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ 3.8.18, 3.9.19, 3.10.14, 3.11.9, 3.12.3 , ] + python-version: [ 3.9.21, 3.10.16, 3.11.11, 3.12.8, 3.13.1 ] + #[ 3.8.18, 3.9.19, 3.10.14, 3.11.9, 3.12.3 , ] # [3.7.17, 3.13.0-beta.1 ] # poetry doesn't support: 3.7.17, and was hanging on the installation of 3.13.0-beta.1 steps: diff --git a/README.md b/README.md index a7830537..8b03dbcd 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Powerful Python util methods and classes that simplify common apis and tasks. -![Current Release](https://img.shields.io/badge/release-v2.17.0-blue) +![Current Release](https://img.shields.io/badge/release-v2.17.4-blue) [![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](https://codecov.io/gh/owasp-sbot/OSBot-Utils) diff --git a/osbot_utils/helpers/flows/Flow.py b/osbot_utils/helpers/flows/Flow.py index 2ce37144..66ff2889 100644 --- a/osbot_utils/helpers/flows/Flow.py +++ b/osbot_utils/helpers/flows/Flow.py @@ -2,17 +2,17 @@ import logging import typing -from osbot_utils.helpers.Dependency_Manager import Dependency_Manager -from osbot_utils.type_safe.Type_Safe import Type_Safe -from osbot_utils.helpers.CFormat import CFormat, f_dark_grey, f_magenta, f_bold -from osbot_utils.helpers.flows.models.Flow_Run__Config import Flow_Run__Config -from osbot_utils.helpers.flows.Flow__Events import flow_events -from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data -from osbot_utils.testing.Stdout import Stdout -from osbot_utils.utils.Misc import random_id, lower, time_now -from osbot_utils.utils.Python_Logger import Python_Logger -from osbot_utils.utils.Str import ansis_to_texts -from osbot_utils.utils.Threads import invoke_in_new_event_loop +from osbot_utils.helpers.Dependency_Manager import Dependency_Manager +from osbot_utils.type_safe.Type_Safe import Type_Safe +from osbot_utils.helpers.CFormat import CFormat, f_dark_grey, f_magenta, f_bold +from osbot_utils.helpers.flows.models.Flow_Run__Config import Flow_Run__Config +from osbot_utils.helpers.flows.Flow__Events import flow_events +from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data +from osbot_utils.testing.Stdout import Stdout +from osbot_utils.utils.Misc import random_id, lower, time_now +from osbot_utils.utils.Python_Logger import Python_Logger +from osbot_utils.utils.Str import ansis_to_texts +from osbot_utils.utils.Threads import invoke_in_new_event_loop FLOW__RANDOM_ID__PREFIX = 'flow_id__' FLOW__RANDOM_NAME__PREFIX = 'flow_name__' @@ -20,7 +20,7 @@ FLOW__LOGGING__DATE_FORMAT = '%H:%M:%S' - +# todo: add flow duration class Flow(Type_Safe): captured_exec_logs : list data : dict # dict available to the tasks to add and collect data diff --git a/osbot_utils/helpers/flows/Task.py b/osbot_utils/helpers/flows/Task.py index 42ac2f64..089a9199 100644 --- a/osbot_utils/helpers/flows/Task.py +++ b/osbot_utils/helpers/flows/Task.py @@ -1,18 +1,19 @@ -import asyncio import inspect import typing -from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data -from osbot_utils.utils.Misc import random_id, lower -from osbot_utils.helpers.Dependency_Manager import Dependency_Manager -from osbot_utils.helpers.flows.Flow__Events import flow_events -from osbot_utils.testing.Stdout import Stdout -from osbot_utils.helpers.CFormat import CFormat, f_dark_grey, f_red, f_blue, f_bold -from osbot_utils.type_safe.Type_Safe import Type_Safe -from osbot_utils.helpers.flows.Flow import Flow +from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data +from osbot_utils.utils.Misc import random_id, lower +from osbot_utils.helpers.Dependency_Manager import Dependency_Manager +from osbot_utils.helpers.flows.Flow__Events import flow_events +from osbot_utils.testing.Stdout import Stdout +from osbot_utils.helpers.CFormat import CFormat, f_dark_grey, f_red, f_blue, f_bold +from osbot_utils.type_safe.Type_Safe import Type_Safe +from osbot_utils.helpers.flows.Flow import Flow TASK__RANDOM_ID__PREFIX = 'task_id__' +# todo: add task duration + class Task(Type_Safe): data : dict # dict available to the task to add and collect data task_id : str diff --git a/osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py b/osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py index 267ba244..cc58e777 100644 --- a/osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py +++ b/osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py @@ -2,6 +2,7 @@ import types from decimal import Decimal from enum import EnumMeta +from osbot_utils.helpers.Obj_Id import Obj_Id from osbot_utils.type_safe.Type_Safe import Type_Safe from osbot_utils.type_safe.Type_Safe__List import Type_Safe__List from osbot_utils.helpers.Random_Guid import Random_Guid @@ -100,8 +101,10 @@ def deserialize_from_dict(self, _self, data, raise_on_not_found=False): value = Random_Guid(value) elif type_safe_annotations.obj_is_attribute_annotation_of_type(_self, key, Random_Guid_Short): # handle Random_Guid_Short value = Random_Guid_Short(value) - elif type_safe_annotations.obj_is_attribute_annotation_of_type(_self, key, Timestamp_Now): # handle Timestamp_Now + elif type_safe_annotations.obj_is_attribute_annotation_of_type(_self, key, Timestamp_Now ): # handle Timestamp_Now value = Timestamp_Now(value) + elif type_safe_annotations.obj_is_attribute_annotation_of_type(_self, key, Obj_Id ): # handle Obj_Id + value = Obj_Id(value) setattr(_self, key, value) # Direct assignment for primitive types and other structures diff --git a/osbot_utils/version b/osbot_utils/version index c0436dea..c69fd9fe 100644 --- a/osbot_utils/version +++ b/osbot_utils/version @@ -1 +1 @@ -v2.17.0 +v2.17.4 diff --git a/pyproject.toml b/pyproject.toml index 8068606c..2f10af84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "osbot_utils" -version = "v2.17.0" +version = "v2.17.4" description = "OWASP Security Bot - Utils" authors = ["Dinis Cruz "] license = "MIT" diff --git a/tests/unit/helpers/test_Obj_Id.py b/tests/unit/helpers/test_Obj_Id.py index 55e45cbf..05b159ef 100644 --- a/tests/unit/helpers/test_Obj_Id.py +++ b/tests/unit/helpers/test_Obj_Id.py @@ -23,5 +23,5 @@ def test__perf__new__(self): def test__perf__new_obj_id(self): with Performance_Measure__Session() as _: - _.measure(lambda: new_obj_id() ).assert_time__less_than(300) - _.measure(lambda: is_obj_id('abc')).assert_time__less_than(300) \ No newline at end of file + _.measure(lambda: new_obj_id() ).assert_time__less_than(500) + _.measure(lambda: is_obj_id('abc')).assert_time__less_than(500) \ No newline at end of file diff --git a/tests/unit/utils/test_Process.py b/tests/unit/utils/test_Process.py index be9210f9..3ca098f5 100644 --- a/tests/unit/utils/test_Process.py +++ b/tests/unit/utils/test_Process.py @@ -1,11 +1,7 @@ import sys -from unittest import TestCase -from unittest.mock import patch, call - -import pytest - -from osbot_utils.utils.Files import temp_file -from osbot_utils.utils.Process import Process, run_process, chmod_x, exec_open, stop_process +from unittest import TestCase +from unittest.mock import patch, call +from osbot_utils.utils.Process import run_process, exec_open, stop_process class test_Process(TestCase): @@ -17,8 +13,6 @@ class test_Process(TestCase): # assert '-rwxr-xr-x' in run_process('ls', ['-la', temp_exe])['stdout'] def test_run(self): - if sys.version_info < (3, 8): - pytest.skip("Skipping test that doesn't work on 3.7 or lower") assert run_process('echo', ['hello', 'world'])['stdout'] == 'hello world\n' assert run_process('echo', 'hello world')['stdout'] == 'hello world\n'