orionis 0.507.0__py3-none-any.whl → 0.509.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.
orionis/app.py CHANGED
@@ -1,19 +1,28 @@
1
+ from pathlib import Path
1
2
  from orionis.foundation.application import Application, IApplication
2
3
 
3
- def Orionis() -> IApplication:
4
+ def Orionis(basePath: str | Path = Path.cwd().resolve()) -> IApplication:
4
5
  """
5
- Creates and returns the main Orionis application instance.
6
+ Initializes and returns the main Orionis application instance.
6
7
 
7
- This function initializes the core application object that implements the `IApplication` interface.
8
- It serves as the primary entry point for creating and accessing the main application instance,
9
- ensuring that the application is properly set up before use.
8
+ This function creates the core application object that implements the `IApplication` interface.
9
+ It acts as the primary entry point for setting up and accessing the main application instance,
10
+ ensuring that the application is initialized with the specified base path.
11
+
12
+ Parameters
13
+ ----------
14
+ basePath : str or Path, optional
15
+ The base directory path for the application. Defaults to the current working directory.
10
16
 
11
17
  Returns
12
18
  -------
13
19
  IApplication
14
- An instance of `Application` that implements the `IApplication` interface, representing
15
- the main Orionis application.
20
+ The initialized `Application` instance implementing the `IApplication` interface,
21
+ configured with the provided base path.
16
22
  """
17
23
 
18
24
  # Instantiate the main application object implementing IApplication
19
- return Application()
25
+ app: IApplication = Application()
26
+
27
+ # Set the base path for the application and return the configured instance
28
+ return app.setBasePath(basePath)
@@ -123,6 +123,9 @@ class Application(Container, IApplication):
123
123
  # Property to store the exception handler class
124
124
  self.__exception_handler: Type[BaseExceptionHandler] = None
125
125
 
126
+ # Base path for the application, used for relative paths
127
+ self.__bootstrap_base_path: str | Path = None
128
+
126
129
  # Flag to prevent re-initialization
127
130
  self.__initialized = True
128
131
 
