orionis 0.467.0__py3-none-any.whl → 0.469.0__py3-none-any.whl

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.
@@ -1,4 +1,207 @@
1
- class Schedule:
1
+ from typing import Any, List, Optional
2
+ from apscheduler.schedulers.background import BackgroundScheduler as APSBackgroundScheduler
3
+ from apscheduler.schedulers.blocking import BlockingScheduler as APSBlockingScheduler
4
+ from apscheduler.schedulers.asyncio import AsyncIOScheduler as APSAsyncIOScheduler
5
+ from apscheduler.triggers.cron import CronTrigger
6
+ from apscheduler.triggers.date import DateTrigger
7
+ from apscheduler.triggers.interval import IntervalTrigger
8
+ from orionis.console.contracts.reactor import IReactor
9
+ from datetime import datetime
10
+ import pytz
11
+ from orionis.console.exceptions import CLIOrionisRuntimeError
12
+ from orionis.foundation.contracts.application import IApplication
13
+ from orionis.app import Orionis
14
+
15
+ class Scheduler:
16
+ """
17
+ Scheduler class to manage scheduled tasks in Orionis.
18
+ This class allows you to define commands, set triggers, and manage the scheduling of tasks.
19
+ """
20
+
21
+ def __init__(self) -> None:
22
+ self.__command: str = None
23
+ self.__args: List[str] = None
24
+ self.__type: str = None
25
+ self.__purpose: str = None
26
+ self.__mode: str = None
27
+ self.__start_date: str = None
28
+ self.__end_date: str = None
29
+
30
+ def command(self, signature: str, args: Optional[List[str]] = None) -> 'Scheduler':
31
+ """
32
+ Set the command signature and its arguments.
33
+ """
34
+ if not isinstance(signature, str) or not signature.strip():
35
+ raise ValueError("The command signature must be a non-empty string.")
36
+
37
+ if args is not None and not isinstance(args, list):
38
+ raise ValueError("Arguments must be a list of strings or None.")
39
+
40
+ self.__command = signature
41
+ self.__args = args or []
42
+ return self
43
+
44
+ def background(self) -> 'Scheduler':
45
+ self.__type = 'background'
46
+ return self
47
+
48
+ def blocking(self) -> 'Scheduler':
49
+ self.__type = 'blocking'
50
+ return self
51
+
52
+ def asyncio(self) -> 'Scheduler':
53
+ self.__type = 'asyncio'
54
+ return self
55
+
56
+ def porpose(self, purpose: str) -> 'Scheduler':
57
+ if not isinstance(purpose, str) or not purpose.strip():
58
+ raise ValueError("The purpose must be a non-empty string.")
59
+ self.__purpose = purpose
60
+ return self
61
+
62
+ def onceAt(self, date: datetime) -> 'Scheduler':
63
+
64
+ if not isinstance(date, datetime):
65
+ raise CLIOrionisRuntimeError("The date must be an instance of datetime.")
66
+
67
+ if self.__command is None:
68
+ raise CLIOrionisRuntimeError("You must define a command before scheduling it.")
69
+
70
+ if self.__type is None:
71
+ self.background()
72
+
73
+ if self.__purpose is None:
74
+ self.__purpose = "Scheduled task"
75
+
76
+ return self
77
+
78
+
79
+
80
+
81
+
82
+ # class Scheduler2():
83
+
84
+ # def __init__(
85
+ # self,
86
+ # app: IApplication,
87
+ # reactor: IReactor
88
+ # ) -> None:
89
+ # self.__app = app or Orionis()
90
+ # self.__jobs: dict = {}
91
+ # self.__command: str = None
92
+ # self.__args: List[str] = None
93
+ # self.__purpose: str = None
94
+ # self.__trigger: Optional[CronTrigger | DateTrigger | IntervalTrigger] = None
95
+ # self.__scheduler: Optional[APSBackgroundScheduler | APSBlockingScheduler | APSAsyncIOScheduler] = None
96
+ # self.__reactor = reactor
97
+ # self.__available_commands = self.__reactor.info()
98
+
99
+ # def background(self):
100
+ # self.__scheduler = APSBackgroundScheduler(
101
+ # timezone=self.__app.config('app.timezone', 'UTC')
102
+ # )
103
+ # return self
104
+
105
+ # def blocking(self):
106
+ # self.__scheduler = APSBlockingScheduler(
107
+ # timezone=self.__app.config('app.timezone', 'UTC')
108
+ # )
109
+ # return self
110
+
111
+ # def asyncio(self):
112
+ # self.__scheduler = APSAsyncIOScheduler(
113
+ # timezone=self.__app.config('app.timezone', 'UTC')
114
+ # )
115
+ # return self
116
+
117
+ # def command(self, signature: str, args: Optional[List[str]] = None) -> 'Scheduler':
118
+ # """
119
+ # Set the command signature and its arguments.
120
+ # """
121
+ # if not isinstance(signature, str) or not signature.strip():
122
+ # raise ValueError("The command signature must be a non-empty string.")
123
+
124
+ # if args is not None and not isinstance(args, list):
125
+ # raise ValueError("Arguments must be a list of strings or None.")
126
+
127
+ # self.__command = signature
128
+ # self.__args = args or []
129
+ # return self
130
+
131
+ # def __isAvailable(self, signature: str) -> bool:
132
+ # for command in self.__available_commands:
133
+ # if command['signature'] == signature:
134
+ # return True
135
+ # return False
136
+
137
+ # def __getDescription(self, signature: str) -> Optional[str]:
138
+ # """
139
+ # Get the description of the command by its signature.
140
+ # """
141
+ # for command in self.__available_commands:
142
+ # if command['signature'] == signature:
143
+ # return command.get('description')
144
+ # return None
145
+
146
+ # def command(
147
+ # self,
148
+ # signature: str,
149
+ # args: Optional[List[str]] = None
150
+ # ) -> bool:
151
+
152
+ # # Validar que la firma del comando sea una cadena no vacía
153
+ # if not isinstance(signature, str) or not signature.strip():
154
+ # raise ValueError("La firma del comando debe ser una cadena no vacía.")
155
+
156
+ # # Garantizar que los argumentos sean una lista de cadenas o None
157
+ # if args is not None and not isinstance(args, list):
158
+ # raise ValueError("Los argumentos deben ser una lista de cadenas o None.")
159
+
160
+ # # Verificar si el comando ya está registrado
161
+ # if not self.__isAvailable(signature):
162
+ # raise ValueError(f"El comando '{signature}' no está disponible o no existe.")
163
+
164
+ # # Almacenar el trabajo en el diccionario de trabajos
165
+ # self.__jobs[signature] = {
166
+ # "signature": signature,
167
+ # "args": args or [],
168
+
169
+ # }
170
+
171
+ # # Retornar la misma instancia para permitir encadenamiento
172
+ # return self
173
+
174
+ # def onceAt(self, date: datetime):
175
+ # """
176
+ # Schedule the defined command to execute every X seconds.
177
+ # """
178
+
179
+ # if not isinstance(date, datetime):
180
+ # raise CLIOrionisRuntimeError(
181
+ # "La fecha debe ser una instancia de datetime."
182
+ # )
183
+
184
+ # self.__scheduler.add_job(
185
+ # func=lambda: self.__reactor.run(self.__jobs['signature'], *self.__jobs['args']),
186
+ # trigger=DateTrigger(run_date=date, timezone=self.__timezone),
187
+ # args=[self.__jobs],
188
+ # id=self.__jobs['signature'],
189
+ # replace_existing=True
190
+ # )
191
+
192
+
193
+
194
+
195
+ # # def start(self):
196
+ # # self.__scheduler.start()
197
+
198
+ # # def shutdown(self, wait=True):
199
+ # # self.__scheduler.shutdown(wait=wait)
200
+
201
+ # # def remove(self, job_id):
202
+ # # self.__scheduler.remove_job(job_id)
203
+
204
+ # # def jobs(self):
205
+ # # return self.__scheduler.get_jobs()
206
+
2
207
 
