rapidframework-lib 1.0.8.1__tar.gz → 1.0.9__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.8.1 → rapidframework_lib-1.0.9}/PKG-INFO +3 -3
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/README.md +2 -2
- rapidframework_lib-1.0.9/rapidframework/config.py +102 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/django.py +18 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/manage.py-tpl +25 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/__init__.py-tpl +0 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/asgi.py-tpl +21 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/settings.py-tpl +162 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/urls.py-tpl +13 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/users/__init__.py-tpl +0 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/users/admin.py-tpl +5 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/users/migrations/0001_initial.py-tpl +46 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/users/migrations/__init__.py-tpl +0 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/users/models.py-tpl +5 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/wsgi.py-tpl +18 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/fastapi.py +13 -0
- rapidframework_lib-1.0.9/rapidframework/frameworks/simple_frameworks.py +29 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/main.py +5 -10
- rapidframework_lib-1.0.9/rapidframework/template.py +88 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/PKG-INFO +3 -3
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/SOURCES.txt +12 -11
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/setup.py +1 -1
- rapidframework_lib-1.0.8.1/rapidframework/config.py +0 -83
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/bottle.py +0 -10
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/cherrypy.py +0 -10
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/django.py +0 -25
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/fastapi.py +0 -17
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/flask.py +0 -10
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/grok.py +0 -11
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/litestar.py +0 -6
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/pyramid.py +0 -11
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/socketify.py +0 -11
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/starlette.py +0 -9
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/tornado.py +0 -7
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/turbogears2.py +0 -10
- rapidframework_lib-1.0.8.1/rapidframework/frameworks/web2py.py +0 -6
- rapidframework_lib-1.0.8.1/rapidframework/template.py +0 -55
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/LICENSE +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/pyproject.toml +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/__init__.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/__pycache__/main.cpython-313.pyc +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/configs/managers.json +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/__init__.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/__init__.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/bottle_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/cherrypy_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/fastapi_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/flask_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/grok_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/litestar_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/pyramid_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/socketify_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/starlette_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/tornado_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/turbogears2_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/web2py_1.py +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/dependency_links.txt +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/entry_points.txt +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/requires.txt +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/top_level.txt +0 -0
- {rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: rapidframework-lib
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.9
|
4
4
|
Description-Content-Type: text/markdown
|
5
5
|
License-File: LICENSE
|
6
6
|
Requires-Dist: msgspec
|
@@ -13,7 +13,7 @@ Dynamic: requires-dist
|
|
13
13
|
|
14
14
|
> **RapidFramework** is a Python library for quickly creating and setting up projects from templates.
|
15
15
|
|
16
|
-
## https://pypi.org/project/rapidframework-lib/1.0.
|
16
|
+
## https://pypi.org/project/rapidframework-lib/1.0.9/
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
@@ -31,7 +31,7 @@ rapidframework fastapi --name App --version 0.115.12 --example 1
|
|
31
31
|
|
32
32
|
## Features
|
33
33
|
|
34
|
-
- 📦 Create projects based on popular frameworks: **Flask**, **Django**, **FastAPI
|
34
|
+
- 📦 Create projects based on popular frameworks: **Flask**, **Django**, **FastAPI**, etc.
|
35
35
|
- 🎨 Support for custom templates via the `Template` class.
|
36
36
|
- 🚀 Built-in examples to get started quickly.
|
37
37
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
> **RapidFramework** is a Python library for quickly creating and setting up projects from templates.
|
4
4
|
|
5
|
-
## https://pypi.org/project/rapidframework-lib/1.0.
|
5
|
+
## https://pypi.org/project/rapidframework-lib/1.0.9/
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -20,7 +20,7 @@ rapidframework fastapi --name App --version 0.115.12 --example 1
|
|
20
20
|
|
21
21
|
## Features
|
22
22
|
|
23
|
-
- 📦 Create projects based on popular frameworks: **Flask**, **Django**, **FastAPI
|
23
|
+
- 📦 Create projects based on popular frameworks: **Flask**, **Django**, **FastAPI**, etc.
|
24
24
|
- 🎨 Support for custom templates via the `Template` class.
|
25
25
|
- 🚀 Built-in examples to get started quickly.
|
26
26
|
|
@@ -0,0 +1,102 @@
|
|
1
|
+
from os import getcwd, listdir, path, makedirs
|
2
|
+
from typing import Self, Dict
|
3
|
+
import pkgutil
|
4
|
+
from msgspec import json, Struct, field, DecodeError
|
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().__new__(cls)
|
16
|
+
return cls._instance
|
17
|
+
|
18
|
+
def __init__(self) -> None:
|
19
|
+
if not hasattr(self, "_initialized"):
|
20
|
+
self.source_dir = getcwd()
|
21
|
+
self.project_name = path.basename(self.source_dir)
|
22
|
+
self.source_files = listdir()
|
23
|
+
self.dirs_to_create = [
|
24
|
+
"tests",
|
25
|
+
"templates",
|
26
|
+
"static",
|
27
|
+
"static/css",
|
28
|
+
"static/js",
|
29
|
+
"static/images",
|
30
|
+
]
|
31
|
+
self.install = AutoManager().get_config_managers()
|
32
|
+
self.pkg_manager = AutoManager().get_pkg_manager()
|
33
|
+
self._initialized = True
|
34
|
+
|
35
|
+
|
36
|
+
def create_dirs(self, app_path, extra_dirs=[]) -> None:
|
37
|
+
dirs_to_create: list = self.dirs_to_create.copy()
|
38
|
+
dirs_to_create.extend(extra_dirs)
|
39
|
+
#
|
40
|
+
for _dir in dirs_to_create:
|
41
|
+
makedirs(path.join(app_path, _dir), exist_ok=True)
|
42
|
+
|
43
|
+
def create_files(self, file_paths) -> None:
|
44
|
+
for file_path in file_paths:
|
45
|
+
with open(path.join(self.source_dir, file_path), "w"): ...
|
46
|
+
|
47
|
+
|
48
|
+
class _ConfigCommands(Struct):
|
49
|
+
install: str
|
50
|
+
uninstall: str
|
51
|
+
list_: str = field(name="list")
|
52
|
+
|
53
|
+
class _ConfigFormat(Struct):
|
54
|
+
managers: Dict[str, _ConfigCommands]
|
55
|
+
|
56
|
+
class AutoManager:
|
57
|
+
_instance = None
|
58
|
+
_decoder = json.Decoder(type=_ConfigFormat, strict=True)
|
59
|
+
|
60
|
+
def __new__(cls, config_name: str = "managers.json") -> Self:
|
61
|
+
if cls._instance is None:
|
62
|
+
cls._instance = super().__new__(cls)
|
63
|
+
return cls._instance
|
64
|
+
|
65
|
+
def __init__(self, config_name: str = "managers.json"):
|
66
|
+
if not hasattr(self, "_initialized"):
|
67
|
+
self.config_name = config_name
|
68
|
+
self._ConfigFormat = _ConfigFormat
|
69
|
+
self._initialized = True
|
70
|
+
|
71
|
+
def get_config_managers(self) -> _ConfigFormat:
|
72
|
+
config = pkgutil.get_data("rapidframework", f"configs/{self.config_name}")
|
73
|
+
#
|
74
|
+
if config is None:
|
75
|
+
raise FileNotFoundError(f"Configuration file '{self.config_name}' not found.")
|
76
|
+
#
|
77
|
+
return self._decoder.decode(config.decode("utf-8"))
|
78
|
+
|
79
|
+
def get_pkg_manager(self) -> str:
|
80
|
+
try:
|
81
|
+
return sub(r'\s+', '', distribution("rapidframework-lib").read_text("INSTALLER")) # type: ignore
|
82
|
+
except (DecodeError, FileNotFoundError, ValueError):
|
83
|
+
return "pip"
|
84
|
+
|
85
|
+
def install_libs(self, libs: list) -> None:
|
86
|
+
managers = self.get_config_managers().managers
|
87
|
+
pkg = self.get_pkg_manager()
|
88
|
+
if pkg not in managers:
|
89
|
+
raise ValueError(f"Package manager '{pkg}' not found in configuration.")
|
90
|
+
run([pkg, managers[pkg].install] + libs)
|
91
|
+
|
92
|
+
if __name__ == "__main__":
|
93
|
+
# Example usage of AutoManager singleton
|
94
|
+
a = AutoManager()
|
95
|
+
b = AutoManager()
|
96
|
+
print(f"{a is b=}") # Should print True, confirming singleton behavior
|
97
|
+
assert a is b
|
98
|
+
# # Example usage of Config singleton
|
99
|
+
c = Config()
|
100
|
+
d = Config()
|
101
|
+
print(f"{c is d=}") # Should print True, confirming singleton behavior
|
102
|
+
assert c is d
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from ..template import Template
|
2
|
+
import os
|
3
|
+
import pathlib
|
4
|
+
from subprocess import run
|
5
|
+
|
6
|
+
|
7
|
+
class DjangoManager(Template):
|
8
|
+
extra_libs = ["Pillow", "djangorestframework", "django-cors-headers", \
|
9
|
+
"celery", "django-redis", "redis", "django-allauth", "django-crispy-forms", "django-environ", \
|
10
|
+
"django-extensions", "gunicorn", "whitenoise", "django-configurations", "django-debug-toolbar"]
|
11
|
+
example = True
|
12
|
+
|
13
|
+
def create_example(self, example_id) -> None:
|
14
|
+
package_dir = pathlib.Path(__file__).resolve().parent
|
15
|
+
example_folder_path = package_dir / "examples" / f"{self.framework_name}_{example_id}"
|
16
|
+
|
17
|
+
if os.path.isdir(example_folder_path):
|
18
|
+
run(["django-admin", "startproject", f"--template={example_folder_path}", self.name])
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
"""Django's command-line utility for administrative tasks."""
|
3
|
+
import os
|
4
|
+
import sys
|
5
|
+
|
6
|
+
|
7
|
+
def main():
|
8
|
+
"""Run administrative tasks."""
|
9
|
+
configuration = os.getenv('ENVIRONMENT', 'development').title()
|
10
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')
|
11
|
+
os.environ.setdefault('DJANGO_CONFIGURATION', configuration)
|
12
|
+
|
13
|
+
try:
|
14
|
+
from configurations.management import execute_from_command_line
|
15
|
+
except ImportError as exc:
|
16
|
+
raise ImportError(
|
17
|
+
"Couldn't import Django. Are you sure it's installed and "
|
18
|
+
"available on your PYTHONPATH environment variable? Did you "
|
19
|
+
"forget to activate a virtual environment?"
|
20
|
+
) from exc
|
21
|
+
execute_from_command_line(sys.argv)
|
22
|
+
|
23
|
+
|
24
|
+
if __name__ == '__main__':
|
25
|
+
main()
|
rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/__init__.py-tpl
ADDED
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"""
|
2
|
+
ASGI config for {{ project_name }} project.
|
3
|
+
|
4
|
+
It exposes the ASGI callable as a module-level variable named ``application``.
|
5
|
+
|
6
|
+
For more information on this file, see
|
7
|
+
https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/asgi/
|
8
|
+
"""
|
9
|
+
|
10
|
+
import os
|
11
|
+
|
12
|
+
|
13
|
+
configuration = os.getenv('ENVIRONMENT', 'development').title()
|
14
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')
|
15
|
+
os.environ.setdefault('DJANGO_CONFIGURATION', configuration)
|
16
|
+
|
17
|
+
from configurations import importer # noqa
|
18
|
+
importer.install()
|
19
|
+
|
20
|
+
from django.core.asgi import get_asgi_application # noqa
|
21
|
+
application = get_asgi_application()
|
rapidframework_lib-1.0.9/rapidframework/frameworks/examples/django_1/project_name/settings.py-tpl
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
"""
|
2
|
+
Django settings for {{ project_name }} project.
|
3
|
+
|
4
|
+
For more information on this file, see
|
5
|
+
https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/
|
6
|
+
|
7
|
+
For the full list of settings and their values, see
|
8
|
+
https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/
|
9
|
+
"""
|
10
|
+
import os
|
11
|
+
from pathlib import Path
|
12
|
+
|
13
|
+
from configurations import Configuration, values
|
14
|
+
|
15
|
+
|
16
|
+
class Common(Configuration):
|
17
|
+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
18
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
19
|
+
|
20
|
+
# SECURITY WARNING: keep the secret key used in production secret!
|
21
|
+
SECRET_KEY = values.SecretValue()
|
22
|
+
|
23
|
+
# SECURITY WARNING: don't run with debug turned on in production!
|
24
|
+
DEBUG = values.BooleanValue(False)
|
25
|
+
|
26
|
+
ALLOWED_HOSTS = values.ListValue([])
|
27
|
+
|
28
|
+
# Application definition
|
29
|
+
INSTALLED_APPS = [
|
30
|
+
'django.contrib.admin',
|
31
|
+
'django.contrib.auth',
|
32
|
+
'django.contrib.contenttypes',
|
33
|
+
'django.contrib.sessions',
|
34
|
+
'django.contrib.messages',
|
35
|
+
'whitenoise.runserver_nostatic',
|
36
|
+
'django.contrib.staticfiles',
|
37
|
+
|
38
|
+
'django_extensions',
|
39
|
+
'debug_toolbar',
|
40
|
+
|
41
|
+
'{{ project_name }}.users',
|
42
|
+
]
|
43
|
+
|
44
|
+
MIDDLEWARE = [
|
45
|
+
'django.middleware.security.SecurityMiddleware',
|
46
|
+
'whitenoise.middleware.WhiteNoiseMiddleware',
|
47
|
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
48
|
+
'django.middleware.common.CommonMiddleware',
|
49
|
+
'django.middleware.csrf.CsrfViewMiddleware',
|
50
|
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
51
|
+
'django.contrib.messages.middleware.MessageMiddleware',
|
52
|
+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
53
|
+
]
|
54
|
+
|
55
|
+
ROOT_URLCONF = '{{ project_name }}.urls'
|
56
|
+
|
57
|
+
TEMPLATES = [
|
58
|
+
{
|
59
|
+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
60
|
+
'DIRS': [],
|
61
|
+
'APP_DIRS': True,
|
62
|
+
'OPTIONS': {
|
63
|
+
'context_processors': [
|
64
|
+
'django.template.context_processors.debug',
|
65
|
+
'django.template.context_processors.request',
|
66
|
+
'django.contrib.auth.context_processors.auth',
|
67
|
+
'django.contrib.messages.context_processors.messages',
|
68
|
+
],
|
69
|
+
},
|
70
|
+
},
|
71
|
+
]
|
72
|
+
|
73
|
+
WSGI_APPLICATION = '{{ project_name }}.wsgi.application'
|
74
|
+
|
75
|
+
# Database
|
76
|
+
# https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#databases
|
77
|
+
DATABASES = values.DatabaseURLValue(
|
78
|
+
'sqlite:///{}'.format(os.path.join(BASE_DIR, 'db.sqlite3'))
|
79
|
+
)
|
80
|
+
|
81
|
+
# Password validation
|
82
|
+
# https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#auth-password-validators
|
83
|
+
AUTH_PASSWORD_VALIDATORS = [
|
84
|
+
{
|
85
|
+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
86
|
+
},
|
87
|
+
{
|
88
|
+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
89
|
+
},
|
90
|
+
{
|
91
|
+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
92
|
+
},
|
93
|
+
{
|
94
|
+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
95
|
+
},
|
96
|
+
]
|
97
|
+
|
98
|
+
# Internationalization
|
99
|
+
# https://docs.djangoproject.com/en/{{ docs_version }}/topics/i18n/
|
100
|
+
LANGUAGE_CODE = 'en-us'
|
101
|
+
|
102
|
+
TIME_ZONE = 'UTC'
|
103
|
+
|
104
|
+
USE_I18N = True
|
105
|
+
|
106
|
+
USE_L10N = True
|
107
|
+
|
108
|
+
USE_TZ = True
|
109
|
+
|
110
|
+
# Static files (CSS, JavaScript, Images)
|
111
|
+
# https://docs.djangoproject.com/en/{{ docs_version }}/howto/static-files/
|
112
|
+
STATIC_URL = '/static/'
|
113
|
+
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
114
|
+
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
115
|
+
|
116
|
+
# Default primary key field type
|
117
|
+
# https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#default-auto-field
|
118
|
+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
119
|
+
|
120
|
+
AUTH_USER_MODEL = 'users.User'
|
121
|
+
|
122
|
+
|
123
|
+
class Development(Common):
|
124
|
+
"""
|
125
|
+
The in-development settings and the default configuration.
|
126
|
+
"""
|
127
|
+
DEBUG = True
|
128
|
+
|
129
|
+
ALLOWED_HOSTS = []
|
130
|
+
|
131
|
+
INTERNAL_IPS = [
|
132
|
+
'127.0.0.1'
|
133
|
+
]
|
134
|
+
|
135
|
+
MIDDLEWARE = Common.MIDDLEWARE + [
|
136
|
+
'debug_toolbar.middleware.DebugToolbarMiddleware'
|
137
|
+
]
|
138
|
+
|
139
|
+
|
140
|
+
class Staging(Common):
|
141
|
+
"""
|
142
|
+
The in-staging settings.
|
143
|
+
"""
|
144
|
+
# Security
|
145
|
+
SESSION_COOKIE_SECURE = values.BooleanValue(True)
|
146
|
+
SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True)
|
147
|
+
SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True)
|
148
|
+
SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True)
|
149
|
+
SECURE_HSTS_SECONDS = values.IntegerValue(31536000)
|
150
|
+
SECURE_REDIRECT_EXEMPT = values.ListValue([])
|
151
|
+
SECURE_SSL_HOST = values.Value(None)
|
152
|
+
SECURE_SSL_REDIRECT = values.BooleanValue(True)
|
153
|
+
SECURE_PROXY_SSL_HEADER = values.TupleValue(
|
154
|
+
('HTTP_X_FORWARDED_PROTO', 'https')
|
155
|
+
)
|
156
|
+
|
157
|
+
|
158
|
+
class Production(Staging):
|
159
|
+
"""
|
160
|
+
The in-production settings.
|
161
|
+
"""
|
162
|
+
pass
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from django.conf import settings
|
2
|
+
from django.contrib import admin
|
3
|
+
from django.urls import include, path
|
4
|
+
|
5
|
+
urlpatterns = [
|
6
|
+
path('admin/', admin.site.urls),
|
7
|
+
]
|
8
|
+
|
9
|
+
if settings.DEBUG:
|
10
|
+
import debug_toolbar
|
11
|
+
urlpatterns = [
|
12
|
+
path('__debug__/', include(debug_toolbar.urls)),
|
13
|
+
] + urlpatterns
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generated by Django 1.11.2 on 2017-06-20 13:29
|
3
|
+
from __future__ import unicode_literals
|
4
|
+
|
5
|
+
import django.contrib.auth.models
|
6
|
+
import django.contrib.auth.validators
|
7
|
+
from django.db import migrations, models
|
8
|
+
import django.utils.timezone
|
9
|
+
|
10
|
+
|
11
|
+
class Migration(migrations.Migration):
|
12
|
+
|
13
|
+
initial = True
|
14
|
+
|
15
|
+
dependencies = [
|
16
|
+
('auth', '0008_alter_user_username_max_length'),
|
17
|
+
]
|
18
|
+
|
19
|
+
operations = [
|
20
|
+
migrations.CreateModel(
|
21
|
+
name='User',
|
22
|
+
fields=[
|
23
|
+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
24
|
+
('password', models.CharField(max_length=128, verbose_name='password')),
|
25
|
+
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
|
26
|
+
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
|
27
|
+
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
|
28
|
+
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
|
29
|
+
('last_name', models.CharField(blank=True, max_length=30, verbose_name='last name')),
|
30
|
+
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
|
31
|
+
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
|
32
|
+
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
33
|
+
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
34
|
+
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
|
35
|
+
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
|
36
|
+
],
|
37
|
+
options={
|
38
|
+
'verbose_name_plural': 'users',
|
39
|
+
'verbose_name': 'user',
|
40
|
+
'abstract': False,
|
41
|
+
},
|
42
|
+
managers=[
|
43
|
+
('objects', django.contrib.auth.models.UserManager()),
|
44
|
+
],
|
45
|
+
),
|
46
|
+
]
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
WSGI config for {{ project_name }} project.
|
3
|
+
|
4
|
+
It exposes the WSGI callable as a module-level variable named ``application``.
|
5
|
+
|
6
|
+
For more information on this file, see
|
7
|
+
https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/wsgi/
|
8
|
+
"""
|
9
|
+
|
10
|
+
import os
|
11
|
+
|
12
|
+
configuration = os.getenv('ENVIRONMENT', 'development').title()
|
13
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')
|
14
|
+
os.environ.setdefault('DJANGO_CONFIGURATION', configuration)
|
15
|
+
|
16
|
+
from configurations.wsgi import get_wsgi_application
|
17
|
+
|
18
|
+
application = get_wsgi_application()
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from ..template import Template
|
2
|
+
|
3
|
+
class FastapiManager(Template):
|
4
|
+
extra_libs = ["sqlalchemy", "python-multipart", "databases", "python-multipart", "aiofiles", "uvicorn", "jinja2", "bcrypt"]
|
5
|
+
extra_dirs = ["db"]
|
6
|
+
example = False
|
7
|
+
|
8
|
+
class StarletteManager(FastapiManager):
|
9
|
+
extra_libs = ["aiomysql"]
|
10
|
+
|
11
|
+
class LitestarManager(StarletteManager):
|
12
|
+
extra_libs = ["msgspec", "starlette", "httpx"]
|
13
|
+
example = True
|
@@ -0,0 +1,29 @@
|
|
1
|
+
from ..template import Template
|
2
|
+
|
3
|
+
class PyramidManager(Template):
|
4
|
+
extra_libs = ["sqlalchemy", "alembic", "pyramid_tm", "pyramid_jinja2", "pyramid_authsanity"]
|
5
|
+
|
6
|
+
class TornadoManager(Template):
|
7
|
+
extra_libs = ["motor", "aiomysql", "pytest-tornado", "aiofiles"]
|
8
|
+
|
9
|
+
class Web2pyManager(Template): ...
|
10
|
+
|
11
|
+
class GrokManager(Template):
|
12
|
+
extra_libs = ["z3c.sqlalchemy", "zope.sqlalchemy", "alembic"]
|
13
|
+
|
14
|
+
class FlaskManager(Template):
|
15
|
+
extra_libs = ["flask_sqlalchemy", "flask_migrate", "flask_wtf", "flask_login"]
|
16
|
+
extra_dirs = ["db"]
|
17
|
+
|
18
|
+
class CherryPyManager(Template):
|
19
|
+
extra_libs = ["sqlalchemy", "alembic", "Jinja2", "authlib"]
|
20
|
+
|
21
|
+
class BottleManager(Template):
|
22
|
+
extra_libs = ["sqlalchemy", "bottle-sqlalchemy", "alembic", "bottle-login", "wtforms"]
|
23
|
+
extra_libs = ["db"]
|
24
|
+
|
25
|
+
class SocketifyManager(Template):
|
26
|
+
extra_libs = ["ormar", "databases", "pydantic", "jinja2", "authlib"]
|
27
|
+
|
28
|
+
class TurboGears2Manager(Template):
|
29
|
+
extra_libs = ["sqlalchemy", "alembic", "tgext.auth", "tgext.admin"]
|
@@ -19,7 +19,7 @@ def find_manager_class(base_name: str):
|
|
19
19
|
cls_name = obj.__name__
|
20
20
|
if cls_name.lower() == base_name_lower + target_suffix:
|
21
21
|
return obj
|
22
|
-
|
22
|
+
raise Exception(f"Manager class for '{base_name}' not found. Ensure it is defined and imported correctly.")
|
23
23
|
|
24
24
|
FRAMEWORKS_PATH = Path(__file__).parent / "frameworks"
|
25
25
|
|
@@ -43,23 +43,18 @@ class Main:
|
|
43
43
|
#
|
44
44
|
self.args = self.parser.parse_args()
|
45
45
|
#
|
46
|
-
self.framework_manager = self.
|
46
|
+
self.framework_manager: type = find_manager_class(self.args.framework)
|
47
47
|
|
48
48
|
def _discover_frameworks(self):
|
49
49
|
return sorted(set([cls.__name__.removesuffix("Manager").lower() for cls in all_subclasses(Template)]))
|
50
50
|
|
51
|
-
def _load_framework_manager(self):
|
52
|
-
return find_manager_class(self.args.framework)(name=self.args.name)
|
53
|
-
|
54
51
|
def run(self):
|
55
|
-
|
52
|
+
framework = self.framework_manager(self.args.name)
|
56
53
|
#
|
57
54
|
if hasattr(self.framework_manager, "install_framework"):
|
58
|
-
|
59
|
-
|
55
|
+
framework.install_framework(version=self.args.version)
|
60
56
|
if hasattr(self.framework_manager, "create_example"):
|
61
|
-
|
62
|
-
|
57
|
+
framework.create_example(1 if self.args.example is None else self.args.example)
|
63
58
|
|
64
59
|
def main_entry_point():
|
65
60
|
Main().run()
|
@@ -0,0 +1,88 @@
|
|
1
|
+
from os import path
|
2
|
+
from .config import AutoManager
|
3
|
+
from .config import Config
|
4
|
+
from typing import Optional, List
|
5
|
+
|
6
|
+
cfg = Config()
|
7
|
+
|
8
|
+
class Template:
|
9
|
+
extra_libs: List[str] = []
|
10
|
+
extra_dirs: List[str] = []
|
11
|
+
extra_files: List[str] = []
|
12
|
+
example: bool = True
|
13
|
+
|
14
|
+
def __init_subclass__(cls, **kwargs):
|
15
|
+
super().__init_subclass__(**kwargs)
|
16
|
+
cls.framework_name = cls.__name__.lower().replace("manager", "")
|
17
|
+
|
18
|
+
bases = [base for base in cls.__mro__[1:] if issubclass(base, Template)]
|
19
|
+
|
20
|
+
seen = set()
|
21
|
+
for attr in ["extra_libs", "extra_dirs", "extra_files"]:
|
22
|
+
values = []
|
23
|
+
for base in reversed(bases):
|
24
|
+
if base not in seen:
|
25
|
+
seen.add(base)
|
26
|
+
values += getattr(base, attr, [])
|
27
|
+
values += getattr(cls, attr, [])
|
28
|
+
setattr(cls, attr, values)
|
29
|
+
|
30
|
+
cls.example = getattr(cls, "example", True)
|
31
|
+
|
32
|
+
|
33
|
+
def __init__(
|
34
|
+
self,
|
35
|
+
name: str,
|
36
|
+
framework_name: Optional[str] = None,
|
37
|
+
source_dir = cfg.source_dir,
|
38
|
+
project_name = cfg.project_name
|
39
|
+
):
|
40
|
+
self.name = name
|
41
|
+
self.framework_name = framework_name or self.__class__.framework_name
|
42
|
+
self.source_dir = source_dir
|
43
|
+
self.project_name = project_name
|
44
|
+
self.AutoManager = AutoManager()
|
45
|
+
self.extra_libs = self.__class__.extra_libs
|
46
|
+
self.extra_dirs = self.__class__.extra_dirs
|
47
|
+
self.extra_files = self.__class__.extra_files
|
48
|
+
self.example = self.__class__.example
|
49
|
+
|
50
|
+
def install_framework(self, **kwargs):
|
51
|
+
version = f"=={kwargs.get('version')}" if kwargs.get('version') else ""
|
52
|
+
libs_to_install: list = kwargs.get("libs") or []
|
53
|
+
#
|
54
|
+
libs_to_install.extend([f"{self.framework_name}{version}"])
|
55
|
+
libs_to_install.extend(self.extra_libs)
|
56
|
+
#
|
57
|
+
self.AutoManager.install_libs(libs_to_install)
|
58
|
+
#
|
59
|
+
self.setup_framework()
|
60
|
+
|
61
|
+
def setup_framework(self, _source_dir: Optional[str] = None, extra_dirs: Optional[list] = None, extra_files: Optional[list] = None):
|
62
|
+
source_dir: str = _source_dir or self.source_dir
|
63
|
+
#
|
64
|
+
dirs = (extra_dirs or []) + self.extra_dirs
|
65
|
+
files = (extra_files or []) + self.extra_files
|
66
|
+
#
|
67
|
+
if dirs:
|
68
|
+
cfg.create_dirs(source_dir, dirs)
|
69
|
+
if files:
|
70
|
+
cfg.create_files(files)
|
71
|
+
|
72
|
+
def create_example(self, example_id) -> None:
|
73
|
+
if self.example:
|
74
|
+
from pkgutil import get_data
|
75
|
+
|
76
|
+
example_code = get_data(
|
77
|
+
"rapidframework",
|
78
|
+
f"frameworks/examples/{self.framework_name}_{example_id}.py",
|
79
|
+
)
|
80
|
+
if not example_code:
|
81
|
+
raise Exception(f"Example {example_id} not found for {self.framework_name} framework.")
|
82
|
+
|
83
|
+
with open(
|
84
|
+
path.join(self.source_dir, self.name + ".py"), "w", encoding="utf-8"
|
85
|
+
) as example_file:
|
86
|
+
example_file.write(example_code.decode("utf-8"))
|
87
|
+
else:
|
88
|
+
raise Exception("Example method is'n allowed for this framework !")
|
{rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: rapidframework-lib
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.9
|
4
4
|
Description-Content-Type: text/markdown
|
5
5
|
License-File: LICENSE
|
6
6
|
Requires-Dist: msgspec
|
@@ -13,7 +13,7 @@ Dynamic: requires-dist
|
|
13
13
|
|
14
14
|
> **RapidFramework** is a Python library for quickly creating and setting up projects from templates.
|
15
15
|
|
16
|
-
## https://pypi.org/project/rapidframework-lib/1.0.
|
16
|
+
## https://pypi.org/project/rapidframework-lib/1.0.9/
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
@@ -31,7 +31,7 @@ rapidframework fastapi --name App --version 0.115.12 --example 1
|
|
31
31
|
|
32
32
|
## Features
|
33
33
|
|
34
|
-
- 📦 Create projects based on popular frameworks: **Flask**, **Django**, **FastAPI
|
34
|
+
- 📦 Create projects based on popular frameworks: **Flask**, **Django**, **FastAPI**, etc.
|
35
35
|
- 🎨 Support for custom templates via the `Template` class.
|
36
36
|
- 🚀 Built-in examples to get started quickly.
|
37
37
|
|
{rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/SOURCES.txt
RENAMED
@@ -9,19 +9,9 @@ rapidframework/template.py
|
|
9
9
|
rapidframework/__pycache__/main.cpython-313.pyc
|
10
10
|
rapidframework/configs/managers.json
|
11
11
|
rapidframework/frameworks/__init__.py
|
12
|
-
rapidframework/frameworks/bottle.py
|
13
|
-
rapidframework/frameworks/cherrypy.py
|
14
12
|
rapidframework/frameworks/django.py
|
15
13
|
rapidframework/frameworks/fastapi.py
|
16
|
-
rapidframework/frameworks/
|
17
|
-
rapidframework/frameworks/grok.py
|
18
|
-
rapidframework/frameworks/litestar.py
|
19
|
-
rapidframework/frameworks/pyramid.py
|
20
|
-
rapidframework/frameworks/socketify.py
|
21
|
-
rapidframework/frameworks/starlette.py
|
22
|
-
rapidframework/frameworks/tornado.py
|
23
|
-
rapidframework/frameworks/turbogears2.py
|
24
|
-
rapidframework/frameworks/web2py.py
|
14
|
+
rapidframework/frameworks/simple_frameworks.py
|
25
15
|
rapidframework/frameworks/examples/__init__.py
|
26
16
|
rapidframework/frameworks/examples/bottle_1.py
|
27
17
|
rapidframework/frameworks/examples/cherrypy_1.py
|
@@ -35,6 +25,17 @@ rapidframework/frameworks/examples/starlette_1.py
|
|
35
25
|
rapidframework/frameworks/examples/tornado_1.py
|
36
26
|
rapidframework/frameworks/examples/turbogears2_1.py
|
37
27
|
rapidframework/frameworks/examples/web2py_1.py
|
28
|
+
rapidframework/frameworks/examples/django_1/manage.py-tpl
|
29
|
+
rapidframework/frameworks/examples/django_1/project_name/__init__.py-tpl
|
30
|
+
rapidframework/frameworks/examples/django_1/project_name/asgi.py-tpl
|
31
|
+
rapidframework/frameworks/examples/django_1/project_name/settings.py-tpl
|
32
|
+
rapidframework/frameworks/examples/django_1/project_name/urls.py-tpl
|
33
|
+
rapidframework/frameworks/examples/django_1/project_name/wsgi.py-tpl
|
34
|
+
rapidframework/frameworks/examples/django_1/project_name/users/__init__.py-tpl
|
35
|
+
rapidframework/frameworks/examples/django_1/project_name/users/admin.py-tpl
|
36
|
+
rapidframework/frameworks/examples/django_1/project_name/users/models.py-tpl
|
37
|
+
rapidframework/frameworks/examples/django_1/project_name/users/migrations/0001_initial.py-tpl
|
38
|
+
rapidframework/frameworks/examples/django_1/project_name/users/migrations/__init__.py-tpl
|
38
39
|
rapidframework_lib.egg-info/PKG-INFO
|
39
40
|
rapidframework_lib.egg-info/SOURCES.txt
|
40
41
|
rapidframework_lib.egg-info/dependency_links.txt
|
@@ -1,83 +0,0 @@
|
|
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)
|
@@ -1,10 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
|
3
|
-
|
4
|
-
class BottleManager(Template):
|
5
|
-
def __init__(self, **kwargs):
|
6
|
-
super().__init__(**kwargs)
|
7
|
-
|
8
|
-
def install_framework(self, **kwargs):
|
9
|
-
return super().install_framework(libs=\
|
10
|
-
["sqlalchemy", "bottle-sqlalchemy", "alembic", "bottle-login", "wtforms"], **kwargs)
|
@@ -1,10 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
|
3
|
-
|
4
|
-
class CherryPyManager(Template):
|
5
|
-
def __init__(self, **kwargs):
|
6
|
-
super().__init__(**kwargs)
|
7
|
-
|
8
|
-
def install_framework(self, **kwargs):
|
9
|
-
return super().install_framework(libs=\
|
10
|
-
["sqlalchemy", "alembic", "Jinja2", "authlib"], **kwargs)
|
@@ -1,25 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
from subprocess import run
|
3
|
-
from os import chdir
|
4
|
-
|
5
|
-
|
6
|
-
class DjangoManager(Template):
|
7
|
-
def __init__(self, **kwargs):
|
8
|
-
super().__init__(**kwargs)
|
9
|
-
|
10
|
-
def run_manage(self, commands: list):
|
11
|
-
chdir(f"{self.source_dir}/{self.project_name}")
|
12
|
-
for command in commands:
|
13
|
-
run(("uv run manage.py " + command.strip()).split(" "))
|
14
|
-
|
15
|
-
def setup_framework(self):
|
16
|
-
run(["uvx", "--from", "django", "django-admin", "startproject", self.project_name])
|
17
|
-
self.run_manage([f"startapp {self.name}", "makemigrations", "migrate"])
|
18
|
-
return super().setup_framework(f"{self.source_dir}/{self.project_name}/{self.name}", \
|
19
|
-
extra_files=[f"{self.project_name}/{self.name}/urls.py"])
|
20
|
-
|
21
|
-
def install_framework(self, **kwargs):
|
22
|
-
return super().install_framework(libs=["Pillow"], **kwargs)
|
23
|
-
|
24
|
-
def create_example(self, name, example_id) -> None:
|
25
|
-
return None
|
@@ -1,17 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
|
3
|
-
|
4
|
-
class FastapiManager(Template):
|
5
|
-
def __init__(self, extra_libs: list = \
|
6
|
-
["sqlalchemy", "databases", "python-multipart", "aiofiles"], **kwargs):
|
7
|
-
|
8
|
-
self.extra_libs = extra_libs
|
9
|
-
super().__init__(**kwargs)
|
10
|
-
|
11
|
-
def setup_framework(self, extra_dirs=["db"]):
|
12
|
-
return super().setup_framework(extra_dirs=extra_dirs)
|
13
|
-
|
14
|
-
def install_framework(self, **kwargs):
|
15
|
-
self.extra_libs.extend(["uvicorn", "jinja2", "bcrypt"])
|
16
|
-
return super().install_framework(libs=\
|
17
|
-
self.extra_libs, **kwargs)
|
@@ -1,10 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
|
3
|
-
|
4
|
-
class FlaskManager(Template):
|
5
|
-
def __init__(self, **kwargs):
|
6
|
-
super().__init__(**kwargs)
|
7
|
-
|
8
|
-
def install_framework(self, **kwargs):
|
9
|
-
return super().install_framework(libs=\
|
10
|
-
["flask_sqlalchemy", "flask_migrate", "flask_wtf", "flask_login"], **kwargs)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
|
3
|
-
|
4
|
-
class GrokManager(Template):
|
5
|
-
def __init__(self, **kwargs):
|
6
|
-
super().__init__(**kwargs)
|
7
|
-
|
8
|
-
def install_framework(self, **kwargs):
|
9
|
-
return super().install_framework(libs=\
|
10
|
-
["z3c.sqlalchemy", "zope.sqlalchemy", "alembic"], **kwargs)
|
11
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
|
3
|
-
|
4
|
-
class PyramidManager(Template):
|
5
|
-
def __init__(self, **kwargs):
|
6
|
-
super().__init__(**kwargs)
|
7
|
-
|
8
|
-
def install_framework(self, **kwargs):
|
9
|
-
return super().install_framework(libs=\
|
10
|
-
["sqlalchemy", "alembic", "pyramid_tm", "pyramid_jinja2", "pyramid_authsanity"], **kwargs)
|
11
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
|
3
|
-
|
4
|
-
class SocketifyManager(Template):
|
5
|
-
def __init__(self, **kwargs):
|
6
|
-
super().__init__(**kwargs)
|
7
|
-
|
8
|
-
def install_framework(self, **kwargs):
|
9
|
-
return super().install_framework(libs=\
|
10
|
-
["ormar", "databases", "pydantic", "jinja2", "authlib"], **kwargs)
|
11
|
-
|
@@ -1,9 +0,0 @@
|
|
1
|
-
from .fastapi import FastapiManager
|
2
|
-
|
3
|
-
|
4
|
-
class StarletteManager(FastapiManager):
|
5
|
-
def __init__(self, extra_libs = \
|
6
|
-
["sqlalchemy", "aiomysql", "python-multipart", "aiofiles"], **kwargs):
|
7
|
-
|
8
|
-
self.extra_libs = extra_libs
|
9
|
-
super().__init__(extra_libs, **kwargs)
|
@@ -1,10 +0,0 @@
|
|
1
|
-
from ..template import Template
|
2
|
-
|
3
|
-
|
4
|
-
class TurboGears2Manager(Template):
|
5
|
-
def __init__(self, **kwargs):
|
6
|
-
super().__init__(**kwargs)
|
7
|
-
|
8
|
-
def install_framework(self, **kwargs):
|
9
|
-
return super().install_framework(libs=\
|
10
|
-
["sqlalchemy", "alembic", "tgext.auth", "tgext.admin"], **kwargs)
|
@@ -1,55 +0,0 @@
|
|
1
|
-
from os import path
|
2
|
-
from .config import AutoManager
|
3
|
-
from .config import Config
|
4
|
-
|
5
|
-
|
6
|
-
cfg = Config()
|
7
|
-
|
8
|
-
|
9
|
-
class Template:
|
10
|
-
def __init__(
|
11
|
-
self,
|
12
|
-
framework_name: str | None = None,
|
13
|
-
source_dir=cfg.source_dir,
|
14
|
-
project_name=cfg.project_name,
|
15
|
-
**kwargs
|
16
|
-
):
|
17
|
-
if framework_name is None:
|
18
|
-
self.framework_name = self.__class__.__name__.lower().replace("manager", "")
|
19
|
-
else:
|
20
|
-
self.framework_name = framework_name
|
21
|
-
#
|
22
|
-
self.source_dir = source_dir
|
23
|
-
self.project_name = project_name
|
24
|
-
self.name = kwargs.get("name")
|
25
|
-
#
|
26
|
-
self.AutoManager = AutoManager()
|
27
|
-
#
|
28
|
-
|
29
|
-
def install_framework(self, **kwargs):
|
30
|
-
version = f"=={kwargs.get('version')}" if kwargs.get('version') else ""
|
31
|
-
libs_to_install: list = kwargs.get("libs") or []
|
32
|
-
#
|
33
|
-
libs_to_install.extend([f"{self.framework_name}{version}"])
|
34
|
-
print("Getting libs")
|
35
|
-
self.AutoManager.install_libs(libs_to_install)
|
36
|
-
#
|
37
|
-
self.setup_framework()
|
38
|
-
|
39
|
-
def setup_framework(self, source_dir=cfg.source_dir, extra_dirs=[], extra_files: list=None):
|
40
|
-
cfg.create_dirs(source_dir, extra_dirs)
|
41
|
-
if extra_files is not None:
|
42
|
-
cfg.create_files(extra_files)
|
43
|
-
|
44
|
-
def create_example(self, name, example_id):
|
45
|
-
from pkgutil import get_data
|
46
|
-
|
47
|
-
example_code = get_data(
|
48
|
-
"rapidframework",
|
49
|
-
f"frameworks/examples/{self.framework_name}_{example_id}.py",
|
50
|
-
).decode("utf-8")
|
51
|
-
|
52
|
-
with open(
|
53
|
-
path.join(cfg.source_dir, name + ".py"), "w", encoding="utf-8"
|
54
|
-
) as example_file:
|
55
|
-
example_file.write(example_code)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/configs/managers.json
RENAMED
File without changes
|
{rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework/frameworks/examples/grok_1.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.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/entry_points.txt
RENAMED
File without changes
|
{rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/requires.txt
RENAMED
File without changes
|
{rapidframework_lib-1.0.8.1 → rapidframework_lib-1.0.9}/rapidframework_lib.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|