@@ -1377,7 +1380,6 @@ class Application(Container, IApplication):
1377
1380
  def setPaths(
1378
1381
  self,
1379
1382
  *,
1380
- root: str | Path = Path.cwd().resolve(),
1381
1383
  commands: str | Path = (Path.cwd() / 'app' / 'console' / 'commands').resolve(),
1382
1384
  controllers: str | Path = (Path.cwd() / 'app' / 'http' / 'controllers').resolve(),
1383
1385
  middleware: str | Path = (Path.cwd() / 'app' / 'http' / 'middleware').resolve(),
@@ -1415,8 +1417,6 @@ class Application(Container, IApplication):
1415
1417
 
1416
1418
  Parameters
1417
1419
  ----------
1418
- root : str or Path, optional
1419
- Root directory of the application. Defaults to the current working directory.
1420
1420
  commands : str or Path, optional
1421
1421
  Directory for console command classes. Defaults to 'app/console/commands'.
1422
1422
  controllers : str or Path, optional
@@ -1483,7 +1483,7 @@ class Application(Container, IApplication):
1483
1483
  # Prepare and store all resolved paths as strings in the configurators dictionary
1484
1484
  # Ensure 'paths' exists in configurators
1485
1485
  self.__configurators['path'] = {
1486
- 'root' : str(root),
1486
+ 'root' : self.__bootstrap_base_path or str(Path.cwd().resolve()),
1487
1487
  'commands' : str(commands),
1488
1488
  'controllers' : str(controllers),
1489
1489
  'middleware' : str(middleware),
@@ -1555,6 +1555,9 @@ class Application(Container, IApplication):
1555
1555
 
1556
1556
  # If paths is a dict, convert it to Paths instance
1557
1557
  if isinstance(paths, dict):
1558
+ paths.update({
1559
+ 'root': self.__bootstrap_base_path or str(Path.cwd().resolve())
1560
+ })
1558
1561
  paths = Paths(**paths)
1559
1562
 
1560
1563
  # Store the configuration
@@ -1563,6 +1566,52 @@ class Application(Container, IApplication):
1563
1566
  # Return the application instance for method chaining
1564
1567
  return self
1565
1568
 
1569
+ def setBasePath(
1570
+ self,
1571
+ basePath: str | Path
1572
+ ) -> 'Application':
1573
+ """
1574
+ Set the base path for the application.
1575
+
1576
+ This method allows setting the base path of the application, which is
1577
+ used as the root directory for all relative paths in the application.
1578
+ The provided basePath is resolved to an absolute path.
1579
+
1580
+ Parameters
1581
+ ----------
1582
+ basePath : str or Path
1583
+ The base path to set for the application. It can be a string or a Path object.
1584
+
1585
+ Returns
1586
+ -------
1587
+ Application
1588
+ The current application instance to enable method chaining.
1589
+ """
1590
+
1591
+ # Resolve and store the base path as a string
1592
+ self.__bootstrap_base_path = str(Path(basePath).resolve())
1593
+
1594
+ # Return self instance for method chaining
1595
+ return self
1596
+
1597
+ def getBasePath(
1598
+ self
1599
+ ) -> str | Path:
1600
+ """
1601
+ Get the base path of the application.
1602
+
1603
+ This method returns the base path that was previously set using setBasePath().
1604
+ If no base path has been set, it returns None.
1605
+
1606
+ Returns
1607
+ -------
1608
+ str or Path
1609
+ The base path of the application as a string or Path object, or None if not set.
1610
+ """
1611
+
1612
+ # Return the base path if set, otherwise None
1613
+ return self.__bootstrap_base_path if self.__bootstrap_base_path else Path.cwd().resolve()
1614
+
1566
1615
  def setConfigQueue(
1567
1616
  self,
1568
1617
  **queue_config
@@ -689,6 +689,47 @@ class IApplication(IContainer):
689
689
  """
690
690
  pass
691
691
 
692
+ @abstractmethod
693
+ def setBasePath(
694
+ self,
695
+ basePath: str | Path
696
+ ) -> 'IApplication':
697
+ """
698
+ Set the base path for the application.
699
+
700
+ This method allows setting the base path of the application, which is
701
+ used as the root directory for all relative paths in the application.
702
+ The provided basePath is resolved to an absolute path.
703
+
704
+ Parameters
705
+ ----------
706
+ basePath : str or Path
707
+ The base path to set for the application. It can be a string or a Path object.
708
+
709
+ Returns
710
+ -------
711
+ Application
712
+ The current application instance to enable method chaining.
713
+ """
714
+ pass
715
+
716
+ @abstractmethod
717
+ def getBasePath(
718
+ self
719
+ ) -> str | Path:
720
+ """
721
+ Get the base path of the application.
722
+
723
+ This method returns the base path that was previously set using setBasePath().
724
+ If no base path has been set, it returns None.
725
+
726
+ Returns
727
+ -------
728
+ str or Path
729
+ The base path of the application as a string or Path object, or None if not set.
730
+ """
731
+ pass
732
+
692
733
  @abstractmethod
693
734
  def setConfigQueue(self, **queue_config) -> 'IApplication':
694
735
  """
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.507.0"
8
+ VERSION = "0.509.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.507.0
3
+ Version: 0.509.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
@@ -1,5 +1,5 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- orionis/app.py,sha256=bRZo4WbTXf9UidNc09Pm-kn1pIO9Hj86xCEJ-rpz2wQ,742
2
+ orionis/app.py,sha256=foCcJAfebeZD69wsAiNvPUx_7UMK6w8ow5WpVjzwDDk,1131
3
3
  orionis/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  orionis/console/kernel.py,sha256=m4RoulZB3nkl6-O250UDN4ZoXqfTF4F5gbAYt7TAnQo,3054
5
5
  orionis/console/args/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -103,7 +103,7 @@ orionis/failure/contracts/handler.py,sha256=4N9yMkMgdhtHbRGAyCtuTx3GmkPP74vhqdRL
103
103
  orionis/failure/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
104
104
  orionis/failure/entities/throwable.py,sha256=ogys062uhim5QMYU62ezlnumRAnYQlUf_vZvQY47S3U,1227
105
105
  orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
- orionis/foundation/application.py,sha256=tcOqqw49TNIKh7CJGWT2wghPeRPmYcY20KtOSMX89LU,82200
106
+ orionis/foundation/application.py,sha256=4fkbnb2r7rfyn0_0JIX-wG-hRZzRVLQySWO7v4a_4e0,83797
107
107
  orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
108
  orionis/foundation/config/startup.py,sha256=vbzduprRCNyYeR2nnMaqc1uKXw6PTzAY2jVfXNQKN8I,9691
109
109
  orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -197,7 +197,7 @@ orionis/foundation/config/testing/enums/drivers.py,sha256=mwv47FcKDXEOxydQXAGtkd
197
197
  orionis/foundation/config/testing/enums/mode.py,sha256=IbFpauu7J-iSAfmC8jDbmTEYl8eZr-AexL-lyOh8_74,337
198
198
  orionis/foundation/config/testing/enums/verbosity.py,sha256=Z-FQ6C3rxbRwP8HoVibbgRMGcsen2SwTuEy3wnjdIhc,486
199
199
  orionis/foundation/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
200
- orionis/foundation/contracts/application.py,sha256=SyO8m9qw5P8E60zJ1WCitc9llvEaWkT2CLPrkDIBIq0,31610
200
+ orionis/foundation/contracts/application.py,sha256=lkNaToQgQzYC3lBYac5XWUdHkQ4JjLFJziLyVd0-0Os,32799
201
201
  orionis/foundation/contracts/config.py,sha256=mCyA43f0n_e-CEL0f-sWWgE-M7GicS_aEtC_TNbn_yc,802
202
202
  orionis/foundation/exceptions/__init__.py,sha256=q6we1N8kcd6j6GjUJY30WQhhHnqF9RXA0c6-ksEztlc,294
203
203
  orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
@@ -219,7 +219,7 @@ orionis/foundation/providers/scheduler_provider.py,sha256=72SoixFog9IOE9Ve9Xcfw6
219
219
  orionis/foundation/providers/testing_provider.py,sha256=SrJRpdvcblx9WvX7x9Y3zc7OQfiTf7la0HAJrm2ESlE,3725
220
220
  orionis/foundation/providers/workers_provider.py,sha256=oa_2NIDH6UxZrtuGkkoo_zEoNIMGgJ46vg5CCgAm7wI,3926
221
221
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
222
- orionis/metadata/framework.py,sha256=fFR8Cs3ZS8FjoV9AhPPcw-3A_6DGHTpumC7OCWp-mGo,4109
222
+ orionis/metadata/framework.py,sha256=Tejlws5qzPRGf2jkv4S6ToMbVcSY82L_fTpWZ9xsmgo,4109
223
223
  orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
224
224
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
225
225
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -395,7 +395,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
395
395
  orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
396
396
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
397
397
  orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
398
- orionis-0.507.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
398
+ orionis-0.509.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
399
399
  tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
400
400
  tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
401
401
  tests/container/context/test_manager.py,sha256=wOwXpl9rHNfTTexa9GBKYMwK0_-KSQPbI-AEyGNkmAE,1356
@@ -541,8 +541,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
541
541
  tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
542
542
  tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
543
543
  tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
544
- orionis-0.507.0.dist-info/METADATA,sha256=jTF7G9c5k9OZectyJLiq480nITd4_ccGQwDRRet0dnQ,4801
545
- orionis-0.507.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
546
- orionis-0.507.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
547
- orionis-0.507.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
548
- orionis-0.507.0.dist-info/RECORD,,
544
+ orionis-0.509.0.dist-info/METADATA,sha256=ht_FBKA7hs3E_vXmp07pN4URCFqJXsLhBJA7ZpkIVng,4801
545
+ orionis-0.509.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
546
+ orionis-0.509.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
547
+ orionis-0.509.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
548
+ orionis-0.509.0.dist-info/RECORD,,