orionis 0.267.0__py3-none-any.whl → 0.269.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/framework.py +24 -6
- {orionis-0.267.0.dist-info → orionis-0.269.0.dist-info}/METADATA +4 -2
- {orionis-0.267.0.dist-info → orionis-0.269.0.dist-info}/RECORD +7 -20
- orionis/clinstall.py +0 -34
- orionis/installer/__init__.py +0 -0
- orionis/installer/contracts/__init__.py +0 -0
- orionis/installer/contracts/manager.py +0 -66
- orionis/installer/contracts/output.py +0 -39
- orionis/installer/contracts/setup.py +0 -28
- orionis/installer/manager.py +0 -85
- orionis/installer/output.py +0 -256
- orionis/installer/setup.py +0 -192
- orionis/static/ascii/icon.ascii +0 -13
- orionis/static/ascii/info.ascii +0 -15
- orionis/static/bg/galaxy.jpg +0 -0
- orionis-0.267.0.dist-info/entry_points.txt +0 -2
- {orionis-0.267.0.dist-info → orionis-0.269.0.dist-info}/WHEEL +0 -0
- {orionis-0.267.0.dist-info → orionis-0.269.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.267.0.dist-info → orionis-0.269.0.dist-info}/top_level.txt +0 -0
- {orionis-0.267.0.dist-info → orionis-0.269.0.dist-info}/zip-safe +0 -0
orionis/framework.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
NAME = "orionis"
|
6
6
|
|
7
7
|
# Current version of the framework
|
8
|
-
VERSION = "0.
|
8
|
+
VERSION = "0.269.0"
|
9
9
|
|
10
10
|
# Full name of the author or maintainer of the project
|
11
11
|
AUTHOR = "Raul Mauricio Uñate Castro"
|
@@ -83,11 +83,7 @@ KEYWORDS = [
|
|
83
83
|
"framework",
|
84
84
|
"python",
|
85
85
|
"orionis-framework",
|
86
|
-
"django",
|
87
|
-
"flask",
|
88
|
-
"fastapi",
|
89
86
|
"starlette",
|
90
|
-
"werkzeug",
|
91
87
|
"uvicorn"
|
92
88
|
]
|
93
89
|
|
@@ -116,4 +112,26 @@ def get_requires():
|
|
116
112
|
return [
|
117
113
|
">=".join(requirement)
|
118
114
|
for requirement in REQUIRES
|
119
|
-
]
|
115
|
+
]
|
116
|
+
|
117
|
+
def get_svg_assets():
|
118
|
+
"""
|
119
|
+
Returns the SVG code for the project's icon and text images.
|
120
|
+
|
121
|
+
Reads the SVG files and returns their contents as strings.
|
122
|
+
|
123
|
+
Returns:
|
124
|
+
dict: Dictionary with 'icon' and 'text' keys containing SVG code as strings.
|
125
|
+
"""
|
126
|
+
import os
|
127
|
+
current_dir = os.path.dirname(__file__)
|
128
|
+
icon_path = os.path.join(current_dir, "static", "svg", "logo.svg")
|
129
|
+
text_path = os.path.join(current_dir, "static", "svg", "text.svg")
|
130
|
+
with open(icon_path, 'r', encoding='utf-8') as icon_file:
|
131
|
+
icon_svg = icon_file.read()
|
132
|
+
with open(text_path, 'r', encoding='utf-8') as text_file:
|
133
|
+
text_svg = text_file.read()
|
134
|
+
return {
|
135
|
+
'icon': icon_svg,
|
136
|
+
'text': text_svg,
|
137
|
+
}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: orionis
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.269.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
|
7
7
|
Author-email: raulmauriciounate@gmail.com
|
8
|
-
|
8
|
+
License: MIT
|
9
|
+
Keywords: orionis,framework,python,orionis-framework,starlette,uvicorn
|
9
10
|
Classifier: Development Status :: 3 - Alpha
|
10
11
|
Classifier: Environment :: Web Environment
|
11
12
|
Classifier: Intended Audience :: Developers
|
@@ -38,6 +39,7 @@ Dynamic: description
|
|
38
39
|
Dynamic: description-content-type
|
39
40
|
Dynamic: home-page
|
40
41
|
Dynamic: keywords
|
42
|
+
Dynamic: license
|
41
43
|
Dynamic: license-file
|
42
44
|
Dynamic: requires-dist
|
43
45
|
Dynamic: requires-python
|
@@ -1,16 +1,7 @@
|
|
1
1
|
orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
orionis/application.py,sha256=EK1ErClgoEwQ4sj-3RXZ9dx1WpJCFlpyYD1d2u9Rdyg,129
|
3
|
-
orionis/
|
4
|
-
orionis/framework.py,sha256=HTtPzwL3F-dwRJfkiLLiBCYC2CYOXhFk9V5ztLS9Q2o,4266
|
3
|
+
orionis/framework.py,sha256=dVHEens5YsBZFHe-iZ_5bbKWaGvYTnrIkB82cg4PxtI,4960
|
5
4
|
orionis/unittesting.py,sha256=bGDkjHtI1G0DYui_atBJ3fXdDY9nD5h0gVEpiGu0dfM,1291
|
6
|
-
orionis/installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
orionis/installer/manager.py,sha256=Li4TVziRXWfum02xNG4JHwbnLk-u8xzHjdqKz-D894k,2755
|
8
|
-
orionis/installer/output.py,sha256=7O9qa2xtXMB_4ZvVi-Klneom9YazwygAd_4uYAoxhbU,8548
|
9
|
-
orionis/installer/setup.py,sha256=w5YBWN_wE_sLQ7cUSXomUgPH5lp5tfqnEfa1MUcFEok,7383
|
10
|
-
orionis/installer/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
orionis/installer/contracts/manager.py,sha256=Zfndhuyu0JaTKo3PsGsKmVsvotQMw8Pmt4KQp97elY8,1567
|
12
|
-
orionis/installer/contracts/output.py,sha256=t1KLw610-hHy63UbFFE2BYwWHWRbW8_ofuEvRLx_IUE,983
|
13
|
-
orionis/installer/contracts/setup.py,sha256=aWYkCv-z48bXXZynYapc3uMIE1gyO6XnkTw3b4MTBq4,784
|
14
5
|
orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
6
|
orionis/luminate/_application.py,sha256=e9_XZ4zFoTTVQJLHUhUAwdX7OpcwRAvcoQiU3sFb314,9504
|
16
7
|
orionis/luminate/app.py,sha256=BY2cjdrMZ0_CgNpBCY0s3YrlFPMwkBiuXjePeewhbB8,702
|
@@ -331,10 +322,7 @@ orionis/luminate/test/suites/test_unit.py,sha256=d1N70kqdNmZNx9rwTqYugVmQ-knXUDU
|
|
331
322
|
orionis/luminate/test/suites/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
332
323
|
orionis/luminate/test/suites/contracts/test_suite.py,sha256=1f7T8ez_AMpMJM73aYzX_ryeTJBlYaEqI8TB0HCkvjY,906
|
333
324
|
orionis/luminate/test/suites/contracts/test_unit.py,sha256=wWIlSNX-C2Yi98UrU-B_1bEpjj8iewlD_FQzulqszmk,5605
|
334
|
-
orionis/
|
335
|
-
orionis/static/ascii/info.ascii,sha256=HF_o2eXaiw5iqcOhHfnPByn5GJ_O2eBwSK3IpTfYOwY,457
|
336
|
-
orionis/static/bg/galaxy.jpg,sha256=_FuPghOe9LBrIWv1eKZ9fiZR72sEz5obvXGDnD7MzTc,172244
|
337
|
-
orionis-0.267.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
325
|
+
orionis-0.269.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
338
326
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
339
327
|
tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
340
328
|
tests/example/test_example.py,sha256=aWTi5PQJT7m-J_jsnZFBEgcEGlutm0lA9P0yS69qnqE,592
|
@@ -432,9 +420,8 @@ tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py,sha256=
|
|
432
420
|
tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
433
421
|
tests/testing/test_testing_result.py,sha256=54QDn6_v9feIcDcA6LPXcvYhlt_X8JqLGTYWS9XjKXM,3029
|
434
422
|
tests/testing/test_testing_unit.py,sha256=ddtpjNKfjCfpnoB8psjQitMtl6p0mY3mhzj3B64hvyE,5452
|
435
|
-
orionis-0.
|
436
|
-
orionis-0.
|
437
|
-
orionis-0.
|
438
|
-
orionis-0.
|
439
|
-
orionis-0.
|
440
|
-
orionis-0.267.0.dist-info/RECORD,,
|
423
|
+
orionis-0.269.0.dist-info/METADATA,sha256=d0KFIoPDF_yLQVRjLz0ocOt1qYO-Lfmd1SjG2ZnJEQ8,4340
|
424
|
+
orionis-0.269.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
425
|
+
orionis-0.269.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
426
|
+
orionis-0.269.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
427
|
+
orionis-0.269.0.dist-info/RECORD,,
|
orionis/clinstall.py
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
import argparse
|
2
|
-
from orionis.installer.manager import InstallerManager
|
3
|
-
from orionis.luminate.console.output.console import Console
|
4
|
-
|
5
|
-
# Main entry point for the Orionis CLI Installer.
|
6
|
-
def main():
|
7
|
-
|
8
|
-
# Initialize the argument parser
|
9
|
-
parser = argparse.ArgumentParser(description="Orionis Command Line Tool")
|
10
|
-
parser.add_argument('--version', action='store_true', help="Show Orionis version.")
|
11
|
-
parser.add_argument('--upgrade', action='store_true', help="Upgrade Orionis to the latest version.")
|
12
|
-
parser.add_argument('command', nargs='?', choices=['new'], help="Available command: 'new'.")
|
13
|
-
parser.add_argument('name', nargs='?', help="The name of the Orionis application to create.", default="example-app")
|
14
|
-
|
15
|
-
# Parse the provided arguments
|
16
|
-
args = parser.parse_args()
|
17
|
-
|
18
|
-
# Initialize the Orionis tools for handling operations
|
19
|
-
try:
|
20
|
-
installer = InstallerManager()
|
21
|
-
if args.version:
|
22
|
-
installer.handleVersion()
|
23
|
-
elif args.upgrade:
|
24
|
-
installer.handleUpgrade()
|
25
|
-
elif args.command == 'new':
|
26
|
-
installer.handleNewApp(args.name)
|
27
|
-
else:
|
28
|
-
installer.handleInfo()
|
29
|
-
except Exception as e:
|
30
|
-
Console.exception(e)
|
31
|
-
|
32
|
-
# Execute the main function if the script is run directly
|
33
|
-
if __name__ == "__main__":
|
34
|
-
main()
|
orionis/installer/__init__.py
DELETED
File without changes
|
File without changes
|
@@ -1,66 +0,0 @@
|
|
1
|
-
|
2
|
-
from abc import ABC, abstractmethod
|
3
|
-
|
4
|
-
class IInstallerManager(ABC):
|
5
|
-
"""
|
6
|
-
Interface for the InstallerManager class.
|
7
|
-
"""
|
8
|
-
|
9
|
-
@abstractmethod
|
10
|
-
def handleVersion(self) -> str:
|
11
|
-
"""
|
12
|
-
Display the current version of the framework in ASCII format.
|
13
|
-
|
14
|
-
Returns
|
15
|
-
-------
|
16
|
-
str
|
17
|
-
The ASCII representation of the framework version.
|
18
|
-
|
19
|
-
Raises
|
20
|
-
------
|
21
|
-
Exception
|
22
|
-
If an error occurs while generating the ASCII version output.
|
23
|
-
"""
|
24
|
-
pass
|
25
|
-
|
26
|
-
@abstractmethod
|
27
|
-
def handleUpgrade(self) -> None:
|
28
|
-
"""
|
29
|
-
Execute the framework upgrade process to the latest version.
|
30
|
-
|
31
|
-
Raises
|
32
|
-
------
|
33
|
-
Exception
|
34
|
-
If an error occurs during the upgrade process.
|
35
|
-
"""
|
36
|
-
pass
|
37
|
-
|
38
|
-
|
39
|
-
@abstractmethod
|
40
|
-
def handleNewApp(self, name_app: str = "example-app") -> None:
|
41
|
-
"""
|
42
|
-
Create a new application with the specified name.
|
43
|
-
|
44
|
-
Parameters
|
45
|
-
----------
|
46
|
-
name_app : str, optional
|
47
|
-
The name of the new application (default is "example-app").
|
48
|
-
|
49
|
-
Raises
|
50
|
-
------
|
51
|
-
Exception
|
52
|
-
If an error occurs during the application setup.
|
53
|
-
"""
|
54
|
-
pass
|
55
|
-
|
56
|
-
@abstractmethod
|
57
|
-
def handleInfo(self) -> None:
|
58
|
-
"""
|
59
|
-
Display additional framework information in ASCII format.
|
60
|
-
|
61
|
-
Raises
|
62
|
-
------
|
63
|
-
Exception
|
64
|
-
If an error occurs while displaying information.
|
65
|
-
"""
|
66
|
-
pass
|
@@ -1,39 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
|
3
|
-
class IInstallerOutput(ABC):
|
4
|
-
|
5
|
-
@abstractmethod
|
6
|
-
def printHelp(self):
|
7
|
-
"""
|
8
|
-
Prints the help message with available commands.
|
9
|
-
|
10
|
-
If the ASCII file is not found, it falls back to a basic message.
|
11
|
-
"""
|
12
|
-
pass
|
13
|
-
|
14
|
-
@abstractmethod
|
15
|
-
def printIcon(self):
|
16
|
-
"""
|
17
|
-
Prints the Orionis icon with a motivational message.
|
18
|
-
|
19
|
-
If the ASCII file is not found, it falls back to a basic message.
|
20
|
-
"""
|
21
|
-
pass
|
22
|
-
|
23
|
-
@abstractmethod
|
24
|
-
def printStartInstallation(self):
|
25
|
-
"""
|
26
|
-
Prints the start of the installation message.
|
27
|
-
|
28
|
-
Displays the Orionis icon and a thank you message.
|
29
|
-
"""
|
30
|
-
pass
|
31
|
-
|
32
|
-
@abstractmethod
|
33
|
-
def printEndInstallation(self):
|
34
|
-
"""
|
35
|
-
Prints the end of the installation message.
|
36
|
-
|
37
|
-
Displays a welcome message and encourages the user to start using the framework.
|
38
|
-
"""
|
39
|
-
pass
|
@@ -1,28 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
|
3
|
-
class IInstallerSetup(ABC):
|
4
|
-
"""
|
5
|
-
Interface for the InstallerSetup class.
|
6
|
-
"""
|
7
|
-
|
8
|
-
@abstractmethod
|
9
|
-
def handle(self):
|
10
|
-
"""
|
11
|
-
Executes the setup process for initializing the Orionis project.
|
12
|
-
|
13
|
-
This process includes:
|
14
|
-
1. Cloning the repository.
|
15
|
-
2. Creating a virtual environment.
|
16
|
-
3. Installing dependencies from requirements.txt.
|
17
|
-
4. Setting up the .env file.
|
18
|
-
5. Generating an API key.
|
19
|
-
6. Cleaning up temporary files and .git remote origin.
|
20
|
-
|
21
|
-
Raises
|
22
|
-
------
|
23
|
-
ValueError
|
24
|
-
If there is an error during any subprocess execution.
|
25
|
-
Exception
|
26
|
-
If any unexpected error occurs.
|
27
|
-
"""
|
28
|
-
pass
|
orionis/installer/manager.py
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
import subprocess
|
2
|
-
import sys
|
3
|
-
from orionis.installer.contracts.manager import IInstallerManager
|
4
|
-
from orionis.installer.contracts.output import IInstallerOutput
|
5
|
-
from orionis.installer.output import InstallerOutput
|
6
|
-
from orionis.installer.setup import InstallerSetup
|
7
|
-
|
8
|
-
class InstallerManager(IInstallerManager):
|
9
|
-
"""
|
10
|
-
Management class responsible for handling framework-related operations.
|
11
|
-
|
12
|
-
This class provides methods to display the framework version, execute upgrades,
|
13
|
-
create new applications, and display additional information.
|
14
|
-
|
15
|
-
Attributes
|
16
|
-
----------
|
17
|
-
_output : InstallerOutput
|
18
|
-
Instance of InstallerOutput to manage command-line display messages.
|
19
|
-
"""
|
20
|
-
|
21
|
-
def __init__(self):
|
22
|
-
"""
|
23
|
-
Initialize the Management class with an output handler.
|
24
|
-
"""
|
25
|
-
self._output : IInstallerOutput = InstallerOutput()
|
26
|
-
|
27
|
-
def handleVersion(self) -> str:
|
28
|
-
"""
|
29
|
-
Display the current version of the framework in ASCII format.
|
30
|
-
|
31
|
-
Returns
|
32
|
-
-------
|
33
|
-
str
|
34
|
-
The ASCII representation of the framework version.
|
35
|
-
"""
|
36
|
-
return self._output.printIcon()
|
37
|
-
|
38
|
-
def handleUpgrade(self) -> None:
|
39
|
-
"""
|
40
|
-
Execute the framework upgrade process to the latest version.
|
41
|
-
|
42
|
-
Raises
|
43
|
-
------
|
44
|
-
RuntimeError
|
45
|
-
If an error occurs during the upgrade process.
|
46
|
-
"""
|
47
|
-
try:
|
48
|
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "orionis"])
|
49
|
-
except subprocess.CalledProcessError as e:
|
50
|
-
raise RuntimeError(f"Upgrade failed: {e}")
|
51
|
-
except Exception as e:
|
52
|
-
raise RuntimeError(f"Upgrade failed: {e}")
|
53
|
-
|
54
|
-
def handleNewApp(self, name_app: str = "example-app") -> None:
|
55
|
-
"""
|
56
|
-
Create a new application with the specified name.
|
57
|
-
|
58
|
-
Parameters
|
59
|
-
----------
|
60
|
-
name_app : str, optional
|
61
|
-
The name of the new application (default is "example-app").
|
62
|
-
|
63
|
-
Raises
|
64
|
-
------
|
65
|
-
RuntimeError
|
66
|
-
If an error occurs during the application setup.
|
67
|
-
"""
|
68
|
-
try:
|
69
|
-
return InstallerSetup(name=name_app, output=self._output).handle()
|
70
|
-
except Exception as e:
|
71
|
-
raise RuntimeError(f"Failed to create new app: {e}")
|
72
|
-
|
73
|
-
def handleInfo(self) -> None:
|
74
|
-
"""
|
75
|
-
Display additional framework information in ASCII format.
|
76
|
-
|
77
|
-
Raises
|
78
|
-
------
|
79
|
-
RuntimeError
|
80
|
-
If an error occurs while displaying information.
|
81
|
-
"""
|
82
|
-
try:
|
83
|
-
self._output.printHelp()
|
84
|
-
except Exception as e:
|
85
|
-
raise RuntimeError(f"Failed to display information: {e}")
|
orionis/installer/output.py
DELETED
@@ -1,256 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import datetime
|
3
|
-
import requests
|
4
|
-
from orionis.framework import API, NAME, VERSION, DOCS
|
5
|
-
from orionis.installer.contracts.output import IInstallerOutput
|
6
|
-
|
7
|
-
class InstallerOutput(IInstallerOutput):
|
8
|
-
"""
|
9
|
-
A class to handle the output and display messages for the Orionis installer.
|
10
|
-
|
11
|
-
This class provides methods to load ASCII art, format messages with ANSI colors,
|
12
|
-
and display installation-related information such as commands, version, and status.
|
13
|
-
|
14
|
-
Attributes
|
15
|
-
----------
|
16
|
-
None
|
17
|
-
|
18
|
-
Methods
|
19
|
-
-------
|
20
|
-
_loadAsciiFile(name: str) -> str
|
21
|
-
Loads an ASCII file from the static directory.
|
22
|
-
_ansiMessage(message: str) -> str
|
23
|
-
Formats a message with green ANSI color.
|
24
|
-
_ansiCommands() -> str
|
25
|
-
Formats a list of commands with yellow ANSI color.
|
26
|
-
_ansiVersion(version: str = None) -> str
|
27
|
-
Formats version information with green ANSI color.
|
28
|
-
_ansiTextGreen(text: str) -> str
|
29
|
-
Wraps text in green ANSI color.
|
30
|
-
_year() -> str
|
31
|
-
Returns the current year as a string.
|
32
|
-
_newVersion() -> str
|
33
|
-
Checks for a new version of Orionis and returns a formatted message.
|
34
|
-
_replacePlaceholders(content: str, message: str) -> str
|
35
|
-
Replaces placeholders in a string with dynamic content.
|
36
|
-
_fallbackAscii() -> str
|
37
|
-
Provides a fallback ASCII message if the file is not found.
|
38
|
-
printHelp()
|
39
|
-
Prints the help message with available commands.
|
40
|
-
printIcon()
|
41
|
-
Prints the Orionis icon with a motivational message.
|
42
|
-
printStartInstallation()
|
43
|
-
Prints the start of the installation message.
|
44
|
-
printEndInstallation()
|
45
|
-
Prints the end of the installation message.
|
46
|
-
"""
|
47
|
-
|
48
|
-
def _loadAsciiFile(self, name: str) -> str:
|
49
|
-
"""
|
50
|
-
Loads an ASCII file from the static directory.
|
51
|
-
|
52
|
-
Parameters
|
53
|
-
----------
|
54
|
-
name : str
|
55
|
-
The name of the ASCII file (without the .ascii extension).
|
56
|
-
|
57
|
-
Returns
|
58
|
-
-------
|
59
|
-
str
|
60
|
-
The content of the ASCII file.
|
61
|
-
|
62
|
-
Raises
|
63
|
-
------
|
64
|
-
FileNotFoundError
|
65
|
-
If the file does not exist.
|
66
|
-
"""
|
67
|
-
dir_path = os.path.dirname(__file__)
|
68
|
-
path = os.path.join(dir_path, '..', 'static', 'ascii', f"{name}.ascii")
|
69
|
-
try:
|
70
|
-
with open(path, 'r', encoding='utf-8') as file:
|
71
|
-
return file.read()
|
72
|
-
except FileNotFoundError:
|
73
|
-
raise FileNotFoundError(f"File {name}.ascii not found")
|
74
|
-
|
75
|
-
def _ansiMessage(self, message: str) -> str:
|
76
|
-
"""
|
77
|
-
Formats a message with green ANSI color.
|
78
|
-
|
79
|
-
Parameters
|
80
|
-
----------
|
81
|
-
message : str
|
82
|
-
The message to format.
|
83
|
-
|
84
|
-
Returns
|
85
|
-
-------
|
86
|
-
str
|
87
|
-
The formatted message.
|
88
|
-
"""
|
89
|
-
return "\033[92m{} \033[0m".format(message)
|
90
|
-
|
91
|
-
def _ansiCommands(self) -> str:
|
92
|
-
"""
|
93
|
-
Formats a list of commands with yellow ANSI color.
|
94
|
-
|
95
|
-
Returns
|
96
|
-
-------
|
97
|
-
str
|
98
|
-
The formatted list of commands.
|
99
|
-
"""
|
100
|
-
commands = [
|
101
|
-
{'name': 'orionis new <app_name>', 'description': 'Creates a new Orionis app with the specified name.'},
|
102
|
-
{'name': 'orionis --version', 'description': 'Displays the current version of Orionis.'},
|
103
|
-
{'name': 'orionis --upgrade', 'description': 'Upgrades Orionis to the latest version.'}
|
104
|
-
]
|
105
|
-
commands_array = [
|
106
|
-
"\033[1m\033[93m- {} :\033[0m {}".format(command['name'], command['description'])
|
107
|
-
for command in commands
|
108
|
-
]
|
109
|
-
return "\n".join(commands_array)
|
110
|
-
|
111
|
-
def _ansiVersion(self, version: str = None) -> str:
|
112
|
-
"""
|
113
|
-
Formats version information with green ANSI color.
|
114
|
-
|
115
|
-
Parameters
|
116
|
-
----------
|
117
|
-
version : str, optional
|
118
|
-
The latest version available. If None, assumes the current version is the latest.
|
119
|
-
|
120
|
-
Returns
|
121
|
-
-------
|
122
|
-
str
|
123
|
-
The formatted version message.
|
124
|
-
"""
|
125
|
-
if version:
|
126
|
-
return self._ansiTextGreen(f"A new version ({version}) is available. Please consider upgrading from the current version ({VERSION}).")
|
127
|
-
return self._ansiTextGreen("You are using the latest stable version available.")
|
128
|
-
|
129
|
-
def _ansiTextGreen(self, text: str) -> str:
|
130
|
-
"""
|
131
|
-
Wraps text in green ANSI color.
|
132
|
-
|
133
|
-
Parameters
|
134
|
-
----------
|
135
|
-
text : str
|
136
|
-
The text to format.
|
137
|
-
|
138
|
-
Returns
|
139
|
-
-------
|
140
|
-
str
|
141
|
-
The formatted text.
|
142
|
-
"""
|
143
|
-
return f"\u001b[32m{text}\u001b[0m"
|
144
|
-
|
145
|
-
def _year(self) -> str:
|
146
|
-
"""
|
147
|
-
Returns the current year as a string.
|
148
|
-
|
149
|
-
Returns
|
150
|
-
-------
|
151
|
-
str
|
152
|
-
The current year.
|
153
|
-
"""
|
154
|
-
return str(datetime.datetime.now().year)
|
155
|
-
|
156
|
-
def _newVersion(self) -> str:
|
157
|
-
"""
|
158
|
-
Checks for a new version of Orionis and returns a formatted message.
|
159
|
-
|
160
|
-
Returns
|
161
|
-
-------
|
162
|
-
str
|
163
|
-
The formatted version message.
|
164
|
-
"""
|
165
|
-
try:
|
166
|
-
response = requests.get(API, timeout=10)
|
167
|
-
response.raise_for_status()
|
168
|
-
data = response.json()
|
169
|
-
latest_version = data.get("info", {}).get("version")
|
170
|
-
if not latest_version:
|
171
|
-
raise ValueError("Version information not found in API response.")
|
172
|
-
if latest_version != VERSION:
|
173
|
-
return self._ansiVersion(latest_version)
|
174
|
-
return self._ansiVersion()
|
175
|
-
except (requests.RequestException, ValueError) as e:
|
176
|
-
return self._ansiVersion()
|
177
|
-
|
178
|
-
def _replacePlaceholders(self, content: str, message: str) -> str:
|
179
|
-
"""
|
180
|
-
Replaces placeholders in a string with dynamic content.
|
181
|
-
|
182
|
-
Parameters
|
183
|
-
----------
|
184
|
-
content : str
|
185
|
-
The string containing placeholders.
|
186
|
-
message : str
|
187
|
-
The message to replace the {{message}} placeholder.
|
188
|
-
|
189
|
-
Returns
|
190
|
-
-------
|
191
|
-
str
|
192
|
-
The string with placeholders replaced.
|
193
|
-
"""
|
194
|
-
return content.replace('{{version}}', VERSION) \
|
195
|
-
.replace('{{docs}}', DOCS) \
|
196
|
-
.replace('{{year}}', self._year()) \
|
197
|
-
.replace('{{message}}', self._ansiMessage(message)) \
|
198
|
-
.replace('{{commands}}', self._ansiCommands()) \
|
199
|
-
.replace('{{new_version}}', self._newVersion())
|
200
|
-
|
201
|
-
def _fallbackAscii(self) -> str:
|
202
|
-
"""
|
203
|
-
Provides a fallback ASCII message if the file is not found.
|
204
|
-
|
205
|
-
Returns
|
206
|
-
-------
|
207
|
-
str
|
208
|
-
The fallback message.
|
209
|
-
"""
|
210
|
-
return f"{NAME.upper()}\nVersion: {VERSION}\nDocs: {DOCS}"
|
211
|
-
|
212
|
-
def printHelp(self):
|
213
|
-
"""
|
214
|
-
Prints the help message with available commands.
|
215
|
-
|
216
|
-
If the ASCII file is not found, it falls back to a basic message.
|
217
|
-
"""
|
218
|
-
try:
|
219
|
-
content = self._loadAsciiFile('info')
|
220
|
-
output = self._replacePlaceholders(content, "The list of commands accepted by the Orionis interpreter are:")
|
221
|
-
print(output)
|
222
|
-
except FileNotFoundError:
|
223
|
-
output = self._fallbackAscii()
|
224
|
-
print(output)
|
225
|
-
|
226
|
-
def printIcon(self):
|
227
|
-
"""
|
228
|
-
Prints the Orionis icon with a motivational message.
|
229
|
-
|
230
|
-
If the ASCII file is not found, it falls back to a basic message.
|
231
|
-
"""
|
232
|
-
try:
|
233
|
-
content = self._loadAsciiFile('icon')
|
234
|
-
output = self._replacePlaceholders(content, "Python isn't just powerful; it’s thrilling.")
|
235
|
-
print(output)
|
236
|
-
except FileNotFoundError:
|
237
|
-
output = self._fallbackAscii()
|
238
|
-
print(output)
|
239
|
-
|
240
|
-
def printStartInstallation(self):
|
241
|
-
"""
|
242
|
-
Prints the start of the installation message.
|
243
|
-
|
244
|
-
Displays the Orionis icon and a thank you message.
|
245
|
-
"""
|
246
|
-
self.printIcon()
|
247
|
-
print(self._ansiTextGreen("Thank you for using the framework!"))
|
248
|
-
|
249
|
-
def printEndInstallation(self):
|
250
|
-
"""
|
251
|
-
Prints the end of the installation message.
|
252
|
-
|
253
|
-
Displays a welcome message and encourages the user to start using the framework.
|
254
|
-
"""
|
255
|
-
print(self._ansiTextGreen("Welcome aboard, the journey starts now. Let your imagination soar!"))
|
256
|
-
print("-------------------------------------------")
|
orionis/installer/setup.py
DELETED
@@ -1,192 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import re
|
3
|
-
import shutil
|
4
|
-
import subprocess
|
5
|
-
import sys
|
6
|
-
from unicodedata import normalize
|
7
|
-
from orionis.framework import DOCS, SKELETON
|
8
|
-
from orionis.installer.contracts.output import IInstallerOutput
|
9
|
-
from orionis.installer.contracts.setup import IInstallerSetup
|
10
|
-
from orionis.luminate.console.output.console import Console
|
11
|
-
|
12
|
-
class InstallerSetup(IInstallerSetup):
|
13
|
-
"""
|
14
|
-
A class to initialize a Orionis project by performing the following setup actions:
|
15
|
-
1. Sanitize the folder name.
|
16
|
-
2. Clone the repository.
|
17
|
-
3. Create a virtual environment.
|
18
|
-
4. Install dependencies from requirements.txt.
|
19
|
-
5. Set up .env configuration.
|
20
|
-
6. Generate an API key.
|
21
|
-
7. Clean up temporary files and .git origin.
|
22
|
-
|
23
|
-
Parameters
|
24
|
-
----------
|
25
|
-
output : Output
|
26
|
-
An instance of Output, used to display messages to the console.
|
27
|
-
name_app : str, optional
|
28
|
-
The name of the app to create. If not provided, defaults to "{NAME}_app".
|
29
|
-
|
30
|
-
Attributes
|
31
|
-
----------
|
32
|
-
output : Output
|
33
|
-
An instance of Output used for console information.
|
34
|
-
name_app_folder : str
|
35
|
-
The sanitized folder name for the application.
|
36
|
-
"""
|
37
|
-
|
38
|
-
def __init__(self, output : IInstallerOutput, name: str = 'example-app'):
|
39
|
-
"""
|
40
|
-
Initialize OrionislInit class.
|
41
|
-
|
42
|
-
Parameters
|
43
|
-
----------
|
44
|
-
output : IInstallerOutput
|
45
|
-
An instance of InstallerOutput.
|
46
|
-
name_app : str, optional
|
47
|
-
Name of the application. If not provided, defaults to "example-app".
|
48
|
-
"""
|
49
|
-
self._output = output
|
50
|
-
self._output.printStartInstallation()
|
51
|
-
self.name_app_folder = self._sanitize_folder_name(name)
|
52
|
-
|
53
|
-
def _sanitize_folder_name(self, name: str) -> str:
|
54
|
-
"""
|
55
|
-
Sanitize the provided folder name to ensure it is valid across different operating systems.
|
56
|
-
|
57
|
-
Steps:
|
58
|
-
1. Normalize text to remove accents and special characters.
|
59
|
-
2. Convert to lowercase.
|
60
|
-
3. Replace spaces with underscores.
|
61
|
-
4. Remove invalid characters.
|
62
|
-
5. Strip leading and trailing whitespace.
|
63
|
-
6. Enforce length limit (255 characters).
|
64
|
-
7. Ensure the result contains only valid characters.
|
65
|
-
|
66
|
-
Parameters
|
67
|
-
----------
|
68
|
-
name : str
|
69
|
-
The original folder name to sanitize.
|
70
|
-
|
71
|
-
Returns
|
72
|
-
-------
|
73
|
-
str
|
74
|
-
The sanitized folder name.
|
75
|
-
|
76
|
-
Raises
|
77
|
-
------
|
78
|
-
ValueError
|
79
|
-
If the sanitized folder name is empty or contains invalid characters.
|
80
|
-
"""
|
81
|
-
if not name:
|
82
|
-
raise ValueError("Folder name cannot be empty.")
|
83
|
-
|
84
|
-
# Strip leading and trailing whitespace
|
85
|
-
name = name.strip()
|
86
|
-
|
87
|
-
# Normalize to remove accents and special characters
|
88
|
-
name = normalize("NFKD", name).encode("ascii", "ignore").decode("ascii")
|
89
|
-
|
90
|
-
# Convert to lowercase
|
91
|
-
name = name.lower()
|
92
|
-
|
93
|
-
# Replace spaces with underscores
|
94
|
-
name = name.replace(" ", "_")
|
95
|
-
|
96
|
-
# Remove invalid characters for folder names
|
97
|
-
name = re.sub(r'[\\/:*?"<>|]', '', name)
|
98
|
-
|
99
|
-
# Limit the length to 255 characters
|
100
|
-
name = name[:255]
|
101
|
-
|
102
|
-
# Validate against allowed characters
|
103
|
-
if not re.match(r'^[a-z0-9_-]+$', name):
|
104
|
-
raise ValueError("The folder name can only contain letters, numbers, underscores, and hyphens.")
|
105
|
-
|
106
|
-
if not name:
|
107
|
-
raise ValueError("The sanitized folder name is empty after processing.")
|
108
|
-
|
109
|
-
return name
|
110
|
-
|
111
|
-
def _printInfo(self, message: str) -> None:
|
112
|
-
"""
|
113
|
-
Display an information message to the console.
|
114
|
-
|
115
|
-
Parameters
|
116
|
-
----------
|
117
|
-
message : str
|
118
|
-
The message to display.
|
119
|
-
"""
|
120
|
-
Console.info(message)
|
121
|
-
|
122
|
-
def handle(self):
|
123
|
-
"""
|
124
|
-
Executes the setup process for initializing the Orionis project.
|
125
|
-
|
126
|
-
This process includes:
|
127
|
-
1. Cloning the repository.
|
128
|
-
2. Creating a virtual environment.
|
129
|
-
3. Installing dependencies from requirements.txt.
|
130
|
-
4. Setting up the .env file.
|
131
|
-
5. Generating an API key.
|
132
|
-
6. Cleaning up temporary files and .git remote origin.
|
133
|
-
|
134
|
-
Raises
|
135
|
-
------
|
136
|
-
ValueError
|
137
|
-
If there is an error during any subprocess execution.
|
138
|
-
Exception
|
139
|
-
If any unexpected error occurs.
|
140
|
-
"""
|
141
|
-
try:
|
142
|
-
# Validate Folder
|
143
|
-
if os.path.exists(self.name_app_folder) and os.path.isdir(self.name_app_folder):
|
144
|
-
raise ValueError(f"The folder '{self.name_app_folder}' already exists.")
|
145
|
-
|
146
|
-
# Clone the repository
|
147
|
-
self._printInfo(f"Cloning the repository into '{self.name_app_folder}'... (Getting Latest Version)")
|
148
|
-
subprocess.run(["git", "clone", SKELETON, self.name_app_folder], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
149
|
-
self._printInfo(f"Repository successfully cloned into '{self.name_app_folder}'.")
|
150
|
-
|
151
|
-
# Change to the project directory
|
152
|
-
project_path = os.path.join(os.getcwd(), self.name_app_folder)
|
153
|
-
os.chdir(project_path)
|
154
|
-
self._printInfo(f"Entering directory '{self.name_app_folder}'.")
|
155
|
-
|
156
|
-
# Create a virtual environment
|
157
|
-
self._printInfo("Creating virtual environment...")
|
158
|
-
subprocess.run([sys.executable, "-m", "venv", "venv"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
159
|
-
self._printInfo("Virtual environment successfully created.")
|
160
|
-
|
161
|
-
# Virtual environment path
|
162
|
-
venv_path = os.path.join(project_path, "venv", "Scripts" if os.name == "nt" else "bin")
|
163
|
-
|
164
|
-
# Check if requirements.txt exists
|
165
|
-
if not os.path.exists("requirements.txt"):
|
166
|
-
raise ValueError(f"'requirements.txt' not found. Please visit the Orionis Docs for more details: {DOCS}")
|
167
|
-
|
168
|
-
# Install dependencies from requirements.txt
|
169
|
-
self._printInfo("Installing dependencies from 'requirements.txt'...")
|
170
|
-
subprocess.run([os.path.join(venv_path, "pip"), "install", "-r", "requirements.txt"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
171
|
-
self._printInfo("Dependencies successfully installed.")
|
172
|
-
|
173
|
-
# Create .env
|
174
|
-
example_env_path = os.path.join(project_path, '.env.example')
|
175
|
-
env_path = os.path.join(project_path, '.env')
|
176
|
-
shutil.copy(example_env_path, env_path)
|
177
|
-
|
178
|
-
# Create ApiKey
|
179
|
-
os.chdir(project_path)
|
180
|
-
subprocess.run([sys.executable, '-B', 'reactor', 'key:generate'], capture_output=True, text=True)
|
181
|
-
|
182
|
-
# Remove .git origin
|
183
|
-
subprocess.run(["git", "remote", "remove", "origin"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
184
|
-
|
185
|
-
# Finish Process Message
|
186
|
-
self._printInfo(f"Project '{self.name_app_folder}' successfully created at '{os.path.abspath(project_path)}'.")
|
187
|
-
self._output.printEndInstallation()
|
188
|
-
|
189
|
-
except subprocess.CalledProcessError as e:
|
190
|
-
raise ValueError(f"Error while executing command: {e}")
|
191
|
-
except Exception as e:
|
192
|
-
raise RuntimeError(f"An unexpected error occurred: {e}")
|
orionis/static/ascii/icon.ascii
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
___________________________________________
|
2
|
-
___ _ _
|
3
|
-
/ _ \ _ __(_) ___ _ __ (_)___
|
4
|
-
| | | | '__| |/ _ \| '_ \| / __|
|
5
|
-
| |_| | | | | (_) | | | | \__ \
|
6
|
-
\___/|_| |_|\___/|_| |_|_|___/
|
7
|
-
{{message}}
|
8
|
-
-------------------------------------------
|
9
|
-
Orionis Team © 2023 - {{year}}
|
10
|
-
Version: {{version}}
|
11
|
-
Docs: {{docs}}
|
12
|
-
{{new_version}}
|
13
|
-
-------------------------------------------
|
orionis/static/ascii/info.ascii
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
___________________________________________
|
2
|
-
___ _ _
|
3
|
-
/ _ \ _ __(_) ___ _ __ (_)___
|
4
|
-
| | | | '__| |/ _ \| '_ \| / __|
|
5
|
-
| |_| | | | | (_) | | | | \__ \
|
6
|
-
\___/|_| |_|\___/|_| |_|_|___/
|
7
|
-
{{message}}
|
8
|
-
-------------------------------------------
|
9
|
-
{{commands}}
|
10
|
-
-------------------------------------------
|
11
|
-
Orionis Team © 2023 - {{year}}
|
12
|
-
Version: {{version}}
|
13
|
-
Docs: {{docs}}
|
14
|
-
{{new_version}}
|
15
|
-
-------------------------------------------
|
orionis/static/bg/galaxy.jpg
DELETED
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|