From 6bf265f139a53600bffddc8705ddae562b6af11a Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 3 Apr 2023 16:53:28 +0400 Subject: [PATCH] Using setup.py instead of pyproject.toml, tutorial in setup.py, updated deps --- README.md | 3 ++- mypy.ini | 6 ++++++ pyproject.toml | 26 -------------------------- requirements.txt | 2 +- setup.py | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 28 deletions(-) create mode 100644 mypy.ini delete mode 100644 pyproject.toml create mode 100644 setup.py diff --git a/README.md b/README.md index 4a0bfd1..b9460e4 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Make commands: |`make prod`|Run a production server| |`make docker` or `make docker-build`|Build a docker image from `Dockerfile`| |`make docker-push`|Upload the built image to Docker Hub| +|`make docker-run`|Starts the containers with Docker Compose| |`make clean`|Clean all cache| @@ -89,7 +90,7 @@ Make commands: - `db_url` is the MySQL connection URL generated from the sql_settings configuration; just edit the line declaring `db_url` in `db.py` - if you are going to use other DBMS, e.g. PostgresSQL + if you are going to use other DBMS, e.g. PostgreSQL ### Paths `app/paths` directory contains all FastAPI paths diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..c18351e --- /dev/null +++ b/mypy.ini @@ -0,0 +1,6 @@ +[mypy] +show_error_codes = True +ignore_missing_imports = True +check_untyped_defs = True +warn_redundant_casts = True +warn_unused_configs = True diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 19c9b7c..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,26 +0,0 @@ -[project] -name = "app" -version = "1.0.0" -dependencies = [ - "fastapi", - "uvicorn[standard]", - "gunicorn", - "jinja2", - "starlette-wtf", - "sqlalchemy", - "sqlalchemy-utils", - "mysqlclient", - "python-dotenv", - "autopep8", - "pylint", - "mypy", -] - -[tool.setuptools] -packages = [] - -[tool.mypy] -show_error_codes = true -ignore_missing_imports = true -warn_redundant_casts = true -check_untyped_defs = true diff --git a/requirements.txt b/requirements.txt index 81d2c26..2366429 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ jinja2~=3.1.2 starlette-wtf~=0.4.3 wtforms~=3.0.1 -sqlalchemy~=2.0.7 +sqlalchemy~=2.0.8 sqlalchemy-utils~=0.40.0 mysqlclient~=2.1.1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b71fbf4 --- /dev/null +++ b/setup.py @@ -0,0 +1,36 @@ +import sys +import setuptools +from tkinter import Tk, ttk + + +def template_tutorial() -> None: + """Shows a short tutorial for this template, + generates secret tokens and copies the proper docker-compose.yml + asking for the preferred DBMS (MySQL or PostgreSQL)""" + + +# Run the tutorial just once, +# when pip calls the script +# with the `egg_info` argument +if len(sys.argv) >= 1 and sys.argv[1] == 'egg_info': + template_tutorial() + +setuptools.setup( + name='app', + version='1.0.0', + install_requires=[ + 'fastapi', + 'uvicorn[standard]', + 'gunicorn', + 'jinja2', + 'starlette-wtf', + 'sqlalchemy', + 'sqlalchemy-utils', + 'mysqlclient', + 'python-dotenv', + 'autopep8', + 'pylint', + 'mypy', + ], + python_requires='>=3.7', +)