-
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.
Merge pull request #3 from aarcex3/main
refactor: improve cli
- Loading branch information
Showing
32 changed files
with
317 additions
and
47 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Variables | ||
PYTHON := pdm run python | ||
PYTEST := pdm run pytest | ||
RUFF := pdm run ruff format | ||
FIND := find | ||
|
||
# Directories | ||
SRC_DIR := src | ||
TEST_DIR := tests | ||
|
||
# Targets | ||
.PHONY: clean test run | ||
|
||
|
||
#Format the files | ||
format: | ||
$(RUFF) $(SRC_DIR) | ||
$(RUFF) $(TEST_DIR) | ||
|
||
# Clean target to delete __pycache__ directories | ||
clean: | ||
$(FIND) . -type d -name "__pycache__" -exec rm -rf {} + | ||
|
||
test: | ||
$(PYTEST) $(TEST_DIR) -vv -s --showlocals |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VENV_NAME = ".venv" |
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 was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from typing import Dict | ||
|
||
from litestar import Controller, get | ||
from litestar.di import Provide | ||
from litestar.enums import MediaType | ||
from litestar.status_codes import HTTP_200_OK | ||
from src.app_service import AppService, provide_app_service | ||
|
||
|
||
class AppController(Controller): | ||
"""App controller.""" | ||
|
||
dependencies = {"app_service": Provide(provide_app_service)} | ||
|
||
@get(path="/", status_code=HTTP_200_OK, media_type=MediaType.JSON) | ||
async def index(self, app_service: AppService) -> Dict: | ||
"""App index""" | ||
return await app_service.app_info() |
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,16 @@ | ||
from typing import Dict | ||
|
||
|
||
class AppService: | ||
"""App Service""" | ||
|
||
app_name = "" | ||
app_version = "0.1.0" | ||
|
||
async def app_info(self) -> Dict[str, str]: | ||
"""Return info about the app""" | ||
return {"app_name": self.app_name, "verion": self.app_version} | ||
|
||
|
||
def provide_app_service(): | ||
return AppService() |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
Empty file.
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,6 @@ | ||
from litestar.controller import Controller | ||
|
||
|
||
class {{resource_name.capitalize()}}Controller(Controller): | ||
"""{{resource_name.capitalize()}} Controller""" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from advanced_alchemy.extensions.litestar.dto import SQLAlchemyDTO, SQLAlchemyDTOConfig | ||
|
||
from src.{{resource_name.lower()}}.models import {{resource_name.capitalize()}} | ||
|
||
|
||
class {{resource_name.capitalize()}}DTO(SQLAlchemyDTO[{{resource_name.capitalize()}}]): | ||
""" | ||
{{resource_name.capitalize()}} DTO | ||
""" | ||
config = SQLAlchemyDTOConfig() |
Oops, something went wrong.