diff --git a/README.md b/README.md index 9d3cadd..cc15591 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ Generator features: - Optional Sentry integration; - Optional Loguru logger; - Optional Opentelemetry integration. +- Optional taskiq integration. This project can handle arguments passed through command line. @@ -88,6 +89,7 @@ Options: --ci [none|gitlab_ci|github] Select a CI for your app --redis Add redis support --rabbit Add RabbitMQ support + --taskiq Add Taskiq support --migrations Add Migrations --kube Add kubernetes configs --dummy Add dummy model diff --git a/fastapi_template/__main__.py b/fastapi_template/__main__.py index 518e8e3..5822480 100644 --- a/fastapi_template/__main__.py +++ b/fastapi_template/__main__.py @@ -1,4 +1,3 @@ -import json from pathlib import Path from cookiecutter.exceptions import FailedHookException, OutputDirExistsException diff --git a/fastapi_template/cli.py b/fastapi_template/cli.py index 3a8fd42..0a7e33b 100644 --- a/fastapi_template/cli.py +++ b/fastapi_template/cli.py @@ -1,3 +1,4 @@ +import shutil from fastapi_template.input_model import ( BuilderContext, MenuEntry, @@ -585,4 +586,18 @@ def run_command(callback: Callable[[BuilderContext], None]) -> None: ) for menu in menus: cmd.params.extend(menu.get_cli_options()) + required_commands = { + "poetry": "https://python-poetry.org/docs/#installation", + "git": "https://git-scm.com/", + } + for prog, link in required_commands.items(): + if shutil.which(prog) is None: + print( + "Please install {prog} before generating project. Link: {link}".format( + prog=colored(prog, "green"), + link=colored(link, "cyan"), + ), + ) + return + cmd.main() diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml b/fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml index f25a7fe..87a0ac2 100644 --- a/fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml +++ b/fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml @@ -218,6 +218,13 @@ src_folder = "./{{cookiecutter.project_name}}" {%- endif %} {%- endif %} +[fastapi-template.options] +{%- for key, value in cookiecutter.items() %} +{%- if not key.startswith("_") and not key == "db_info" %} +{{key}} = "{{value}}" +{%- endif %} +{%- endfor %} + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" diff --git a/pyproject.toml b/pyproject.toml index ebab86f..9b862df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fastapi_template" -version = "4.1.0" +version = "4.1.1" description = "Feature-rich robust FastAPI template" authors = ["Pavel Kirilin "] packages = [{ include = "fastapi_template" }]