1st
This commit is contained in:
commit
6bb3d18373
|
@ -0,0 +1,3 @@
|
||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
poetry.lock
|
|
@ -0,0 +1,204 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"label": "annotations",
|
||||||
|
"importPath": "__future__",
|
||||||
|
"description": "__future__",
|
||||||
|
"isExtraImport": true,
|
||||||
|
"detail": "__future__",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "os",
|
||||||
|
"kind": 6,
|
||||||
|
"isExtraImport": true,
|
||||||
|
"importPath": "os",
|
||||||
|
"description": "os",
|
||||||
|
"detail": "os",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "site",
|
||||||
|
"kind": 6,
|
||||||
|
"isExtraImport": true,
|
||||||
|
"importPath": "site",
|
||||||
|
"description": "site",
|
||||||
|
"detail": "site",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "sys",
|
||||||
|
"kind": 6,
|
||||||
|
"isExtraImport": true,
|
||||||
|
"importPath": "sys",
|
||||||
|
"description": "sys",
|
||||||
|
"detail": "sys",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "logging",
|
||||||
|
"kind": 6,
|
||||||
|
"isExtraImport": true,
|
||||||
|
"importPath": "logging",
|
||||||
|
"description": "logging",
|
||||||
|
"detail": "logging",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "uuid",
|
||||||
|
"kind": 6,
|
||||||
|
"isExtraImport": true,
|
||||||
|
"importPath": "uuid",
|
||||||
|
"description": "uuid",
|
||||||
|
"detail": "uuid",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "load_dotenv",
|
||||||
|
"importPath": "dotenv",
|
||||||
|
"description": "dotenv",
|
||||||
|
"isExtraImport": true,
|
||||||
|
"detail": "dotenv",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Union",
|
||||||
|
"importPath": "typing",
|
||||||
|
"description": "typing",
|
||||||
|
"isExtraImport": true,
|
||||||
|
"detail": "typing",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "FastAPI",
|
||||||
|
"importPath": "fastapi",
|
||||||
|
"description": "fastapi",
|
||||||
|
"isExtraImport": true,
|
||||||
|
"detail": "fastapi",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "logger",
|
||||||
|
"importPath": "app.constants",
|
||||||
|
"description": "app.constants",
|
||||||
|
"isExtraImport": true,
|
||||||
|
"detail": "app.constants",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "bin_dir",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "bin_dir = os.path.dirname(abs_file)\nbase = bin_dir[: -len(\"bin\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"gitea-integration-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "base",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "base = bin_dir[: -len(\"bin\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"gitea-integration-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "os.environ[\"PATH\"]",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "os.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"gitea-integration-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "os.environ[\"VIRTUAL_ENV\"]",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "os.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"gitea-integration-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "os.environ[\"VIRTUAL_ENV_PROMPT\"]",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "os.environ[\"VIRTUAL_ENV_PROMPT\"] = \"gitea-integration-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "prev_length",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "prev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "sys.path[:]",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "sys.real_prefix",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "sys.real_prefix = sys.prefix\nsys.prefix = base",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "sys.prefix",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": ".venv.bin.activate_this",
|
||||||
|
"description": ".venv.bin.activate_this",
|
||||||
|
"peekOfCode": "sys.prefix = base",
|
||||||
|
"detail": ".venv.bin.activate_this",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "logger",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": "app.constants",
|
||||||
|
"description": "app.constants",
|
||||||
|
"peekOfCode": "logger = logging.getLogger(__name__)",
|
||||||
|
"detail": "app.constants",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "read_root",
|
||||||
|
"kind": 2,
|
||||||
|
"importPath": "app.main",
|
||||||
|
"description": "app.main",
|
||||||
|
"peekOfCode": "def read_root():\n return {\"Hello\": \"World\"}\n@app.post(\"/integration\")\ndef intgr(body):\n logger.info(body)\n return {\"status\": \"success\"}",
|
||||||
|
"detail": "app.main",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "intgr",
|
||||||
|
"kind": 2,
|
||||||
|
"importPath": "app.main",
|
||||||
|
"description": "app.main",
|
||||||
|
"peekOfCode": "def intgr(body):\n logger.info(body)\n return {\"status\": \"success\"}",
|
||||||
|
"detail": "app.main",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "app",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": "app.main",
|
||||||
|
"description": "app.main",
|
||||||
|
"peekOfCode": "app = FastAPI()\n@app.get(\"/\")\ndef read_root():\n return {\"Hello\": \"World\"}\n@app.post(\"/integration\")\ndef intgr(body):\n logger.info(body)\n return {\"status\": \"success\"}",
|
||||||
|
"detail": "app.main",
|
||||||
|
"documentation": {}
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,11 @@
|
||||||
|
import logging
|
||||||
|
import uuid
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
logging.basicConfig(
|
||||||
|
format="%(asctime)s - %(name)s - %(filename)s:%(lineno)d %(levelname)s - %(message)s",
|
||||||
|
level=logging.INFO,
|
||||||
|
)
|
||||||
|
logging.getLogger("httpx").setLevel(logging.WARNING)
|
||||||
|
logger = logging.getLogger(__name__)
|
|
@ -0,0 +1,17 @@
|
||||||
|
from typing import Union
|
||||||
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
from app.constants import logger
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
def read_root():
|
||||||
|
return {"Hello": "World"}
|
||||||
|
|
||||||
|
|
||||||
|
@app.post("/integration")
|
||||||
|
def intgr(body):
|
||||||
|
logger.info(body)
|
||||||
|
return {"status": "success"}
|
|
@ -0,0 +1,28 @@
|
||||||
|
[tool.poetry]
|
||||||
|
name = "gitea-integration"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = ""
|
||||||
|
authors = ["aarizona <ar.ariz.arizona@gmail.com>"]
|
||||||
|
readme = "README.md"
|
||||||
|
package-mode = false
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.10"
|
||||||
|
fastapi = "^0.110.3"
|
||||||
|
uvicorn = "^0.29.0"
|
||||||
|
python-dotenv = "^1.0.1"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
taskipy = "^1.12.2"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
|
[tool.taskipy.tasks]
|
||||||
|
# Launch Commands for Local Development
|
||||||
|
app = "uvicorn app.main:app --reload"
|
||||||
|
# Docker-Compose Tasks
|
||||||
|
# compose-up = "docker-compose -f docker-compose.local.yml -f docker-compose.worker.yml -f docker-compose.yml up --build"
|
||||||
|
# compose-down = "docker-compose -f docker-compose.local.yml -f docker-compose.worker.yml -f docker-compose.yml down --remove-orphans"
|
Loading…
Reference in New Issue