orionis 0.392.0__py3-none-any.whl → 0.394.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,9 +1,8 @@
1
- from typing import Any, Type, List
1
+ from pathlib import Path
2
+ from typing import Any, List, Type
2
3
  from orionis.container.container import Container
3
4
  from orionis.container.contracts.service_provider import IServiceProvider
4
5
  from orionis.foundation.config.app.entities.app import App
5
- from orionis.foundation.config.app.enums.ciphers import Cipher
6
- from orionis.foundation.config.app.enums.environments import Environments
7
6
  from orionis.foundation.config.auth.entities.auth import Auth
8
7
  from orionis.foundation.config.cache.entities.cache import Cache
9
8
  from orionis.foundation.config.cors.entities.cors import Cors
@@ -160,9 +159,12 @@ class Application(Container, IApplication):
160
159
  Application
161
160
  The application instance for method chaining
162
161
  """
162
+
163
163
  # Add each provider class
164
164
  for provider_cls in providers:
165
165
  self.addProvider(provider_cls)
166
+
167
+ # Return self instance for method chaining
166
168
  return self
167
169
 
168
170
  def addProvider(
@@ -187,6 +189,7 @@ class Application(Container, IApplication):
187
189
  TypeError
188
190
  If provider is not a subclass of IServiceProvider
189
191
  """
192
+
190
193
  # Validate provider type
191
194
  if not isinstance(provider, type) or not issubclass(provider, IServiceProvider):
192
195
  raise TypeError(f"Expected IServiceProvider class, got {type(provider).__name__}")
@@ -212,7 +215,42 @@ class Application(Container, IApplication):
212
215
  session : Session = None,
213
216
  testing : Testing = None,
214
217
  ) -> 'Application':
218
+ """
219
+ Configure the application with various service configurators.
220
+ This method allows you to set up different aspects of the application by providing
221
+ configurator instances for various services like authentication, caching, database,
222
+ etc. If no configurator is provided for a service, a default instance will be created.
223
+ Parameters
224
+ ----------
225
+ app : App, optional
226
+ Application configurator instance. If None, creates a default App() instance.
227
+ auth : Auth, optional
228
+ Authentication configurator instance. If None, creates a default Auth() instance.
229
+ cache : Cache, optional
230
+ Cache configurator instance. If None, creates a default Cache() instance.
231
+ cors : Cors, optional
232
+ CORS configurator instance. If None, creates a default Cors() instance.
233
+ database : Database, optional
234
+ Database configurator instance. If None, creates a default Database() instance.
235
+ filesystems : Filesystems, optional
236
+ Filesystems configurator instance. If None, creates a default Filesystems() instance.
237
+ logging : Logging, optional
238
+ Logging configurator instance. If None, creates a default Logging() instance.
239
+ mail : Mail, optional
240
+ Mail configurator instance. If None, creates a default Mail() instance.
241
+ queue : Queue, optional
242
+ Queue configurator instance. If None, creates a default Queue() instance.
243
+ session : Session, optional
244
+ Session configurator instance. If None, creates a default Session() instance.
245
+ testing : Testing, optional
246
+ Testing configurator instance. If None, creates a default Testing() instance.
247
+ Returns
248
+ -------
249
+ Application
250
+ Returns self to allow method chaining.
251
+ """
215
252
 
253
+ # Load each configurator with default or provided instances
216
254
  self.loadConfigApp(app or App())
217
255
  self.loadConfigAuth(auth or Auth())
218
256
  self.loadConfigCache(cache or Cache())
@@ -225,77 +263,29 @@ class Application(Container, IApplication):
225
263
  self.loadConfigSession(session or Session())
226
264
  self.loadConfigTesting(testing or Testing())
227
265
 
266
+ # Return self instance for method chaining
228
267
  return self
229
268
 
230
- def configApp(
231
- self,
232
- *,
233
- name: str = None,
234
- env: str | Environments = None,
235
- debug: bool = None,
236
- url: str = None,
237
- port: int = None,
238
- workers: int = None,
239
- reload: bool = None,
240
- timezone: str = None,
241
- locale: str = None,
242
- fallback_locale: str = None,
243
- cipher: str | Cipher = None,
244
- key: str = None,
245
- maintenance: str = None
246
- ) -> 'Application':
269
+ def configApp(self, **app_config) -> 'Application':
247
270
  """
248
271
  Configure the application with various settings.
249
272
 
250
273
  Parameters
251
274
  ----------
252
- name : str, optional
253
- The name of the application
254
- env : str | Environments, optional
255
- The environment of the application (e.g., 'development', 'production')
256
- debug : bool, optional
257
- Whether to enable debug mode
258
- url : str, optional
259
- The base URL of the application
260
- port : int, optional
261
- The port on which the application runs
262
- workers : int, optional
263
- Number of worker processes for handling requests
264
- reload : bool, optional
265
- Whether to enable auto-reloading of the application
266
- timezone : str, optional
267
- The timezone for the application
268
- locale : str, optional
269
- The default locale for the application
270
- fallback_locale : str, optional
271
- The fallback locale if the default is not available
272
- cipher : str | Cipher, optional
273
- The encryption cipher used by the application
274
- key : str, optional
275
- The encryption key used by the application
276
- maintenance : str, optional
277
- The maintenance route for the application
275
+ **app_config : dict
276
+ Configuration parameters for the application. Must match the fields
277
+ expected by the App dataclass (orionis.foundation.config.app.entities.app.App).
278
278
 
279
279
  Returns
280
280
  -------
281
281
  Application
282
282
  The application instance for method chaining
283
-
284
- Raises
285
- ------
286
- TypeError
287
- If any parameter is of an incorrect type or value.
288
283
  """
