From 39e6c9685aa313fe81e5b2e2cadfbf5db6e3aa74 Mon Sep 17 00:00:00 2001 From: Ben Davis Date: Sun, 23 May 2021 15:50:45 -0700 Subject: [PATCH] Changes to be committed: modified: README.md new file: app/logger.py new file: app/main.py new file: configs/app.json new file: configs/logger.ini new file: run.py --- README.md | 36 ++++++++++++++++++++++++++++++++++++ app/logger.py | 3 +++ app/main.py | 13 +++++++++++++ configs/app.json | 0 configs/logger.ini | 0 run.py | 8 ++++++++ 6 files changed, 60 insertions(+) create mode 100644 app/logger.py create mode 100644 app/main.py create mode 100644 configs/app.json create mode 100644 configs/logger.ini create mode 100644 run.py diff --git a/README.md b/README.md index e69de29..b67f5df 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,36 @@ +## Install enviorment +When possible use a virtual enviromnet. PyPy3.x or python3.9 (or the current versions) + +### macOS +If you already have current python or pypy installed you can skip this otherwise type the following at your terminal: `brew install python@3.9 pypy3` +You may also need to install/update pip for pypy. + +``` +pip_pypy3 install --upgrade pip setuptools +``` + +On macOS you may get the warning from brew that the tools are not in your path. +You can set it by entering + +``` +export PATH=$PATH:/usr/local/share/pypy3 +``` + +### Virtual Enviorment +Create your virtual enviorment. In some instances you may need to set your python interpetur enviorment. +`export PYTHONENV=$(pwd)` will set it to your current directory. +#### Setting up PyPy +``` +cd +pypy3 -mvenv .venv +. .venv/bin/activate +``` +_Note: that `.venv` is what ever path you want your enviroment to be set in. This example opts to make it a hidden folder `.`. + + +### Installing dependancy +``` +pip3 install ipython requests httpx fastapi uvicorn ormar ujson loguru jinja2 aiofiles aiosqlite aiomysql +``` +_Note: If you want to use ujson or orjson you will need to install additional tools esp w/ pypy. + diff --git a/app/logger.py b/app/logger.py new file mode 100644 index 0000000..4a11896 --- /dev/null +++ b/app/logger.py @@ -0,0 +1,3 @@ +from loguru import logger + + diff --git a/app/main.py b/app/main.py new file mode 100644 index 0000000..96759b6 --- /dev/null +++ b/app/main.py @@ -0,0 +1,13 @@ +from fastapi import FastAPI +from .logger import logger + +async def app_builder(**kwargs) -> FastAPI: + ''' + Create FastAPI app + ''' + app = FastAPI() + + + return app + +app = app_builder() \ No newline at end of file diff --git a/configs/app.json b/configs/app.json new file mode 100644 index 0000000..e69de29 diff --git a/configs/logger.ini b/configs/logger.ini new file mode 100644 index 0000000..e69de29 diff --git a/run.py b/run.py new file mode 100644 index 0000000..f515af4 --- /dev/null +++ b/run.py @@ -0,0 +1,8 @@ +import uvicorn +from app import main +from loguru import logger + +app = main.app + +if __name__ == '__main__': + uvicorn('app.main:app', host=app.host, port=app.port) \ No newline at end of file