rapidframework-lib 1.0.7.2__py3-none-any.whl → 1.0.8.1__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.
Files changed (34) hide show
  1. rapidframework/__init__.py +1 -4
  2. rapidframework/frameworks/__init__.py +15 -5
  3. rapidframework/frameworks/bottle.py +1 -1
  4. rapidframework/frameworks/{cherryPy.py → cherrypy.py} +2 -2
  5. rapidframework/frameworks/django.py +1 -1
  6. rapidframework/frameworks/examples/pyramid_1.py +14 -0
  7. rapidframework/frameworks/fastapi.py +1 -1
  8. rapidframework/frameworks/flask.py +1 -1
  9. rapidframework/frameworks/grok.py +1 -1
  10. rapidframework/frameworks/pyramid.py +1 -1
  11. rapidframework/frameworks/socketify.py +1 -1
  12. rapidframework/frameworks/turbogears2.py +2 -2
  13. rapidframework/frameworks/web2py.py +1 -1
  14. rapidframework/main.py +21 -15
  15. rapidframework/{frameworks/template.py → template.py} +3 -4
  16. {rapidframework_lib-1.0.7.2.dist-info → rapidframework_lib-1.0.8.1.dist-info}/METADATA +2 -2
  17. rapidframework_lib-1.0.8.1.dist-info/RECORD +39 -0
  18. rapidframework/frameworks/examples/pyramid_example_1.py +0 -0
  19. rapidframework_lib-1.0.7.2.dist-info/RECORD +0 -39
  20. /rapidframework/frameworks/examples/{bottle_example_1.py → bottle_1.py} +0 -0
  21. /rapidframework/frameworks/examples/{cherrypy_example_1.py → cherrypy_1.py} +0 -0
  22. /rapidframework/frameworks/examples/{fastapi_example_1.py → fastapi_1.py} +0 -0
  23. /rapidframework/frameworks/examples/{flask_example_1.py → flask_1.py} +0 -0
  24. /rapidframework/frameworks/examples/{grok_example_1.py → grok_1.py} +0 -0
  25. /rapidframework/frameworks/examples/{litestar_example_1.py → litestar_1.py} +0 -0
  26. /rapidframework/frameworks/examples/{socketify_example_1.py → socketify_1.py} +0 -0
  27. /rapidframework/frameworks/examples/{starlette_example_1.py → starlette_1.py} +0 -0
  28. /rapidframework/frameworks/examples/{tornado_example_1.py → tornado_1.py} +0 -0
  29. /rapidframework/frameworks/examples/{turbogears2_example_1.py → turbogears2_1.py} +0 -0
  30. /rapidframework/frameworks/examples/{web2py_example_1.py → web2py_1.py} +0 -0
  31. {rapidframework_lib-1.0.7.2.dist-info → rapidframework_lib-1.0.8.1.dist-info}/WHEEL +0 -0
  32. {rapidframework_lib-1.0.7.2.dist-info → rapidframework_lib-1.0.8.1.dist-info}/entry_points.txt +0 -0
  33. {rapidframework_lib-1.0.7.2.dist-info → rapidframework_lib-1.0.8.1.dist-info}/licenses/LICENSE +0 -0
  34. {rapidframework_lib-1.0.7.2.dist-info → rapidframework_lib-1.0.8.1.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,5 @@
1
- from .frameworks import FlaskManager as FlaskManager
2
- from .frameworks import DjangoManager as DjangoManager
3
- from .frameworks import FastapiManager as FastapiManager
4
-
5
1
  from .config import Config as Config
6
2
  from .config import AutoManager as AutoManager
3
+ from .frameworks import Template as Template
7
4
 
8
5
  __version__ = '0.0.1'
@@ -1,6 +1,16 @@
1
- from .django import DjangoManager as DjangoManager
2
- from .flask import FlaskManager as FlaskManager
3
- from .fastapi import FastapiManager as FastapiManager
4
- from .template import Template as Template
1
+ from ..template import Template as Template
2
+ from .examples import *
5
3
 
6
- from .examples import *
4
+ import os
5
+ import importlib
6
+
7
+ def import_all_modules_from_package():
8
+ current_dir = os.path.dirname(__file__)
9
+ package_name = __name__
10
+
11
+ for filename in os.listdir(current_dir):
12
+ if filename.endswith(".py") and filename != "__init__.py":
13
+ module_name = filename[:-3]
14
+ importlib.import_module(f"{package_name}.{module_name}")
15
+
16
+ import_all_modules_from_package()
@@ -1,4 +1,4 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
4
  class BottleManager(Template):
@@ -1,7 +1,7 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
- class Cherrypymanager(Template):
4
+ class CherryPyManager(Template):
5
5
  def __init__(self, **kwargs):
6
6
  super().__init__(**kwargs)
7
7
 
@@ -1,4 +1,4 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
  from subprocess import run
3
3
  from os import chdir
4
4
 
@@ -0,0 +1,14 @@
1
+ from wsgiref.simple_server import make_server
2
+ from pyramid.config import Configurator
3
+ from pyramid.response import Response
4
+
5
+ def hello_world(request):
6
+ return Response('Hello World!')
7
+
8
+ if __name__ == '__main__':
9
+ with Configurator() as config:
10
+ config.add_route('hello', '/')
11
+ config.add_view(hello_world, route_name='hello')
12
+ app = config.make_wsgi_app()
13
+ server = make_server('0.0.0.0', 6543, app)
14
+ server.serve_forever()
@@ -1,4 +1,4 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
4
  class FastapiManager(Template):
@@ -1,4 +1,4 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
4
  class FlaskManager(Template):
@@ -1,4 +1,4 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
4
  class GrokManager(Template):
@@ -1,4 +1,4 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
4
  class PyramidManager(Template):
@@ -1,4 +1,4 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
4
  class SocketifyManager(Template):
@@ -1,7 +1,7 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
- class Turbogears2Manager(Template):
4
+ class TurboGears2Manager(Template):
5
5
  def __init__(self, **kwargs):
6
6
  super().__init__(**kwargs)
7
7
 
@@ -1,4 +1,4 @@
1
- from .template import Template
1
+ from ..template import Template
2
2
 
3
3
 
4
4
  class Web2pyManager(Template):
rapidframework/main.py CHANGED
@@ -1,8 +1,25 @@
1
1
  import argparse
2
- import importlib
3
- import os
4
2
  from pathlib import Path
3
+ from . import Template
5
4
  #
5
+ import gc
6
+
7
+ def all_subclasses(cls):
8
+ subclasses = cls.__subclasses__()
9
+ for subclass in subclasses:
10
+ subclasses += all_subclasses(subclass)
11
+ return subclasses
12
+
13
+ def find_manager_class(base_name: str):
14
+ base_name_lower = base_name.lower()
15
+ target_suffix = "manager"
16
+
17
+ for obj in gc.get_objects():
18
+ if isinstance(obj, type):
19
+ cls_name = obj.__name__
20
+ if cls_name.lower() == base_name_lower + target_suffix:
21
+ return obj
22
+ return None
6
23
 
7
24
  FRAMEWORKS_PATH = Path(__file__).parent / "frameworks"
8
25
 
@@ -29,21 +46,10 @@ class Main:
29
46
  self.framework_manager = self._load_framework_manager()
30
47
 
31
48
  def _discover_frameworks(self):
32
- frameworks = []
33
- for file in os.listdir(FRAMEWORKS_PATH):
34
- if file.endswith(".py") and file != "__init__.py":
35
- framework_name = file.removesuffix('.py').lower()
36
- frameworks.append(framework_name)
37
- return frameworks
49
+ return sorted(set([cls.__name__.removesuffix("Manager").lower() for cls in all_subclasses(Template)]))
38
50
 
39
51
  def _load_framework_manager(self):
40
- module_name = f"rapidframework.frameworks.{self.args.framework}"
41
- class_name = f"{self.args.framework.capitalize()}Manager"
42
-
43
- module = importlib.import_module(module_name)
44
- manager_class = getattr(module, class_name)
45
-
46
- return manager_class(name=self.args.name)
52
+ return find_manager_class(self.args.framework)(name=self.args.name)
47
53
 
48
54
  def run(self):
49
55
  example_id = 1 if self.args.example is None else self.args.example
@@ -1,6 +1,6 @@
1
1
  from os import path
2
- from ..config import AutoManager
3
- from ..config import Config
2
+ from .config import AutoManager
3
+ from .config import Config
4
4
 
5
5
 
6
6
  cfg = Config()
@@ -42,12 +42,11 @@ class Template:
42
42
  cfg.create_files(extra_files)
43
43
 
44
44
  def create_example(self, name, example_id):
45
- print(self.framework_name)
46
45
  from pkgutil import get_data
47
46
 
48
47
  example_code = get_data(
49
48
  "rapidframework",
50
- f"frameworks/examples/{self.framework_name}_example_{example_id}.py",
49
+ f"frameworks/examples/{self.framework_name}_{example_id}.py",
51
50
  ).decode("utf-8")
52
51
 
53
52
  with open(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rapidframework-lib
3
- Version: 1.0.7.2
3
+ Version: 1.0.8.1
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.7.2/
16
+ ## https://pypi.org/project/rapidframework-lib/1.0.8.2/
17
17
 
18
18
  ## Installation
19
19
 
@@ -0,0 +1,39 @@
1
+ rapidframework/__init__.py,sha256=0f6S18Vy0QQs3VW9m4A6sNDfHoYGvf9Dzk32xlZ5RNs,151
2
+ rapidframework/config.py,sha256=lNptfXPi50MELfL2BnaQFa9-ea6lv7R9abqipFwqwYE,2767
3
+ rapidframework/main.py,sha256=eVafBtS7oeoR5Ti2omA7Wy3sWpUblk7A13SKqfTJZBI,2159
4
+ rapidframework/template.py,sha256=-M7Utp0pvVdjiEFur914fOjOfEe-mYZS-lFGMiZr_ws,1696
5
+ rapidframework/__pycache__/main.cpython-313.pyc,sha256=J3Y41E5fOwmGEQtwgTq-NBUl0s0VxCvDC5KUnCGvIdU,3891
6
+ rapidframework/configs/managers.json,sha256=EEBDjTVQuNXGIF_oIXuNVpXK4kTk2HsRb2aPrbmUjo4,664
7
+ rapidframework/frameworks/__init__.py,sha256=CJETvRzO000nPloWwKFd-AnLmR5PM9SSZUyB-C4M8a4,464
8
+ rapidframework/frameworks/bottle.py,sha256=C6n0TOBnq27wlusBnK0F0YtuorINOUNJzvHMesJpqyM,327
9
+ rapidframework/frameworks/cherrypy.py,sha256=qgcphhuZL9YGwyT1lu3izBeWqhu0DyQt3OaqKjbZqG4,302
10
+ rapidframework/frameworks/django.py,sha256=-Cb5bvwHbnJIk8Tx4PDY4wk1v6_GZWwbkr-JFDvnhP8,956
11
+ rapidframework/frameworks/fastapi.py,sha256=ionnghpdyq3CngCvp4Lq8zUz5AmcKNe6mA3SctZKkDU,583
12
+ rapidframework/frameworks/flask.py,sha256=5p7fO7EnmcbEsvytAso55hPt7gWmGEdteFIu1uvA0SE,318
13
+ rapidframework/frameworks/grok.py,sha256=lXrDDKIJg9QVUUKx8vcpSOBxWHUiYAKC8aBR4oPSpqk,301
14
+ rapidframework/frameworks/litestar.py,sha256=tssP54TeOlBKr7dPi8vwttbTuJC1Gyme6Hapiai78LQ,266
15
+ rapidframework/frameworks/pyramid.py,sha256=ikmgRRluBUPBj1uq5BBl7CAvG4mYtVieYqnyRBWGnAo,335
16
+ rapidframework/frameworks/socketify.py,sha256=eyg-FnObKil7isb-B_B_hsqN44ADBvknyLXTBJ9COT4,314
17
+ rapidframework/frameworks/starlette.py,sha256=1Pd-G8OZSmz8p2nnro14ge3m7avXMn6ZIQYvfWv5H-A,288
18
+ rapidframework/frameworks/tornado.py,sha256=5WvPV3KntAt1WrQiURl12WikXPgL5xOa4OWwQGKSDqI,233
19
+ rapidframework/frameworks/turbogears2.py,sha256=NUtV_EtCaAcytyeRpqkUlOYYSHsadqF5fxHVqWmCo0k,313
20
+ rapidframework/frameworks/web2py.py,sha256=aaewCYr8kk4p7gRlLzLn_xZCdBGFX5eMvVyk7h_7Hm0,134
21
+ rapidframework/frameworks/examples/__init__.py,sha256=ovguP4wzQEDNguczwiZnhMm4dRRVcvnzmHrfQtlRCNQ,15
22
+ rapidframework/frameworks/examples/bottle_1.py,sha256=AhEqgse_IinZ0jx211y0ybyxB0dknGI-x6zhIOQ4Qos,118
23
+ rapidframework/frameworks/examples/cherrypy_1.py,sha256=BKNIPXOgWFTpnwyFK46NMDmPtFnhAARAPAkwgQ-0CYQ,146
24
+ rapidframework/frameworks/examples/fastapi_1.py,sha256=Rhmcr1BrBHR1_xhqk4UmZiF5MDqixRbucR03T6yvBvg,261
25
+ rapidframework/frameworks/examples/flask_1.py,sha256=DuVlouunkJtGygqrU2B_ysKUtKTP-MWCmgpHmTGqeJM,428
26
+ rapidframework/frameworks/examples/grok_1.py,sha256=Lz9xIGiYf1q4IJIMQVy1uzGeBLw2opXOdwqnSdv0j3A,146
27
+ rapidframework/frameworks/examples/litestar_1.py,sha256=kcAsS3LE5g6ZYmkNtRsrLHTNSmtCUXtsgJmoOtiubnk,220
28
+ rapidframework/frameworks/examples/pyramid_1.py,sha256=k1pinobySIBnWQI4KxpvnFTjgFPFzLzYRijhvY4p7U8,456
29
+ rapidframework/frameworks/examples/socketify_1.py,sha256=xV54kgvvXRhqhvGLet9qGE13ZdMVI3EvZ_AV1csCWx0,184
30
+ rapidframework/frameworks/examples/starlette_1.py,sha256=6T9tUyXJ329qHl3ZYgNOCy5eXOX8luT2HP_FWfQ6E4Y,268
31
+ rapidframework/frameworks/examples/tornado_1.py,sha256=vnOqnzcFyCFSMl_5x4pyfbYi6PL9EMQBn9Mv_6yXpZM,368
32
+ rapidframework/frameworks/examples/turbogears2_1.py,sha256=IytFwU7N-qSi3CDQDrN2wNHDAfV60swOw44_D-UDr-I,435
33
+ rapidframework/frameworks/examples/web2py_1.py,sha256=fscmfjeH9HUb96aDGZBLS88e9Fx_nbU1usLDb0GWbRs,41
34
+ rapidframework_lib-1.0.8.1.dist-info/licenses/LICENSE,sha256=lXsPzvyEfL6vjzMMCRYi7gpsIjpSUYUsDF-MvMHyhc0,1070
35
+ rapidframework_lib-1.0.8.1.dist-info/METADATA,sha256=Vz8yDMEpPe7OXH6IbctscljhqkcfjjqQFigUYt3xdzA,1241
36
+ rapidframework_lib-1.0.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ rapidframework_lib-1.0.8.1.dist-info/entry_points.txt,sha256=UaOaGJ-BDCxtmNoPp-u_TnXXLbnXtrB13PYr5BgqmHA,72
38
+ rapidframework_lib-1.0.8.1.dist-info/top_level.txt,sha256=7PXDkFZsYowz4aB2xVaSso4qD45jd2kHn6x3xxhMMNs,15
39
+ rapidframework_lib-1.0.8.1.dist-info/RECORD,,
File without changes
@@ -1,39 +0,0 @@
1
- rapidframework/__init__.py,sha256=5HJcv-kJl0RPcWiShgyMPUVPjvRH4Qb2ormsHCJ5v5Y,272
2
- rapidframework/config.py,sha256=lNptfXPi50MELfL2BnaQFa9-ea6lv7R9abqipFwqwYE,2767
3
- rapidframework/main.py,sha256=evivz6o-ltpeq9P4BkLUPa6HRrdSFc5tL8PTDZ9aysM,2066
4
- rapidframework/__pycache__/main.cpython-313.pyc,sha256=J3Y41E5fOwmGEQtwgTq-NBUl0s0VxCvDC5KUnCGvIdU,3891
5
- rapidframework/configs/managers.json,sha256=EEBDjTVQuNXGIF_oIXuNVpXK4kTk2HsRb2aPrbmUjo4,664
6
- rapidframework/frameworks/__init__.py,sha256=fFmRgwuTqQ9dKCY3AgjUCWt2V2xTjSN7Y2NKkaURQAk,220
7
- rapidframework/frameworks/bottle.py,sha256=mkIwRT3ZZtE070D6OMimao8axNg7GYkQ4xgUimaIkgQ,326
8
- rapidframework/frameworks/cherryPy.py,sha256=3cOlXEwwyzFCkiQtMiBz_qHS7wjiDCcB7Z1E3Yzt3Zo,301
9
- rapidframework/frameworks/django.py,sha256=vpUd8Yrm-_8yBn0tzv0tXWjrE1TakTFnSV5Oz5K4O_s,955
10
- rapidframework/frameworks/fastapi.py,sha256=4Mgn_3Mzn8lZvFXSjoQnUDjNe2bOynVbtD1O_81ApKA,582
11
- rapidframework/frameworks/flask.py,sha256=yk1tw3uRM1rL3z5vfSS3TpP2Lc-WwpKoPM6t5JQt-OY,317
12
- rapidframework/frameworks/grok.py,sha256=aqXwlX75S0o-YdiLuOF6nqgjGU3DluqtD9qttLhq_Rw,300
13
- rapidframework/frameworks/litestar.py,sha256=tssP54TeOlBKr7dPi8vwttbTuJC1Gyme6Hapiai78LQ,266
14
- rapidframework/frameworks/pyramid.py,sha256=eCcBLsxAWNBV8A6pjS-CTpu4O7l7kOPd5NcGCrEppxs,334
15
- rapidframework/frameworks/socketify.py,sha256=wuNHeFW9EqpXlLDhWV0A9yyoK-YpjQCpViTS-QoETO8,313
16
- rapidframework/frameworks/starlette.py,sha256=1Pd-G8OZSmz8p2nnro14ge3m7avXMn6ZIQYvfWv5H-A,288
17
- rapidframework/frameworks/template.py,sha256=DFfDJ6ry-KEVDsRvupwOevj3keX91mUyTtsRPBApVC0,1741
18
- rapidframework/frameworks/tornado.py,sha256=5WvPV3KntAt1WrQiURl12WikXPgL5xOa4OWwQGKSDqI,233
19
- rapidframework/frameworks/turbogears2.py,sha256=0XAK7ko6Kk_L2m7cEekGVpxRP_HHjaTRn0RCR7cR01M,312
20
- rapidframework/frameworks/web2py.py,sha256=2kXxl-uamBSqD7O0a_L4RwT7HPcF8SG2liTU8MXfIlY,133
21
- rapidframework/frameworks/examples/__init__.py,sha256=ovguP4wzQEDNguczwiZnhMm4dRRVcvnzmHrfQtlRCNQ,15
22
- rapidframework/frameworks/examples/bottle_example_1.py,sha256=AhEqgse_IinZ0jx211y0ybyxB0dknGI-x6zhIOQ4Qos,118
23
- rapidframework/frameworks/examples/cherrypy_example_1.py,sha256=BKNIPXOgWFTpnwyFK46NMDmPtFnhAARAPAkwgQ-0CYQ,146
24
- rapidframework/frameworks/examples/fastapi_example_1.py,sha256=Rhmcr1BrBHR1_xhqk4UmZiF5MDqixRbucR03T6yvBvg,261
25
- rapidframework/frameworks/examples/flask_example_1.py,sha256=DuVlouunkJtGygqrU2B_ysKUtKTP-MWCmgpHmTGqeJM,428
26
- rapidframework/frameworks/examples/grok_example_1.py,sha256=Lz9xIGiYf1q4IJIMQVy1uzGeBLw2opXOdwqnSdv0j3A,146
27
- rapidframework/frameworks/examples/litestar_example_1.py,sha256=kcAsS3LE5g6ZYmkNtRsrLHTNSmtCUXtsgJmoOtiubnk,220
28
- rapidframework/frameworks/examples/pyramid_example_1.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- rapidframework/frameworks/examples/socketify_example_1.py,sha256=xV54kgvvXRhqhvGLet9qGE13ZdMVI3EvZ_AV1csCWx0,184
30
- rapidframework/frameworks/examples/starlette_example_1.py,sha256=6T9tUyXJ329qHl3ZYgNOCy5eXOX8luT2HP_FWfQ6E4Y,268
31
- rapidframework/frameworks/examples/tornado_example_1.py,sha256=vnOqnzcFyCFSMl_5x4pyfbYi6PL9EMQBn9Mv_6yXpZM,368
32
- rapidframework/frameworks/examples/turbogears2_example_1.py,sha256=IytFwU7N-qSi3CDQDrN2wNHDAfV60swOw44_D-UDr-I,435
33
- rapidframework/frameworks/examples/web2py_example_1.py,sha256=fscmfjeH9HUb96aDGZBLS88e9Fx_nbU1usLDb0GWbRs,41
34
- rapidframework_lib-1.0.7.2.dist-info/licenses/LICENSE,sha256=lXsPzvyEfL6vjzMMCRYi7gpsIjpSUYUsDF-MvMHyhc0,1070
35
- rapidframework_lib-1.0.7.2.dist-info/METADATA,sha256=YXkZOpp9ubqScUJI5EFXiqijHInlnV3k634C8cpWx8Y,1241
36
- rapidframework_lib-1.0.7.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- rapidframework_lib-1.0.7.2.dist-info/entry_points.txt,sha256=UaOaGJ-BDCxtmNoPp-u_TnXXLbnXtrB13PYr5BgqmHA,72
38
- rapidframework_lib-1.0.7.2.dist-info/top_level.txt,sha256=7PXDkFZsYowz4aB2xVaSso4qD45jd2kHn6x3xxhMMNs,15
39
- rapidframework_lib-1.0.7.2.dist-info/RECORD,,