289
- # Create App instance with provided parameters and validate it.
290
- params = {}
291
- for _key, _value in locals().items():
292
- if _key != 'self' and _value is not None:
293
- params[_key] = _value
294
284
 
295
- # Create App instance with validated parameters
296
- app = App(**params)
285
+ # Create App instance with provided parameters
286
+ app = App(**app_config)
297
287
 
298
- # Load configuration using App instance.
288
+ # Load configuration using App instance
299
289
  self.loadConfigApp(app)
300
290
 
301
291
  # Return the application instance for method chaining
@@ -318,6 +308,7 @@ class Application(Container, IApplication):
318
308
  Application
319
309
  The application instance for method chaining
320
310
  """
311
+
321
312
  # Validate config type
322
313
  if not isinstance(app, App):
323
314
  raise TypeError(f"Expected App instance, got {type(app).__name__}")
@@ -328,6 +319,31 @@ class Application(Container, IApplication):
328
319
  # Return the application instance for method chaining
329
320
  return self
330
321
 
322
+ def configAuth(self, **auth_config) -> 'Application':
323
+ """
324
+ Configure the authentication with various settings.
325
+
326
+ Parameters
327
+ ----------
328
+ **auth_config : dict
329
+ Configuration parameters for authentication. Must match the fields
330
+ expected by the Auth dataclass (orionis.foundation.config.auth.entities.auth.Auth).
331
+
332
+ Returns
333
+ -------
334
+ Application
335
+ The application instance for method chaining
336
+ """
337
+
338
+ # Create Auth instance with provided parameters
339
+ auth = Auth(**auth_config)
340
+
341
+ # Load configuration using Auth instance
342
+ self.loadConfigAuth(auth)
343
+
344
+ # Return the application instance for method chaining
345
+ return self
346
+
331
347
  def loadConfigAuth(
332
348
  self,
333
349
  auth: Auth
@@ -345,6 +361,7 @@ class Application(Container, IApplication):
345
361
  Application
346
362
  The application instance for method chaining
347
363
  """
364
+
348
365
  # Validate auth type
349
366
  if not isinstance(auth, Auth):
350
367
  raise TypeError(f"Expected Auth instance, got {type(auth).__name__}")
@@ -355,6 +372,31 @@ class Application(Container, IApplication):
355
372
  # Return the application instance for method chaining
356
373
  return self
357
374
 
