0.2.22-granian+precommit
This commit is contained in:
parent
537b89dbaf
commit
e6f2ed6f53
|
@ -1,3 +1,7 @@
|
||||||
|
[0.2.22]
|
||||||
|
- precommit installed
|
||||||
|
- granian asgi added
|
||||||
|
|
||||||
[0.2.19]
|
[0.2.19]
|
||||||
- versioning sync with core, inbox, presence
|
- versioning sync with core, inbox, presence
|
||||||
- fix: auth connection user_id trimming
|
- fix: auth connection user_id trimming
|
||||||
|
|
|
@ -19,4 +19,4 @@ RUN apt-get update && apt-get install -y gcc curl && \
|
||||||
poetry install --no-dev
|
poetry install --no-dev
|
||||||
|
|
||||||
# Run server.py when the container launches
|
# Run server.py when the container launches
|
||||||
CMD ["python", "server.py"]
|
CMD granian --no-ws --host 0.0.0.0 --port 80 --interface asgi main:app
|
||||||
|
|
106
pyproject.toml
106
pyproject.toml
|
@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "discoursio-notifier"
|
name = "discoursio-notifier"
|
||||||
version = "0.2.19"
|
version = "0.2.22"
|
||||||
description = "notifier server for discours.io"
|
description = "notifier server for discours.io"
|
||||||
authors = ["discours.io devteam"]
|
authors = ["discours.io devteam"]
|
||||||
|
|
||||||
|
@ -13,53 +13,75 @@ python = "^3.12"
|
||||||
SQLAlchemy = "^2.0.22"
|
SQLAlchemy = "^2.0.22"
|
||||||
psycopg2-binary = "^2.9.9"
|
psycopg2-binary = "^2.9.9"
|
||||||
redis = {extras = ["hiredis"], version = "^5.0.1"}
|
redis = {extras = ["hiredis"], version = "^5.0.1"}
|
||||||
uvicorn = "^0.24.0"
|
strawberry-graphql = {extras = ["asgi", "debug-server"], version = "^0.219.0" }
|
||||||
strawberry-graphql = {extras = ["asgi", "debug-server"], version = "^0.216.1" }
|
strawberry-sqlalchemy-mapper = "^0.4.2"
|
||||||
strawberry-sqlalchemy-mapper = "^0.4.0"
|
sentry-sdk = "^1.39.2"
|
||||||
sentry-sdk = "^1.37.1"
|
|
||||||
aiohttp = "^3.9.1"
|
aiohttp = "^3.9.1"
|
||||||
|
pre-commit = "^3.6.0"
|
||||||
|
granian = "^1.0.1"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
setuptools = "^69.0.2"
|
setuptools = "^69.0.2"
|
||||||
|
pyright = "^1.1.341"
|
||||||
pytest = "^7.4.2"
|
pytest = "^7.4.2"
|
||||||
black = { version = "^23.12.0", python = ">=3.12" }
|
black = { version = "^23.12.0", python = ">=3.12" }
|
||||||
ruff = { version = "^0.1.8", python = ">=3.12" }
|
ruff = { version = "^0.1.8", python = ">=3.12" }
|
||||||
mypy = { version = "^1.7", python = ">=3.12" }
|
|
||||||
isort = "^5.13.2"
|
isort = "^5.13.2"
|
||||||
pyright = "^1.1.341"
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 120
|
||||||
|
extend-select = [
|
||||||
|
# E and F are enabled by default
|
||||||
|
'B', # flake8-bugbear
|
||||||
|
'C4', # flake8-comprehensions
|
||||||
|
'C90', # mccabe
|
||||||
|
'I', # isort
|
||||||
|
'N', # pep8-naming
|
||||||
|
'Q', # flake8-quotes
|
||||||
|
'S', # flake8-bandit
|
||||||
|
'W', # pycodestyle
|
||||||
|
]
|
||||||
|
extend-ignore = [
|
||||||
|
'B008', # function calls in args defaults are fine
|
||||||
|
'B009', # getattr with constants is fine
|
||||||
|
'B034', # re.split won't confuse us
|
||||||
|
'B904', # rising without from is fine
|
||||||
|
'E501', # leave line length to black
|
||||||
|
'N818', # leave to us exceptions naming
|
||||||
|
'S101', # assert is fine
|
||||||
|
'E712', # allow == True
|
||||||
|
]
|
||||||
|
flake8-quotes = { inline-quotes = 'single', multiline-quotes = 'double' }
|
||||||
|
mccabe = { max-complexity = 13 }
|
||||||
|
target-version = "py312"
|
||||||
|
|
||||||
|
[tool.ruff.format]
|
||||||
|
quote-style = 'single'
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
line-length = 120
|
skip-string-normalization = true
|
||||||
target-version = ['py312']
|
|
||||||
include = '\.pyi?$'
|
|
||||||
exclude = '''
|
|
||||||
|
|
||||||
(
|
[tool.ruff.isort]
|
||||||
/(
|
combine-as-imports = true
|
||||||
\.eggs # exclude a few common directories in the
|
lines-after-imports = 2
|
||||||
| \.git # root of the project
|
known-first-party = ['resolvers', 'services', 'orm', 'tests']
|
||||||
| \.hg
|
|
||||||
| \.mypy_cache
|
|
||||||
| \.tox
|
|
||||||
| \.venv
|
|
||||||
| _build
|
|
||||||
| buck-out
|
|
||||||
| build
|
|
||||||
| dist
|
|
||||||
)/
|
|
||||||
| foo.py # also separately exclude a file named foo.py in
|
|
||||||
# the root of the project
|
|
||||||
)
|
|
||||||
'''
|
|
||||||
|
|
||||||
[tool.isort]
|
[tool.ruff.per-file-ignores]
|
||||||
multi_line_output = 3
|
'tests/**' = ['B018', 'S110', 'S501']
|
||||||
include_trailing_comma = true
|
|
||||||
force_grid_wrap = 0
|
|
||||||
use_parentheses = true
|
|
||||||
ensure_newline_before_comments = true
|
|
||||||
line_length = 120
|
|
||||||
|
|
||||||
|
[tool.mypy]
|
||||||
|
python_version = "3.12"
|
||||||
|
warn_return_any = true
|
||||||
|
warn_unused_configs = true
|
||||||
|
ignore_missing_imports = true
|
||||||
|
exclude = ["nb"]
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
asyncio_mode = 'auto'
|
||||||
|
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
venvPath = "."
|
venvPath = "."
|
||||||
|
@ -87,17 +109,3 @@ logLevel = "Information"
|
||||||
pluginSearchPaths = []
|
pluginSearchPaths = []
|
||||||
typings = {}
|
typings = {}
|
||||||
mergeTypeStubPackages = false
|
mergeTypeStubPackages = false
|
||||||
|
|
||||||
[tool.mypy]
|
|
||||||
python_version = "3.12"
|
|
||||||
warn_unused_configs = true
|
|
||||||
plugins = ["mypy_sqlalchemy.plugin", "strawberry.ext.mypy_plugin"]
|
|
||||||
|
|
||||||
[tool.ruff]
|
|
||||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
|
||||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
|
||||||
# McCabe complexity (`C901`) by default.
|
|
||||||
select = ["E4", "E7", "E9", "F"]
|
|
||||||
ignore = []
|
|
||||||
line-length = 120
|
|
||||||
target-version = "py312"
|
|
||||||
|
|
59
server.py
59
server.py
|
@ -1,59 +0,0 @@
|
||||||
import sys
|
|
||||||
|
|
||||||
import uvicorn
|
|
||||||
from uvicorn.main import logger
|
|
||||||
|
|
||||||
from settings import PORT
|
|
||||||
|
|
||||||
log_settings = {
|
|
||||||
"version": 1,
|
|
||||||
"disable_existing_loggers": True,
|
|
||||||
"formatters": {
|
|
||||||
"default": {
|
|
||||||
"()": "uvicorn.logging.DefaultFormatter",
|
|
||||||
"fmt": "%(levelprefix)s %(message)s",
|
|
||||||
"use_colors": None,
|
|
||||||
},
|
|
||||||
"access": {
|
|
||||||
"()": "uvicorn.logging.AccessFormatter",
|
|
||||||
"fmt": '%(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"handlers": {
|
|
||||||
"default": {
|
|
||||||
"formatter": "default",
|
|
||||||
"class": "logging.StreamHandler",
|
|
||||||
"stream": "ext://sys.stderr",
|
|
||||||
},
|
|
||||||
"access": {
|
|
||||||
"formatter": "access",
|
|
||||||
"class": "logging.StreamHandler",
|
|
||||||
"stream": "ext://sys.stdout",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"loggers": {
|
|
||||||
"uvicorn": {"handlers": ["default"], "level": "INFO"},
|
|
||||||
"uvicorn.error": {"level": "INFO", "handlers": ["default"], "propagate": True},
|
|
||||||
"uvicorn.access": {"handlers": ["access"], "level": "INFO", "propagate": False},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local_headers = [
|
|
||||||
("Access-Control-Allow-Methods", "GET, POST, OPTIONS, HEAD"),
|
|
||||||
("Access-Control-Allow-Origin", "https://localhost:3000"),
|
|
||||||
(
|
|
||||||
"Access-Control-Allow-Headers",
|
|
||||||
"DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization",
|
|
||||||
),
|
|
||||||
("Access-Control-Expose-Headers", "Content-Length,Content-Range"),
|
|
||||||
("Access-Control-Allow-Credentials", "true"),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def exception_handler(_et, exc, _tb):
|
|
||||||
logger.error(..., exc_info=(type(exc), exc, exc.__traceback__))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.excepthook = exception_handler
|
|
||||||
uvicorn.run("main:app", host="0.0.0.0", port=PORT, proxy_headers=True, server_header=True)
|
|
Loading…
Reference in New Issue
Block a user