diff --git a/README.md b/README.md index e69de29..3183e19 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,44 @@ +
+ +## Description + +Nestipy is a framework for building efficient, scalable Python +server-side applications. It uses modern Python typing combines with elements of OOP (Object Oriented Programming), FP ( +Functional Programming). + +Under the hood, Nestipy makes use of Litestar, but also provides compatibility with a wide range of other libraries, like FastAPI, allowing for easy use of the myriad of third-party plugins which are available.
+ +## Philosophy + +Nestipy aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, and loosely coupled and easily maintainable applications. The architecture is heavily inspired by Angular.
+ +## Getting started + +```cmd + pip install nestipy + nestipy new my_app + cd my_app + python main.py +``` + +## Questions + +## Issues + +Please make sure to read the [Issue Reporting Checklist](https://github.com/tsiresymila/nestipy) before opening an +issue. Issues not conforming to the guidelines may be closed immediately. + +## Support + +Nestipy is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. +If you'd like to join them, please [read more here](https://docs.nestipy.com/support). + +## Stay in touch + +- Author - [Tsiresy Mila](https://tsiresymila.vercel.app) + +## License + +Nestipy is [MIT licensed](LICENSE). \ No newline at end of file diff --git a/nestipy.png b/nestipy.png new file mode 100644 index 0000000..e2c8b53 Binary files /dev/null and b/nestipy.png differ diff --git a/src/nestipy/cli/handler.py b/src/nestipy/cli/handler.py index 0658404..7f60b44 100644 --- a/src/nestipy/cli/handler.py +++ b/src/nestipy/cli/handler.py @@ -1,5 +1,4 @@ import os.path -from pathlib2 import Path from nestipy.common.templates.generator import TemplateGenerator @@ -39,6 +38,7 @@ def generate_resource_graphql(self, name): def generate_module(self, name: str, prefix: str = None): path = self.mkdir(name) self.generate(name, path, 'module', prefix=prefix) + self.modify_app_module(name) def generate_controller(self, name: str, prefix: str = None): path = self.mkdir(name) @@ -73,14 +73,14 @@ def generate(self, name, parent_path, template, prefix: str = None): @classmethod def modify_app_module(cls, name): name = str(name) - app_path = os.path.join(os.getcwd(), 'app_module.py') + app_path = os.path.join(os.getcwd(), 'src', 'app_module.py') if os.path.exists(app_path): new_import = f"{str(name).capitalize()}Module" with open(app_path, 'r') as file: file_content = file.read() file.close() module_pattern = r'@Module\(([^)]*)\)' - text_to_add = f'from src/{name.lower()}_module import {name.capitalize()}Module' + text_to_add = f'from .{name.lower()}.{name.lower()}_module import {name.capitalize()}Module' import re match = re.search(module_pattern, file_content) if match: @@ -96,7 +96,8 @@ def modify_app_module(cls, name): else: # If imports=[] doesn't exist, add imports directly modified_content = file_content.replace(match.group(0), - text_to_add + '\n@Module(imports=[' + new_import + '],') + text_to_add + f'\n@Module(\n\timports=[{new_import}],' + f'{existing_imports_str})') with open(app_path, 'w') as file2: file2.write(modified_content) file2.close() diff --git a/src/nestipy/core/platform/platform_litestar.py b/src/nestipy/core/platform/platform_litestar.py index d2f469b..757b75f 100644 --- a/src/nestipy/core/platform/platform_litestar.py +++ b/src/nestipy/core/platform/platform_litestar.py @@ -38,6 +38,9 @@ def controller_to_extend_litestar_controller(ctrl): if not inspect.ismethod(value) and not inspect.isfunction(value) and not inspect.isbuiltin( value) and name != '__slots__': class_attrs[name] = value + + if not hasattr(ctrl, 'tags'): + class_attrs['tags'] = [str(ctrl.__name__).replace('Controller', '')] return type(ctrl.__name__, (Controller,), {**class_attrs, "__module__": ctrl.__module__})