3
- def __init__(self):
4
- self.tasks = []
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.467.0"
8
+ VERSION = "0.469.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -83,7 +83,8 @@ REQUIRES = [
83
83
  'requests>=2.32.3',
84
84
  'rich>=13.9.4',
85
85
  'psutil>=7.0.0',
86
- 'cryptography>=44.0.3'
86
+ 'cryptography>=44.0.3',
87
+ 'pytz>=2025.2'
87
88
  ]
88
89
 
89
90
  #---------------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.467.0
3
+ Version: 0.469.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -32,6 +32,7 @@ Requires-Dist: requests>=2.32.3
32
32
  Requires-Dist: rich>=13.9.4
33
33
  Requires-Dist: psutil>=7.0.0
34
34
  Requires-Dist: cryptography>=44.0.3
35
+ Requires-Dist: pytz>=2025.2
35
36
  Dynamic: author
36
37
  Dynamic: author-email
37
38
  Dynamic: classifier
@@ -45,7 +45,7 @@ orionis/console/output/contracts/executor.py,sha256=7l3kwnvv6GlH9EYk0v94YE1olex_
45
45
  orionis/console/output/enums/__init__.py,sha256=LAaAxg-DpArCjf_jqZ0_9s3p8899gntDYkSU_ppTdC8,66
