-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91b7198
commit a443f22
Showing
172 changed files
with
628 additions
and
125 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ DB_HOST=localhost | |
DB_PORT=3306 | ||
DB_USER=root | ||
DB_PASSWORD= | ||
DB_DATABASE=pesty | ||
DB_DATABASE=nestipy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from pesty.common.decorator.injectable import Injectable | ||
from pesty.common.decorator.middleware import PestyMiddleware | ||
from nestipy.common.decorator.injectable import Injectable | ||
from nestipy.common.decorator.middleware import NestipyMiddleware | ||
|
||
|
||
@Injectable() | ||
class AppMiddleware(PestyMiddleware): | ||
class AppMiddleware(NestipyMiddleware): | ||
def use(self, scope, receive, send): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import uvicorn | ||
|
||
from app_module import AppModule | ||
from pesty.core.factory import AppPestyFactory | ||
from nestipy.core.factory import AppNestipyFactory | ||
|
||
app = AppPestyFactory.create(AppModule, title="My app") | ||
app = AppNestipyFactory.create(AppModule, title="My app") | ||
|
||
if __name__ == '__main__': | ||
uvicorn.run('main:app', host="0.0.0.0", port=8000, reload=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+191 Bytes
(130%)
exemple/src/graphql/__pycache__/graphql_module.cpython-311.pyc
Binary file not shown.
Binary file modified
BIN
+593 Bytes
(150%)
exemple/src/graphql/__pycache__/graphql_resolver.cpython-311.pyc
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[tool.poetry] | ||
name = "pesty" | ||
name = "nestipy" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["tsiresymila <[email protected]>"] | ||
readme = "README.md" | ||
packages = [{include = "pesty", from = "src"}] | ||
packages = [{include = "nestipy", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
|
@@ -18,8 +18,12 @@ minijinja = "^1.0.8" | |
pyee = "^11.1.0" | ||
snakecase = "^1.0.1" | ||
strawberry-graphql = "^0.219.2" | ||
pathlib2 = "^2.3.7.post1" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry.scripts] | ||
nestipy = "nestipy.cli.cli:main" |
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import click | ||
|
||
from nestipy.cli.handler import NestipyCliHandler | ||
from nestipy.cli.style import CliStyle | ||
|
||
handler = NestipyCliHandler() | ||
echo = CliStyle() | ||
|
||
|
||
@click.group() | ||
def main(): | ||
pass | ||
|
||
|
||
@main.command() | ||
@click.argument('name') | ||
def new(name): | ||
""" Create new project """ | ||
# if not shutil.which('poetry'): | ||
click.clear() | ||
created = handler.create_project(name) | ||
if not created: | ||
echo.error(f"Folder {name} already exist.") | ||
echo.info(f"Project {name} created successfully.\nStart your project by running:\n\tcd {name}" | ||
f"\n\tpython -m pip install -r requirements.py\n\tpython main.py") | ||
# else: | ||
# echo.error(f"Nestipy need poetry as dependency manager.") | ||
|
||
|
||
@main.group(name='generate') | ||
def make(): | ||
""" Generate resource, module, controller, service, resolver, graphql input """ | ||
pass | ||
|
||
|
||
@make.command(name='resource') | ||
@click.argument('name') | ||
def resource(name): | ||
"""Create new resource for project.""" | ||
name = str(name).lower() | ||
choice = click.prompt('Select resource type:', type=click.Choice(['api', 'graphql'], case_sensitive=False)) | ||
if choice == 'graphql': | ||
handler.generate_resource_graphql(name) | ||
else: | ||
handler.generate_resource_api(name) | ||
echo.success(f"Resource created successfully inside src/{name}." | ||
f"\nDon't forget to include {name.capitalize()}Module as imports of AppModule") | ||
|
||
|
||
@make.command() | ||
@click.argument('name') | ||
def module(name): | ||
"""Create new module""" | ||
name = str(name).lower() | ||
handler.generate_module(name, prefix='single') | ||
echo.success(f"Module created successfully inside src/{name}." | ||
f"\nDon't forget to include {name.capitalize()}Module as imports of AppModule") | ||
|
||
|
||
@make.command() | ||
@click.argument('name') | ||
def controller(name): | ||
""" Create new controller """ | ||
name = str(name).lower() | ||
handler.generate_controller(name, prefix='single') | ||
echo.success(f"Controller created successfully inside src/{name}.") | ||
|
||
|
||
@make.command() | ||
@click.argument('name') | ||
def resolver(name): | ||
""" Create new graphql resolver """ | ||
handler.generate_resolver(name, prefix='single') | ||
echo.success(f"Resolver created successfully inside src/{name}.") | ||
|
||
|
||
@make.command() | ||
@click.argument('name') | ||
def service(name): | ||
""" Create new service """ | ||
name = str(name).lower() | ||
handler.generate_service(name, prefix='single') | ||
echo.success(f"Service created successfully inside src/{name}.") | ||
|
||
|
||
@make.command(name='input') | ||
@click.argument('name') | ||
def graphql_input(name): | ||
""" Create new service """ | ||
name = str(name).lower() | ||
handler.generate_service(name, prefix='single') | ||
echo.success(f"Graphql Input created successfully inside src/{name}.") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.