375
+ def configCache(self, **cache_config) -> 'Application':
376
+ """
377
+ Configure the cache with various settings.
378
+
379
+ Parameters
380
+ ----------
381
+ **cache_config : dict
382
+ Configuration parameters for cache. Must match the fields
383
+ expected by the Cache dataclass (orionis.foundation.config.cache.entities.cache.Cache).
384
+
385
+ Returns
386
+ -------
387
+ Application
388
+ The application instance for method chaining
389
+ """
390
+
391
+ # Create Cache instance with provided parameters
392
+ cache = Cache(**cache_config)
393
+
394
+ # Load configuration using Cache instance
395
+ self.loadConfigCache(cache)
396
+
397
+ # Return the application instance for method chaining
398
+ return self
399
+
358
400
  def loadConfigCache(
359
401
  self,
360
402
  cache: Cache
@@ -372,6 +414,7 @@ class Application(Container, IApplication):
372
414
  Application
373
415
  The application instance for method chaining
374
416
  """
417
+
375
418
  # Validate cache type
376
419
  if not isinstance(cache, Cache):
377
420
  raise TypeError(f"Expected Cache instance, got {type(cache).__name__}")
@@ -382,6 +425,31 @@ class Application(Container, IApplication):
382
425
  # Return the application instance for method chaining
383
426
  return self
384
427
 
428
+ def configCors(self, **cors_config) -> 'Application':
429
+ """
430
+ Configure the CORS with various settings.
431
+
432
+ Parameters
433
+ ----------
434
+ **cors_config : dict
435
+ Configuration parameters for CORS. Must match the fields
436
+ expected by the Cors dataclass (orionis.foundation.config.cors.entities.cors.Cors).
437
+
438
+ Returns
439
+ -------
440
+ Application
441
+ The application instance for method chaining
442
+ """
443
+
444
+ # Create Cors instance with provided parameters
445
+ cors = Cors(**cors_config)
446
+
447
+ # Load configuration using Cors instance
448
+ self.loadConfigCors(cors)
449
+
450
+ # Return the application instance for method chaining
451
+ return self
452
+
385
453
  def loadConfigCors(
386
454
  self,
387
455
  cors: Cors
@@ -399,6 +467,7 @@ class Application(Container, IApplication):
399
467
  Application
400
468
  The application instance for method chaining
401
469
  """
470
+
402
471
  # Validate cors type
403
472
  if not isinstance(cors, Cors):
404
473
  raise TypeError(f"Expected Cors instance, got {type(cors).__name__}")
@@ -409,6 +478,34 @@ class Application(Container, IApplication):
409
478
  # Return the application instance for method chaining
410
479
  return self
411
480
 
481
+ def configDatabase(
482
+ self,
483
+ **database_config
484
+ ) -> 'Application':
485
+ """
486
+ Configure the database with various settings.
487
+
488
+ Parameters
489
+ ----------
490
+ **database_config : dict
491
+ Configuration parameters for database. Must match the fields
492
+ expected by the Database dataclass (orionis.foundation.config.database.entities.database.Database).
493
+
494
+ Returns
495
+ -------
496
+ Application
497
+ The application instance for method chaining
498
+ """
499
+
500
+ # Create Database instance with provided parameters
501
+ database = Database(**database_config)
502
+
503
+ # Load configuration using Database instance
504
+ self.loadConfigDatabase(database)
505
+
506
+ # Return the application instance for method chaining
507
+ return self
508
+
412
509
  def loadConfigDatabase(
413
510
  self,
414
511
  database: Database
@@ -426,6 +523,7 @@ class Application(Container, IApplication):
426
523
  Application
427
524
  The application instance for method chaining
428
525
  """
526
+
429
527
  # Validate database type
430
528
  if not isinstance(database, Database):
431
529
  raise TypeError(f"Expected Database instance, got {type(database).__name__}")
@@ -436,6 +534,34 @@ class Application(Container, IApplication):
436
534
  # Return the application instance for method chaining
437
535
  return self
438
536
 
537
+ def configFilesystems(
538
+ self,
539
+ **filesystems_config
540
+ ) -> 'Application':
541
+ """
542
+ Configure the filesystems with various settings.
543
+
544
+ Parameters
545
+ ----------
546
+ **filesystems_config : dict
547
+ Configuration parameters for filesystems. Must match the fields
548
+ expected by the Filesystems dataclass (orionis.foundation.config.filesystems.entitites.filesystems.Filesystems).
549
+
550
+ Returns
551
+ -------
552
+ Application
553
+ The application instance for method chaining
554
+ """
555
+
556
+ # Create Filesystems instance with provided parameters
557
+ filesystems = Filesystems(**filesystems_config)
558
+
559
+ # Load configuration using Filesystems instance
560
+ self.loadConfigFilesystems(filesystems)
561
+
562
+ # Return the application instance for method chaining
563
+ return self
564
+
439
565
  def loadConfigFilesystems(
440
566
  self,
441
567
  filesystems: Filesystems
@@ -453,6 +579,7 @@ class Application(Container, IApplication):
453
579
  Application
454
580
  The application instance for method chaining
455
581
  """
582
+
456
583
  # Validate filesystems type
457
584
  if not isinstance(filesystems, Filesystems):
458
585
  raise TypeError(f"Expected Filesystems instance, got {type(filesystems).__name__}")
@@ -463,6 +590,34 @@ class Application(Container, IApplication):
463
590
  # Return the application instance for method chaining
464
591
  return self
465
592
 
593
+ def configLogging(
594
+ self,
595
+ **logging_config
596
+ ) -> 'Application':
597
+ """
598
+ Configure the logging system with various channel settings.
599
+
600
+ Parameters
601
+ ----------
602
+ **logging_config : dict
603
+ Configuration parameters for logging. Must match the fields
604
+ expected by the Logging dataclass (orionis.foundation.config.logging.entities.logging.Logging).
605
+
606
+ Returns
607
+ -------
608
+ Application
609
+ The application instance for method chaining
610
+ """
611
+
612
+ # Create Logging instance with provided parameters
613
+ logging = Logging(**logging_config)
614
+
615
+ # Load configuration using Logging instance
616
+ self.loadConfigLogging(logging)
617
+
618
+ # Return the application instance for method chaining
619
+ return self
620
+
466
621
  def loadConfigLogging(
467
622
  self,
468
623
  logging: Logging
@@ -480,6 +635,7 @@ class Application(Container, IApplication):
480
635
  Application
481
636
  The application instance for method chaining
482
637
  """
638
+
483
639
  # Validate logging type
484
640
  if not isinstance(logging, Logging):
485
641
  raise TypeError(f"Expected Logging instance, got {type(logging).__name__}")
@@ -490,6 +646,34 @@ class Application(Container, IApplication):
490
646
  # Return the application instance for method chaining
491
647
  return self
492
648
 
649
+ def configMail(
650
+ self,
651
+ **mail_config
652
+ ) -> 'Application':
653
+ """
654
+ Configure the mail system with various settings.
655
+
656
+ Parameters
657
+ ----------
658
+ **mail_config : dict
659
+ Configuration parameters for mail. Must match the fields
660
+ expected by the Mail dataclass (orionis.foundation.config.mail.entities.mail.Mail).
661
+
662
+ Returns
663
+ -------
664
+ Application
665
+ The application instance for method chaining
666
+ """
667
+
668
+ # Create Mail instance with provided parameters
669
+ mail = Mail(**mail_config)
670
+
671
+ # Load configuration using Mail instance
672
+ self.loadConfigMail(mail)
673
+
674
+ # Return the application instance for method chaining
675
+ return self
676
+
493
677
  def loadConfigMail(
494
678
  self,
495
679
  mail: Mail
@@ -507,14 +691,41 @@ class Application(Container, IApplication):
507
691
  Application
508
692
  The application instance for method chaining
509
693
  """
694
+
510
695
  # Validate mail type
511
696
  if not isinstance(mail, Mail):
512
697
  raise TypeError(f"Expected Mail instance, got {type(mail).__name__}")
513
698
 
514
699
  # Store the configuration
515
- self.__configurators.append({
516
- 'mail' : mail
517
- })
700
+ self.__configurators['mail'] = mail
701
+
702
+ # Return the application instance for method chaining
703
+ return self
704
+
705
+ def configQueue(
706
+ self,
707
+ **queue_config
708
+ ) -> 'Application':
709
+ """
710
+ Configure the queue system with various settings.
711
+
712
+ Parameters
713
+ ----------
714
+ **queue_config : dict
715
+ Configuration parameters for queue. Must match the fields
716
+ expected by the Queue dataclass (orionis.foundation.config.queue.entities.queue.Queue).
717
+
718
+ Returns
719
+ -------
720
+ Application
721
+ The application instance for method chaining
722
+ """
723
+
724
+ # Create Queue instance with provided parameters
725
+ queue = Queue(**queue_config)
726
+
727
+ # Load configuration using Queue instance
728
+ self.loadConfigQueue(queue)
518
729
 
519
730
  # Return the application instance for method chaining
520
731
  return self
@@ -536,14 +747,41 @@ class Application(Container, IApplication):
536
747
  Application
537
748
  The application instance for method chaining
538
749
  """
750
+
539
751
  # Validate queue type
540
752
  if not isinstance(queue, Queue):
541
753
  raise TypeError(f"Expected Queue instance, got {type(queue).__name__}")
542
754
 
543
755
  # Store the configuration
544
- self.__configurators.append({
545
- 'queue' : queue
546
- })
756
+ self.__configurators['queue'] = queue
757
+
758
+ # Return the application instance for method chaining
759
+ return self
760
+
761
+ def configSession(
762
+ self,
763
+ **session_config
764
+ ) -> 'Application':
765
+ """
766
+ Configure the session with various settings.
767
+
768
+ Parameters
769
+ ----------
770
+ **session_config : dict
771
+ Configuration parameters for session. Must match the fields
772
+ expected by the Session dataclass (orionis.foundation.config.session.entities.session.Session).
773
+
774
+ Returns
775
+ -------
776
+ Application
777
+ The application instance for method chaining
778
+ """
779
+
780
+ # Create Session instance with provided parameters
781
+ session = Session(**session_config)
782
+
783
+ # Load configuration using Session instance
784
+ self.loadConfigSession(session)
547
785
 
548
786
  # Return the application instance for method chaining
549
787
  return self
@@ -565,75 +803,71 @@ class Application(Container, IApplication):
565
803
  Application
566
804
  The application instance for method chaining
567
805
  """
806
+
568
807
  # Validate session type
569
808
  if not isinstance(session, Session):
570
809
  raise TypeError(f"Expected Session instance, got {type(session).__name__}")
571
810
 
572
811
  # Store the configuration
573
- self.__configurators.append({
574
- 'session' : session
575
- })
812
+ self.__configurators['session'] = session
576
813
 
577
814
  # Return the application instance for method chaining
578
815
  return self
579
816
 
580
- def loadConfigTesting(
817
+ def configTesting(
581
818
  self,
582
- testing: Testing
819
+ **testing_config
583
820
  ) -> 'Application':
584
821
  """
585
- Load the application testing configuration from a Testing instance.
822
+ Configure the testing with various settings.
586
823
 
587
824
  Parameters
588
825
  ----------
589
- testing : Testing
590
- The Testing instance containing testing configuration
826
+ **testing_config : dict
827
+ Configuration parameters for testing. Must match the fields
828
+ expected by the Testing dataclass (orionis.foundation.config.testing.entities.testing.Testing).
591
829
 
592
830
  Returns
593
831
  -------
594
832
  Application
595
833
  The application instance for method chaining
596
834
  """
597
- # Validate testing type
598
- if not isinstance(testing, Testing):
599
- raise TypeError(f"Expected Testing instance, got {type(testing).__name__}")
600
835
 
601
- # Store the configuration
602
- self.__configurators.append({
603
- 'testing' : testing
604
- })
836
+ # Create Testing instance with provided parameters
837
+ testing = Testing(**testing_config)
838
+
839
+ # Load configuration using Testing instance
840
+ self.loadConfigTesting(testing)
605
841
 
606
842
  # Return the application instance for method chaining
607
843
  return self
608
844
 
609
- def create(
610
- self
845
+ def loadConfigTesting(
846
+ self,
847
+ testing: Testing
611
848
  ) -> 'Application':
612
849
  """
613
- Bootstrap the application by loading providers and kernels.
850
+ Load the application testing configuration from a Testing instance.
851
+
852
+ Parameters
853
+ ----------
854
+ testing : Testing
855
+ The Testing instance containing testing configuration
614
856
 
615
857
  Returns
616
858
  -------
617
859
  Application
618
860
  The application instance for method chaining
619
861
  """
620
- # Check if already booted
621
- if not self.__booted:
622
-
623
- # Load core framework components
624
- self.__loadFrameworkProviders()
625
- self.__loadFrameworksKernel()
626
862
 
627
- # Register and boot all providers
628
- self.__registerProviders()
629
- self.__bootProviders()
630
-
631
- # Load configuration if not already set
632
- self.__loadConfig()
863
+ # Validate testing type
864
+ if not isinstance(testing, Testing):
865
+ raise TypeError(f"Expected Testing instance, got {type(testing).__name__}")
633
866
 
634
- # Mark as booted
635
- self.__booted = True
867
+ # Store the configuration
868
+ self.__configurators['testing'] = testing
636
869
 
870
+ # Return the application instance for method chaining
637
871
  return self
638
872
 
639
873
  def __loadConfig(
@@ -657,6 +891,8 @@ class Application(Container, IApplication):
657
891
  # Initialize with default configuration
658
892
  if not self.__configurators:
659
893
  self.__config = Configuration().toDict()
894
+
895
+ # If configurators are provided, use them to create the configuration
660
896
  else:
661
897
  self.__config = Configuration(**self.__configurators).toDict()
662
898
 
@@ -665,6 +901,36 @@ class Application(Container, IApplication):
665
901
  # Handle any exceptions during configuration loading
666
902
  raise RuntimeError(f"Failed to load application configuration: {str(e)}")
667
903
 
904
+ def create(
905
+ self
906
+ ) -> 'Application':
907
+ """
908
+ Bootstrap the application by loading providers and kernels.
909
+
910
+ Returns
911
+ -------
912
+ Application
913
+ The application instance for method chaining
914
+ """
915
+ # Check if already booted
916
+ if not self.__booted:
917
+
918
+ # Load core framework components
919
+ self.__loadFrameworkProviders()
920
+ self.__loadFrameworksKernel()
921
+
922
+ # Register and boot all providers
923
+ self.__registerProviders()
924
+ self.__bootProviders()
925
+
926
+ # Load configuration if not already set
927
+ self.__loadConfig()
928
+
929
+ # Mark as booted
930
+ self.__booted = True
931
+
932
+ return self
933
+
668
934
  def config(
669
935
  self,
670
936
  key: str,
@@ -685,6 +951,11 @@ class Application(Container, IApplication):
685
951
  Any
686
952
  The configuration value or the entire configuration if key is None
687
953
  """
954
+
955
+ # Ensure the application is booted before accessing configuration
956
+ if not self.__booted:
957
+ raise RuntimeError("Application must be booted before accessing configuration. Call create() first.")
958
+
688
959
  # If key is None, raise an error to prevent ambiguity
689
960
  if key is None:
690
961
  raise ValueError("Key cannot be None. Use config() without arguments to get the entire configuration.")
@@ -697,10 +968,56 @@ class Application(Container, IApplication):
697
968
 
698
969
  # Traverse the config dictionary based on the key parts
699
970
  for part in parts:
971
+
972
+ # If part is not in config_value, return default
700
973
  if isinstance(config_value, dict) and part in config_value:
701
974
  config_value = config_value[part]
975
+
976
+ # If part is not found, return default value
702
977
  else:
703
978
  return default
704
979
 
705
980
  # Return the final configuration value
706
- return config_value
981
+ return config_value
982
+
983
+ def path(
984
+ self,
985
+ key: str,
986
+ default: str = None
987
+ ) -> Path:
988
+ """
989
+ Retrieve a path configuration value by key.
990
+
991
+ Parameters
992
+ ----------
993
+ key : str
994
+ The path key to retrieve using dot notation (e.g. "paths.storage")
995
+ default : str, optional
996
+ Default value to return if key is not found
997
+
998
+ Returns
999
+ -------
1000
+ Path
1001
+ The path value as a Path object or None if not found
1002
+ """
1003
+
1004
+ # Ensure the application is booted before accessing configuration
1005
+ if not self.__booted:
1006
+ raise RuntimeError("Application must be booted before accessing configuration. Call create() first.")
1007
+
1008
+ # If key is None, raise an error to prevent ambiguity
1009
+ if key is None:
1010
+ raise ValueError("Key cannot be None. Use path() without arguments to get the entire configuration.")
1011
+
1012
+ # Get the configuration value for the given key
1013
+ original_paths = self.config('paths')
1014
+
1015
+ # If original_paths is not a dictionary, return the default value as Path
1016
+ if not isinstance(original_paths, dict):
1017
+ return Path(default) if default is not None else None
1018
+
1019
+ # Get the path value from the dictionary
1020
+ path_value = original_paths.get(key, default)
1021
+
1022
+ # Return as Path object if value exists, otherwise return None
1023
+ return Path(path_value) if path_value is not None else None
@@ -1,8 +1,8 @@
1
1
  from abc import abstractmethod
2
+ from pathlib import Path
2
3
  from typing import Any, List, Type
3
4
  from orionis.container.contracts.service_provider import IServiceProvider
4
5
  from orionis.container.contracts.container import IContainer
5
- from orionis.foundation.config.startup import Configuration
6
6
  from orionis.foundation.config.app.entities.app import App
7
7
  from orionis.foundation.config.auth.entities.auth import Auth
8
8
  from orionis.foundation.config.cache.entities.cache import Cache
@@ -14,7 +14,6 @@ from orionis.foundation.config.mail.entities.mail import Mail
14
14
  from orionis.foundation.config.queue.entities.queue import Queue
15
15
  from orionis.foundation.config.session.entities.session import Session
16
16
  from orionis.foundation.config.testing.entities.testing import Testing
17
- from orionis.support.wrapper.dot_dict import DotDict
18
17
 
19
18
  class IApplication(IContainer):
20
19
  """
@@ -344,4 +343,225 @@ class IApplication(IContainer):
344
343
  Any
345
344
  The configuration value or the entire configuration if key is None
346
345
  """
346
+ pass
347
+
348
+ @abstractmethod
349
+ def configApp(self, **app_config) -> 'IApplication':
350
+ """
351
+ Configure the application with various settings.
352
+
353
+ Parameters
354
+ ----------
355
+ **app_config : dict
356
+ Configuration parameters for the application. Must match the fields
357
+ expected by the App dataclass (orionis.foundation.config.app.entities.app.App).
358
+
359
+ Returns
360
+ -------
361
+ IApplication
362
+ The application instance for method chaining
363
+ """
364
+ pass
365
+
366
+ @abstractmethod
367
+ def configAuth(self, **auth_config) -> 'IApplication':
368
+ """
369
+ Configure the authentication with various settings.
370
+
371
+ Parameters
372
+ ----------
373
+ **auth_config : dict
374
+ Configuration parameters for authentication. Must match the fields
375
+ expected by the Auth dataclass (orionis.foundation.config.auth.entities.auth.Auth).
376
+
377
+ Returns
378
+ -------
379
+ IApplication
380
+ The application instance for method chaining
381
+ """
382
+ pass
383
+
384
+ @abstractmethod
385
+ def configCache(self, **cache_config) -> 'IApplication':
386
+ """
387
+ Configure the cache with various settings.
388
+
389
+ Parameters
390
+ ----------
391
+ **cache_config : dict
392
+ Configuration parameters for cache. Must match the fields
393
+ expected by the Cache dataclass (orionis.foundation.config.cache.entities.cache.Cache).
394
+
395
+ Returns
396
+ -------
397
+ IApplication
398
+ The application instance for method chaining
399
+ """
400
+ pass
401
+
402
+ @abstractmethod
403
+ def configCors(self, **cors_config) -> 'IApplication':
404
+ """
405
+ Configure the CORS with various settings.
406
+
407
+ Parameters
408
+ ----------
409
+ **cors_config : dict
410
+ Configuration parameters for CORS. Must match the fields
411
+ expected by the Cors dataclass (orionis.foundation.config.cors.entities.cors.Cors).
412
+
413
+ Returns
414
+ -------
415
+ IApplication
416
+ The application instance for method chaining
417
+ """
418
+ pass
419
+
420
+ @abstractmethod
421
+ def configDatabase(self, **database_config) -> 'IApplication':
422
+ """
423
+ Configure the database with various settings.
424
+
425
+ Parameters
426
+ ----------
427
+ **database_config : dict
428
+ Configuration parameters for database. Must match the fields
429
+ expected by the Database dataclass (orionis.foundation.config.database.entities.database.Database).
430
+
431
+ Returns
432
+ -------
433
+ IApplication
434
+ The application instance for method chaining
435
+ """
436
+ pass
437
+
438
+ @abstractmethod
439
+ def configFilesystems(self, **filesystems_config) -> 'IApplication':
440
+ """
441
+ Configure the filesystems with various settings.
442
+
443
+ Parameters
444
+ ----------
445
+ **filesystems_config : dict
446
+ Configuration parameters for filesystems. Must match the fields
447
+ expected by the Filesystems dataclass (orionis.foundation.config.filesystems.entitites.filesystems.Filesystems).
448
+
449
+ Returns
450
+ -------
451
+ IApplication
452
+ The application instance for method chaining
453
+ """
454
+ pass
455
+
456
+ @abstractmethod
457
+ def configLogging(self, **logging_config) -> 'IApplication':
458
+ """
459
+ Configure the logging system with various channel settings.
460
+
461
+ Parameters
462
+ ----------
463
+ **logging_config : dict
464
+ Configuration parameters for logging. Must match the fields
465
+ expected by the Logging dataclass (orionis.foundation.config.logging.entities.logging.Logging).
466
+
467
+ Returns
468
+ -------
469
+ IApplication
470
+ The application instance for method chaining
471
+ """
472
+ pass
473
+
474
+ @abstractmethod
475
+ def configMail(self, **mail_config) -> 'IApplication':
476
+ """
477
+ Configure the mail system with various settings.
478
+
479
+ Parameters
480
+ ----------
481
+ **mail_config : dict
482
+ Configuration parameters for mail. Must match the fields
483
+ expected by the Mail dataclass (orionis.foundation.config.mail.entities.mail.Mail).
484
+
485
+ Returns
486
+ -------
487
+ IApplication
488
+ The application instance for method chaining
489
+ """
490
+ pass
491
+
492
+ @abstractmethod
493
+ def configQueue(self, **queue_config) -> 'IApplication':
494
+ """
495
+ Configure the queue system with various settings.
496
+
497
+ Parameters
498
+ ----------
499
+ **queue_config : dict
500
+ Configuration parameters for queue. Must match the fields
501
+ expected by the Queue dataclass (orionis.foundation.config.queue.entities.queue.Queue).
502
+
503
+ Returns
504
+ -------
505
+ IApplication
506
+ The application instance for method chaining
507
+ """
508
+ pass
509
+
510
+ @abstractmethod
511
+ def configSession(self, **session_config) -> 'IApplication':
512
+ """
513
+ Configure the session with various settings.
514
+
515
+ Parameters
516
+ ----------
517
+ **session_config : dict
518
+ Configuration parameters for session. Must match the fields
519
+ expected by the Session dataclass (orionis.foundation.config.session.entities.session.Session).
520
+
521
+ Returns
522
+ -------
523
+ IApplication
524
+ The application instance for method chaining
525
+ """
526
+ pass
527
+
528
+ @abstractmethod
529
+ def configTesting(self, **testing_config) -> 'IApplication':
530
+ """
531
+ Configure the testing with various settings.
532
+
533
+ Parameters
534
+ ----------
535
+ **testing_config : dict
536
+ Configuration parameters for testing. Must match the fields
537
+ expected by the Testing dataclass (orionis.foundation.config.testing.entities.testing.Testing).
538
+
539
+ Returns
540
+ -------
541
+ IApplication
542
+ The application instance for method chaining
543
+ """
544
+ pass
545
+
546
+ @abstractmethod
547
+ def path(
548
+ self,
549
+ key: str,
550
+ default: str = None
551
+ ) -> Path:
552
+ """
553
+ Retrieve a path configuration value by key.
554
+
555
+ Parameters
556
+ ----------
557
+ key : str
558
+ The path key to retrieve using dot notation (e.g. "paths.storage")
559
+ default : str, optional
560
+ Default value to return if key is not found
561
+
562
+ Returns
563
+ -------
564
+ Path
565
+ The path value as a Path object, or None if not found and no default is provided
566
+ """
347
567
  pass
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.392.0"
8
+ VERSION = "0.394.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
orionis/test/kernel.py CHANGED
@@ -92,10 +92,19 @@ class TestKernel(ITestKernel):
92
92
  """
93
93
  # Check if config is None and kwargs are provided
94
94
  if config is None:
95
+
96
+ # Try to create a Configuration instance with provided kwargs or default values
95
97
  try:
96
- # Attempt to create a Configuration instance with provided keyword arguments
97
- config = Configuration(**kwargs)
98
+ # If no kwargs are provided, create a default Configuration instance
99
+ if not kwargs:
100
+ config = Configuration(**self.__app.config('testing'))
101
+
102
+ # If kwargs are provided, create a Configuration instance with them
103
+ else:
104
+ config = Configuration(**kwargs)
105
+
98
106
  except TypeError:
107
+
99
108
  # If a TypeError occurs, it indicates that the provided arguments do not match the Configuration class
100
109
  required_fields = []
101
110
  for field in Configuration().getFields():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.392.0
3
+ Version: 0.394.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
@@ -148,7 +148,7 @@ orionis/container/validators/is_subclass.py,sha256=4sBaGLoRs8nUhuWjlP0VJqyTwVHYq
148
148
  orionis/container/validators/is_valid_alias.py,sha256=4uAYcq8xov7jZbXnpKpjNkxcZtlTNnL5RRctVPMwJes,1424
149
149
  orionis/container/validators/lifetime.py,sha256=IQ43fDNrxYHMlZH2zlYDJnlkLO_eS4U7Fs3UJgQBidI,1844
150
150
  orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
151
- orionis/foundation/application.py,sha256=KzwTNRNKTyFk60zM2YzX908OWpX2tZV49LWG-Ll73vQ,21962
151
+ orionis/foundation/application.py,sha256=lYj2m2B9vbvSjBZtm44CJaM_xtIPEPiV2U_5HL4eonU,32208
152
152
  orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
153
153
  orionis/foundation/config/startup.py,sha256=zutF-34DkW68bpiTxH9xrmIe1iJdXCF9Y6wueXS6qys,8265
154
154
  orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -237,7 +237,7 @@ orionis/foundation/config/testing/entities/testing.py,sha256=keU7dSuRv0rgaG-T4Vo
237
237
  orionis/foundation/config/testing/enums/__init__.py,sha256=tCHed6wBzqHx8o3kWBGm8tZYkYOKdSAx8TvgC-Eauv0,75
238
238
  orionis/foundation/config/testing/enums/test_mode.py,sha256=IbFpauu7J-iSAfmC8jDbmTEYl8eZr-AexL-lyOh8_74,337
239
239
  orionis/foundation/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
240
- orionis/foundation/contracts/application.py,sha256=rbR6sHgjcooIZGNYXtUGO5RLvG0c4iJxdhJ9PGfvycA,10011
240
+ orionis/foundation/contracts/application.py,sha256=T8BexSV2k8QDcaAO4q_4mJrXaAdY-QIKq8XKGPYMPoI,16585
241
241
  orionis/foundation/contracts/config.py,sha256=Rpz6U6t8OXHO9JJKSTnCimytXE-tfCB-1ithP2nG8MQ,628
242
242
  orionis/foundation/exceptions/__init__.py,sha256=XtG3MJ_MFNY_dU5mmTyz_N_4QG1jYrcv5RegBso7wuY,163
243
243
  orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
@@ -249,7 +249,7 @@ orionis/foundation/providers/path_resolver_provider.py,sha256=rXvaVc5sSqmDgRzWJo
249
249
  orionis/foundation/providers/progress_bar_provider.py,sha256=75Jr4iEgUOUGl8Di1DioeP5_HRQlR-1lVzPmS96sWjA,737
250
250
  orionis/foundation/providers/workers_provider.py,sha256=WWlji3C69_-Y0c42aZDbR_bmcE_qZEh2SaA_cNkCivI,702
251
251
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
252
- orionis/metadata/framework.py,sha256=NisdW45j_SD6TAcLF8gMsFcBApFsBQUUIv-dK8eH5yc,4960
252
+ orionis/metadata/framework.py,sha256=Wa85R4xbcnBwSXUKXco065QyqOUcMSzhdyD5-hPkfqk,4960
253
253
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
254
254
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
255
255
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -351,7 +351,7 @@ orionis/support/standard/exceptions/value.py,sha256=7xry_TZz3k-BLAZTR_uDiQ0RfXOk
351
351
  orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
352
352
  orionis/support/wrapper/dot_dict.py,sha256=VdAUH-DO6y86pl_9N6v-vU9mdLraWh5HjVzI5iC1dMs,5295
353
353
  orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
354
- orionis/test/kernel.py,sha256=_dzms3-5IuDNIE_JjaexwaoZhkHNvU-aAUEwOVtW8sc,13337
354
+ orionis/test/kernel.py,sha256=HJiGGpMVtjVXL7s0LnFNNWHeLgNUWoe8L49KYtzresg,13650
355
355
  orionis/test/arguments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
356
356
  orionis/test/arguments/parser.py,sha256=Oz09NCbQ9JrJgviiPJ92WbRa54rXWCsr6RDzPoh05vE,6019
357
357
  orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -386,7 +386,7 @@ orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
386
386
  orionis/test/records/logs.py,sha256=EOQcloMVdhlNl2lU9igQz8H4b-OtKtiwh2pgr_QZWOI,13186
387
387
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
388
388
  orionis/test/view/render.py,sha256=zd7xDvVfmQ2HxZamDTzL2-z2PpyL99EaolbbM7wTah4,5014
389
- orionis-0.392.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
389
+ orionis-0.394.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
390
390
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
391
391
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
392
392
  tests/example/test_example.py,sha256=8G7kp74PZZ0Tdnw8WkheZ7lvZVFpdx_9ShOZBN9GEF0,25582
@@ -487,8 +487,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=nTNrvJkMSPx_aopEQ9
487
487
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
488
488
  tests/testing/test_testing_result.py,sha256=fnH7hjumNSErAFGITJgq2LHxSzvPF2tdtmHL9kyAv-Y,4409
489
489
  tests/testing/test_testing_unit.py,sha256=d3CRGo6608fMzYcZKIKapjx_af2aigqWiKSiuK9euIY,7600
490
- orionis-0.392.0.dist-info/METADATA,sha256=L0ZAamDSA8QCzLav3v6ap9XqDINAFWIC0Y0TTS7HLQk,4772
491
- orionis-0.392.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
492
- orionis-0.392.0.dist-info/top_level.txt,sha256=udNmZ4TdfoC-7CBFJO7HLpWggpCM71okNNgNVzgpjt4,21
493
- orionis-0.392.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
494
- orionis-0.392.0.dist-info/RECORD,,
490
+ orionis-0.394.0.dist-info/METADATA,sha256=-oHteCguDB1_xuZQNBOPuDD2_22iUEUSLz85CBzevjg,4772
491
+ orionis-0.394.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
492
+ orionis-0.394.0.dist-info/top_level.txt,sha256=udNmZ4TdfoC-7CBFJO7HLpWggpCM71okNNgNVzgpjt4,21
493
+ orionis-0.394.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
494
+ orionis-0.394.0.dist-info/RECORD,,