46
46
  orionis/console/output/enums/styles.py,sha256=6a4oQCOBOKMh2ARdeq5GlIskJ3wjiylYmh66tUKKmpQ,4053
47
47
  orionis/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- orionis/console/tasks/schedule.py,sha256=egNIfL-sNUIXPtYGM2qdHK10WxZIwrPdNNy4kr4fkwo,67
48
+ orionis/console/tasks/schedule.py,sha256=3gnXPG2lamqRW99ERJE6c3WVuek6jiFqOqyiT_cbkWg,7213
49
49
  orionis/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  orionis/container/container.py,sha256=MmvFm0Y-x667mIYPunmBnHzQHBsWJObT5_zuWrgqaWU,80528
51
51
  orionis/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -190,7 +190,7 @@ orionis/foundation/providers/reactor_provider.py,sha256=P0KQcp4AFKTrD6BStGfCTqhG
190
190
  orionis/foundation/providers/testing_provider.py,sha256=SrJRpdvcblx9WvX7x9Y3zc7OQfiTf7la0HAJrm2ESlE,3725
191
191
  orionis/foundation/providers/workers_provider.py,sha256=oa_2NIDH6UxZrtuGkkoo_zEoNIMGgJ46vg5CCgAm7wI,3926
192
192
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
193
- orionis/metadata/framework.py,sha256=tc_Woa9KY_Z5mkcpyRMTouEy2_1YzPIDttwbWKn5vTw,4088
193
+ orionis/metadata/framework.py,sha256=Qcg83tzpMW43N_S0LaF3rqKgjbAC1YWGdstbZ8WWsNA,4109
194
194
  orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
195
195
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
196
196
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -356,7 +356,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
356
356
  orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
357
357
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
358
358
  orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
359
- orionis-0.467.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
359
+ orionis-0.469.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
360
360
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
361
361
  tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
362
362
  tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -499,8 +499,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
499
499
  tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
500
500
  tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
501
501
  tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
502
- orionis-0.467.0.dist-info/METADATA,sha256=4z_uKHB1QJ7ZniTRiaOuQ9tplQqAIQ3P3xTNcQ9ilj8,4772
503
- orionis-0.467.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
504
- orionis-0.467.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
505
- orionis-0.467.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
506
- orionis-0.467.0.dist-info/RECORD,,
502
+ orionis-0.469.0.dist-info/METADATA,sha256=d7pqVfFyMWdL-FVK8XDWrHslTXmTkttTsZ52vcognFo,4801
503
+ orionis-0.469.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
504
+ orionis-0.469.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
505
+ orionis-0.469.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
506
+ orionis-0.469.0.dist-info/RECORD,,