rapidframework-lib 1.0.2__tar.gz → 1.0.4__tar.gz
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.
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/PKG-INFO +3 -2
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/README.md +2 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/pyproject.toml +1 -1
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/__init__.py +1 -1
- rapidframework_lib-1.0.4/rapidframework/__pycache__/main.cpython-313.pyc +0 -0
- rapidframework_lib-1.0.4/rapidframework/config.py +83 -0
- rapidframework_lib-1.0.4/rapidframework/configs/managers.json +29 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/template.py +4 -10
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/main.py +3 -10
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/PKG-INFO +3 -2
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/SOURCES.txt +2 -1
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/requires.txt +0 -1
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/setup.py +6 -3
- rapidframework_lib-1.0.2/rapidframework/config.py +0 -52
- rapidframework_lib-1.0.2/rapidframework/uv.py +0 -41
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/LICENSE +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/__init__.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/django.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/examples/__init__.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/examples/fastapi_example_1.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/examples/flask_example_1.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/examples/litestar_example_1.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/examples/starlette_example_1.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/examples/tornado_example_1.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/fastapi.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/flask.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/litestar.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/starlette.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/tornado.py +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/dependency_links.txt +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/entry_points.txt +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/top_level.txt +0 -0
- {rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/setup.cfg +0 -0
@@ -1,10 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: rapidframework-lib
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.4
|
4
4
|
Description-Content-Type: text/markdown
|
5
5
|
License-File: LICENSE
|
6
6
|
Requires-Dist: msgspec
|
7
|
-
Requires-Dist: uv
|
8
7
|
Dynamic: description
|
9
8
|
Dynamic: description-content-type
|
10
9
|
Dynamic: license-file
|
@@ -14,6 +13,8 @@ Dynamic: requires-dist
|
|
14
13
|
|
15
14
|
> **RapidFramework** is a Python library for quickly creating and setting up projects from templates.
|
16
15
|
|
16
|
+
## https://pypi.org/project/rapidframework-lib/1.0.4/
|
17
|
+
|
17
18
|
## Installation
|
18
19
|
|
19
20
|
```bash
|
@@ -3,6 +3,6 @@ from .frameworks import DjangoManager as DjangoManager
|
|
3
3
|
from .frameworks import FastapiManager as FastapiManager
|
4
4
|
|
5
5
|
from .config import Config as Config
|
6
|
-
from .
|
6
|
+
from .config import AutoManager as AutoManager
|
7
7
|
|
8
8
|
__version__ = '0.0.1'
|
Binary file
|
@@ -0,0 +1,83 @@
|
|
1
|
+
from os import getcwd, listdir, path, makedirs
|
2
|
+
from typing import Self, Dict
|
3
|
+
import pkgutil
|
4
|
+
from msgspec import json, Struct, field
|
5
|
+
from subprocess import run
|
6
|
+
from importlib.metadata import distribution
|
7
|
+
from re import sub
|
8
|
+
|
9
|
+
|
10
|
+
class Config:
|
11
|
+
_instance = None
|
12
|
+
|
13
|
+
def __new__(cls) -> Self:
|
14
|
+
if cls._instance is None:
|
15
|
+
cls._instance = super(Config, cls).__new__(cls)
|
16
|
+
cls._instance.source_dir = getcwd()
|
17
|
+
cls._instance.source_files = listdir()
|
18
|
+
cls._instance.dirs_to_create = [
|
19
|
+
"tests",
|
20
|
+
"templates",
|
21
|
+
"static",
|
22
|
+
"static/css",
|
23
|
+
"static/js",
|
24
|
+
"static/images",
|
25
|
+
]
|
26
|
+
|
27
|
+
# cls._instance.pyproject_deps: list
|
28
|
+
cls._instance.project_name = path.basename(cls._instance.source_dir)
|
29
|
+
cls.install = AutoManager().get_config_managers()
|
30
|
+
cls.pkg_manager = AutoManager().get_pkg_manager()
|
31
|
+
|
32
|
+
return cls._instance
|
33
|
+
|
34
|
+
def create_dirs(cls, app_path, extra_dirs=[]) -> None:
|
35
|
+
dirs_to_create: list = cls._instance.dirs_to_create.copy()
|
36
|
+
dirs_to_create.extend(extra_dirs)
|
37
|
+
#
|
38
|
+
for _dir in dirs_to_create:
|
39
|
+
makedirs(path.join(app_path, _dir), exist_ok=True)
|
40
|
+
|
41
|
+
def create_files(cls, file_paths) -> None:
|
42
|
+
for file_path in file_paths:
|
43
|
+
with open(path.join(cls._instance.source_dir, file_path), "w"): ...
|
44
|
+
|
45
|
+
|
46
|
+
class AutoManager:
|
47
|
+
_instance = None
|
48
|
+
|
49
|
+
|
50
|
+
def __new__(cls, config_name: str = "managers.json") -> Self:
|
51
|
+
if cls._instance is None:
|
52
|
+
cls._instance = super(AutoManager, cls).__new__(cls)
|
53
|
+
|
54
|
+
class _ConfigCommands(Struct):
|
55
|
+
install: str
|
56
|
+
uninstall: str
|
57
|
+
list_: str = field(name="list")
|
58
|
+
|
59
|
+
class _ConfigFormat(Struct):
|
60
|
+
managers: Dict[str, _ConfigCommands]
|
61
|
+
|
62
|
+
cls._instance.config_name = config_name
|
63
|
+
cls._instance._ConfigFormat = _ConfigFormat
|
64
|
+
cls._instance.decoder = json.Decoder()
|
65
|
+
|
66
|
+
return cls._instance
|
67
|
+
|
68
|
+
|
69
|
+
def get_config_managers(cls) -> dict:
|
70
|
+
config = pkgutil.get_data("rapidframework", f"configs/{cls._instance.config_name}")
|
71
|
+
return json.decode(config.decode("utf-8"), type=cls._instance._ConfigFormat)
|
72
|
+
|
73
|
+
|
74
|
+
def get_pkg_manager(cls) -> str:
|
75
|
+
try:
|
76
|
+
return sub(r'\s+', '', distribution("rapidframework-lib").read_text("INSTALLER"))
|
77
|
+
except:
|
78
|
+
return "pip"
|
79
|
+
|
80
|
+
|
81
|
+
def install_libs(cls, libs: list) -> None:
|
82
|
+
print(libs)
|
83
|
+
run([cls.get_pkg_manager(), cls.get_config_managers().managers.get(cls.get_pkg_manager()).install] + libs)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"managers": {
|
3
|
+
"pip": {
|
4
|
+
"install": "install",
|
5
|
+
"uninstall": "uninstall",
|
6
|
+
"list": "freeze"
|
7
|
+
},
|
8
|
+
"conda": {
|
9
|
+
"install": "install",
|
10
|
+
"uninstall": "uninstall",
|
11
|
+
"list": "list"
|
12
|
+
},
|
13
|
+
"uv": {
|
14
|
+
"install": "add",
|
15
|
+
"uninstall": "remove",
|
16
|
+
"list": "pip list"
|
17
|
+
},
|
18
|
+
"pyenv": {
|
19
|
+
"install": "install",
|
20
|
+
"uninstall": "uninstall",
|
21
|
+
"list": "versions"
|
22
|
+
},
|
23
|
+
"poetry": {
|
24
|
+
"install": "add",
|
25
|
+
"uninstall": "remove",
|
26
|
+
"list": "show"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from os import path
|
2
|
-
from ..
|
2
|
+
from ..config import AutoManager
|
3
3
|
from ..config import Config
|
4
4
|
|
5
5
|
|
@@ -20,22 +20,16 @@ class Template:
|
|
20
20
|
self.framework_name = framework_name
|
21
21
|
self.name = kwargs.get("name")
|
22
22
|
#
|
23
|
-
self.
|
24
|
-
self.UvManager.check_for_venv()
|
23
|
+
self.AutoManager = AutoManager()
|
25
24
|
#
|
26
25
|
|
27
|
-
def check(self, **kwargs) -> None:
|
28
|
-
if not cfg.check_lib(self.framework_name):
|
29
|
-
self.install_framework(**kwargs)
|
30
|
-
else:
|
31
|
-
self.setup_framework()
|
32
|
-
|
33
26
|
def install_framework(self, **kwargs):
|
34
27
|
version = f"=={kwargs.get('version')}" if kwargs.get('version') else ""
|
35
28
|
libs_to_install: list = kwargs.get("libs") or []
|
36
29
|
#
|
37
30
|
libs_to_install.extend([f"{self.framework_name}{version}"])
|
38
|
-
|
31
|
+
print("Getting libs")
|
32
|
+
self.AutoManager.install_libs(libs_to_install)
|
39
33
|
#
|
40
34
|
self.setup_framework()
|
41
35
|
|
@@ -2,10 +2,6 @@ import argparse
|
|
2
2
|
import importlib
|
3
3
|
import os
|
4
4
|
from pathlib import Path
|
5
|
-
|
6
|
-
#
|
7
|
-
from .uv import UvManager
|
8
|
-
|
9
5
|
#
|
10
6
|
|
11
7
|
FRAMEWORKS_PATH = Path(__file__).parent / "frameworks"
|
@@ -30,7 +26,6 @@ class Main:
|
|
30
26
|
#
|
31
27
|
self.args = self.parser.parse_args()
|
32
28
|
#
|
33
|
-
self.UvManager = UvManager()
|
34
29
|
self.framework_manager = self._load_framework_manager()
|
35
30
|
|
36
31
|
def _discover_frameworks(self):
|
@@ -50,13 +45,11 @@ class Main:
|
|
50
45
|
|
51
46
|
return manager_class(name=self.args.name)
|
52
47
|
|
53
|
-
def run(self):
|
54
|
-
self.UvManager.check_for_venv()
|
55
|
-
#
|
48
|
+
def run(self):
|
56
49
|
example_id = 1 if self.args.example is None else self.args.example
|
57
50
|
#
|
58
|
-
if hasattr(self.framework_manager, "
|
59
|
-
self.framework_manager.
|
51
|
+
if hasattr(self.framework_manager, "install_framework"):
|
52
|
+
self.framework_manager.install_framework(version=self.args.version)
|
60
53
|
|
61
54
|
if hasattr(self.framework_manager, "create_example"):
|
62
55
|
self.framework_manager.create_example(self.args.name, example_id)
|
@@ -1,10 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: rapidframework-lib
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.4
|
4
4
|
Description-Content-Type: text/markdown
|
5
5
|
License-File: LICENSE
|
6
6
|
Requires-Dist: msgspec
|
7
|
-
Requires-Dist: uv
|
8
7
|
Dynamic: description
|
9
8
|
Dynamic: description-content-type
|
10
9
|
Dynamic: license-file
|
@@ -14,6 +13,8 @@ Dynamic: requires-dist
|
|
14
13
|
|
15
14
|
> **RapidFramework** is a Python library for quickly creating and setting up projects from templates.
|
16
15
|
|
16
|
+
## https://pypi.org/project/rapidframework-lib/1.0.4/
|
17
|
+
|
17
18
|
## Installation
|
18
19
|
|
19
20
|
```bash
|
{rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/SOURCES.txt
RENAMED
@@ -5,7 +5,8 @@ setup.py
|
|
5
5
|
rapidframework/__init__.py
|
6
6
|
rapidframework/config.py
|
7
7
|
rapidframework/main.py
|
8
|
-
rapidframework/
|
8
|
+
rapidframework/__pycache__/main.cpython-313.pyc
|
9
|
+
rapidframework/configs/managers.json
|
9
10
|
rapidframework/frameworks/__init__.py
|
10
11
|
rapidframework/frameworks/django.py
|
11
12
|
rapidframework/frameworks/fastapi.py
|
@@ -3,11 +3,10 @@ from setuptools import setup, find_packages
|
|
3
3
|
|
4
4
|
setup(
|
5
5
|
name="rapidframework-lib",
|
6
|
-
version="1.0.
|
6
|
+
version="1.0.4",
|
7
7
|
packages=find_packages(),
|
8
8
|
install_requires=[
|
9
|
-
"msgspec"
|
10
|
-
"uv"
|
9
|
+
"msgspec"
|
11
10
|
],
|
12
11
|
long_description=open('README.md').read(),
|
13
12
|
long_description_content_type='text/markdown',
|
@@ -16,4 +15,8 @@ setup(
|
|
16
15
|
'rapidframework=rapidframework.main:main_entry_point',
|
17
16
|
],
|
18
17
|
},
|
18
|
+
include_package_data=True,
|
19
|
+
package_data={
|
20
|
+
"rapidframework": ["**/*"],
|
21
|
+
},
|
19
22
|
)
|
@@ -1,52 +0,0 @@
|
|
1
|
-
from os import getcwd, listdir, path, makedirs
|
2
|
-
from typing import Self
|
3
|
-
from msgspec import toml
|
4
|
-
import re
|
5
|
-
|
6
|
-
|
7
|
-
class Config:
|
8
|
-
_instance = None
|
9
|
-
|
10
|
-
def __new__(cls) -> Self:
|
11
|
-
if cls._instance is None:
|
12
|
-
cls._instance = super(Config, cls).__new__(cls)
|
13
|
-
cls._instance.source_dir = getcwd()
|
14
|
-
cls._instance.source_files = listdir()
|
15
|
-
cls._instance.pyproject_file = "pyproject.toml"
|
16
|
-
cls._instance.dirs_to_create = [
|
17
|
-
"tests",
|
18
|
-
"templates",
|
19
|
-
"static",
|
20
|
-
"static/css",
|
21
|
-
"static/js",
|
22
|
-
"static/images",
|
23
|
-
]
|
24
|
-
|
25
|
-
# cls._instance.pyproject_deps: list
|
26
|
-
cls._instance.project_name = path.basename(cls._instance.source_dir)
|
27
|
-
|
28
|
-
return cls._instance
|
29
|
-
|
30
|
-
def create_dirs(cls, app_path, extra_dirs=[]) -> None:
|
31
|
-
dirs_to_create: list = cls._instance.dirs_to_create.copy()
|
32
|
-
dirs_to_create.extend(extra_dirs)
|
33
|
-
#
|
34
|
-
for _dir in dirs_to_create:
|
35
|
-
makedirs(path.join(app_path, _dir), exist_ok=True)
|
36
|
-
|
37
|
-
def create_files(cls, file_paths):
|
38
|
-
for file_path in file_paths:
|
39
|
-
with open(path.join(cls._instance.source_dir, file_path), "w"): ...
|
40
|
-
|
41
|
-
def check_lib(cls, lib_name) -> bool:
|
42
|
-
return lib_name in [
|
43
|
-
re.match(r"^[a-zA-Z0-9-_]+", dep).group(0)
|
44
|
-
for dep in cls._instance.pyproject_deps
|
45
|
-
]
|
46
|
-
|
47
|
-
def get_dependencies(cls) -> list:
|
48
|
-
with open(
|
49
|
-
path.join(cls._instance.source_dir, cls._instance.pyproject_file)
|
50
|
-
) as pyproject_deps:
|
51
|
-
cls._instance.pyproject_deps = toml.decode(pyproject_deps.read()).get("project").get("dependencies")
|
52
|
-
return cls._instance.pyproject_deps
|
@@ -1,41 +0,0 @@
|
|
1
|
-
from subprocess import run
|
2
|
-
from .config import Config
|
3
|
-
|
4
|
-
cfg = Config()
|
5
|
-
|
6
|
-
|
7
|
-
class UvManager:
|
8
|
-
def __init__(self):
|
9
|
-
self.source_dir = cfg.source_dir
|
10
|
-
self.source_files = cfg.source_files
|
11
|
-
|
12
|
-
def check_for_venv(self):
|
13
|
-
if cfg.pyproject_file not in self.source_files:
|
14
|
-
self.init_uv()
|
15
|
-
else:
|
16
|
-
self.sync_uv()
|
17
|
-
|
18
|
-
cfg.get_dependencies()
|
19
|
-
|
20
|
-
def install_uv(self):
|
21
|
-
try:
|
22
|
-
run(["pip", "install", "uv"])
|
23
|
-
run(["uv", "init"])
|
24
|
-
except Exception as error:
|
25
|
-
raise Exception(f"Unexpected Error during installing uv: {error}")
|
26
|
-
|
27
|
-
def sync_uv(self):
|
28
|
-
try:
|
29
|
-
run(["uv", "sync"])
|
30
|
-
except ModuleNotFoundError:
|
31
|
-
self.install_uv()
|
32
|
-
|
33
|
-
def init_uv(self):
|
34
|
-
try:
|
35
|
-
run(["uv", "init"])
|
36
|
-
except ModuleNotFoundError:
|
37
|
-
self.install_uv()
|
38
|
-
|
39
|
-
def install_libs(self, libs: list):
|
40
|
-
for lib in libs:
|
41
|
-
run(["uv", "add", lib])
|
File without changes
|
File without changes
|
File without changes
|
{rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/examples/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework/frameworks/starlette.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/entry_points.txt
RENAMED
File without changes
|
{rapidframework_lib-1.0.2 → rapidframework_lib-1.0.4}/rapidframework_lib.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|