mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
add ruff to ci
This commit is contained in:
parent
976e3b0f3f
commit
d9811d6588
13
.github/workflows/build-and-test.yml
vendored
13
.github/workflows/build-and-test.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
sqldb:
|
||||
image: postgres:14
|
||||
env:
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_USER: app-user
|
||||
POSTGRES_PASSWORD: secret
|
||||
POSTGRES_DB: testdb
|
||||
ports:
|
||||
@ -26,7 +26,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Create database schema
|
||||
run: PGPASSWORD=secret psql -h 127.0.0.1 -d testdb -U user -c "CREATE SCHEMA shakespeare; CREATE SCHEMA happy_hog;"
|
||||
run: PGPASSWORD=secret psql -h 127.0.0.1 -d testdb -U app-user -c "CREATE SCHEMA shakespeare; CREATE SCHEMA happy_hog;"
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
@ -43,14 +43,15 @@ jobs:
|
||||
- name: Install dependencies
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
||||
run: poetry install --no-interaction --no-root
|
||||
- name: Test
|
||||
- name: Test Code
|
||||
run: poetry run pytest
|
||||
- name: Lint Code
|
||||
run: poetry run ruff .
|
||||
env:
|
||||
PYTHONDONTWRITEBYTECODE: 1
|
||||
PYTHONUNBUFFERED: 1
|
||||
SQL_DB: testdb
|
||||
SQL_HOST: 127.0.0.1
|
||||
SQL_USER: user
|
||||
SQL_USER: app-user
|
||||
POSTGRES_PASSWORD: secret
|
||||
PGPASSWORD: secret
|
||||
|
||||
PGPASSWORD: secret
|
@ -27,10 +27,10 @@ class Settings(BaseSettings):
|
||||
|
||||
"""
|
||||
|
||||
pg_user: str = os.getenv("SQL_USER", "")
|
||||
pg_pass: str = os.getenv("POSTGRES_PASSWORD", "")
|
||||
pg_user: str = os.getenv("SQL_USER", "app-user")
|
||||
pg_pass: str = os.getenv("POSTGRES_PASSWORD", "secret")
|
||||
pg_host: str = os.getenv("SQL_HOST", "")
|
||||
pg_database: str = os.getenv("SQL_DB", "")
|
||||
pg_database: str = os.getenv("SQL_DB", "testdb")
|
||||
asyncpg_url: str = f"postgresql+asyncpg://{pg_user}:{pg_pass}@{pg_host}:5432/{pg_database}"
|
||||
|
||||
jwt_secret_key: str = os.getenv("SECRET_KEY", "")
|
||||
|
48
poetry.lock
generated
48
poetry.lock
generated
@ -451,7 +451,7 @@ testing = ["docopt", "pytest (<6.0.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "pathspec"
|
||||
version = "0.10.1"
|
||||
version = "0.10.2"
|
||||
description = "Utility library for gitignore style pattern matching of file paths."
|
||||
category = "main"
|
||||
optional = false
|
||||
@ -478,7 +478,7 @@ python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "platformdirs"
|
||||
version = "2.5.3"
|
||||
version = "2.5.4"
|
||||
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||
category = "main"
|
||||
optional = false
|
||||
@ -718,7 +718,7 @@ python-versions = ">=3.5"
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.0.113"
|
||||
version = "0.0.114"
|
||||
description = "An extremely fast Python linter, written in Rust."
|
||||
category = "main"
|
||||
optional = false
|
||||
@ -957,7 +957,7 @@ python-versions = ">=3.7"
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.10"
|
||||
content-hash = "f20ad3e109b842603c1b29aa116f08c784fdef47bcd08f872b83d64af21733a9"
|
||||
content-hash = "5e8cfc83f7512762f5e80f561c79d014dc14c2e814b02a95b0e2c083e3f3acab"
|
||||
|
||||
[metadata.files]
|
||||
alembic = [
|
||||
@ -1337,8 +1337,8 @@ parso = [
|
||||
{file = "parso-0.8.3.tar.gz", hash = "sha256:8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0"},
|
||||
]
|
||||
pathspec = [
|
||||
{file = "pathspec-0.10.1-py3-none-any.whl", hash = "sha256:46846318467efc4556ccfd27816e004270a9eeeeb4d062ce5e6fc7a87c573f93"},
|
||||
{file = "pathspec-0.10.1.tar.gz", hash = "sha256:7ace6161b621d31e7902eb6b5ae148d12cfd23f4a249b9ffb6b9fee12084323d"},
|
||||
{file = "pathspec-0.10.2-py3-none-any.whl", hash = "sha256:88c2606f2c1e818b978540f73ecc908e13999c6c3a383daf3705652ae79807a5"},
|
||||
{file = "pathspec-0.10.2.tar.gz", hash = "sha256:8f6bf73e5758fd365ef5d58ce09ac7c27d2833a8d7da51712eac6e27e35141b0"},
|
||||
]
|
||||
pexpect = [
|
||||
{file = "pexpect-4.8.0-py2.py3-none-any.whl", hash = "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937"},
|
||||
@ -1349,8 +1349,8 @@ pickleshare = [
|
||||
{file = "pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca"},
|
||||
]
|
||||
platformdirs = [
|
||||
{file = "platformdirs-2.5.3-py3-none-any.whl", hash = "sha256:0cb405749187a194f444c25c82ef7225232f11564721eabffc6ec70df83b11cb"},
|
||||
{file = "platformdirs-2.5.3.tar.gz", hash = "sha256:6e52c21afff35cb659c6e52d8b4d61b9bd544557180440538f255d9382c8cbe0"},
|
||||
{file = "platformdirs-2.5.4-py3-none-any.whl", hash = "sha256:af0276409f9a02373d540bf8480021a048711d572745aef4b7842dad245eba10"},
|
||||
{file = "platformdirs-2.5.4.tar.gz", hash = "sha256:1006647646d80f16130f052404c6b901e80ee4ed6bef6792e1f238a8969106f7"},
|
||||
]
|
||||
pluggy = [
|
||||
{file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"},
|
||||
@ -1528,22 +1528,22 @@ rich = [
|
||||
{file = "ruamel.yaml.clib-0.2.7.tar.gz", hash = "sha256:1f08fd5a2bea9c4180db71678e850b995d2a5f4537be0e94557668cf0f5f9497"},
|
||||
]
|
||||
ruff = [
|
||||
{file = "ruff-0.0.113-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:c789d6a031c3ad253f8b49b1c5769c343549d82e2a71b2b1b8bb8d8f218d3ff5"},
|
||||
{file = "ruff-0.0.113-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:65ca244426fd2340f685c4dba649f97be38299bfc2949286539fc8184e5ebe8a"},
|
||||
{file = "ruff-0.0.113-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b7d96107b4006be23df0ed65885786e0c125e70912ac0d5be8d6d57bde38c76d"},
|
||||
{file = "ruff-0.0.113-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:484224b6ed909d89e52b48a8c4ab24661876de2a9d36632ea758faced4d581ac"},
|
||||
{file = "ruff-0.0.113-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07943467c30938de7ab714c8e945e6cd9a92c449b5a2a4c5f6a2a79b85f64b38"},
|
||||
{file = "ruff-0.0.113-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:202b1178005c68914a0745bb8d26a5acbd23fb0fc702744cc4669457e869b34a"},
|
||||
{file = "ruff-0.0.113-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3113255ef631531f9076112328d99cafafb2925f883d04293643bdcfb26d8192"},
|
||||
{file = "ruff-0.0.113-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ad3e731e769aff79cd29ec462108617b5dfc159edcb7a3933fa090f48854deb0"},
|
||||
{file = "ruff-0.0.113-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cbe37b36a97241715689e68589348a5e4828a2276cfd0ad12427d1f7192ee192"},
|
||||
{file = "ruff-0.0.113-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:da5cf76b9cbb1968caecb6026ccbcfe3ba78d57c19be16249d753bdb1bc8fc89"},
|
||||
{file = "ruff-0.0.113-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0cd20d03fcc77a7303d91df140d4acb2254f986c0cabf63811e98a96454afead"},
|
||||
{file = "ruff-0.0.113-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1468e622bce824dbc7673d9b223490f7988074ae961f3be454c6ef0820417cde"},
|
||||
{file = "ruff-0.0.113-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:8ff4078731551df7130d582f26ed17842e0b6ee568fd05c0ee79afa19597e059"},
|
||||
{file = "ruff-0.0.113-py3-none-win32.whl", hash = "sha256:aaa547df0b53ba7f2f1daa4500d75cc68ce53516cc82a9e03e9116621bf0913a"},
|
||||
{file = "ruff-0.0.113-py3-none-win_amd64.whl", hash = "sha256:2bd79db47dac89e5043f99aa6c1af338aa5ea5f9c7f99f85e46e4ce45712d9ef"},
|
||||
{file = "ruff-0.0.113.tar.gz", hash = "sha256:10afd46519cdf9ad7eb4cab0ea4c980aeb14b1447aed6bfba591e733b44b300b"},
|
||||
{file = "ruff-0.0.114-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:8398c059ffb7d7513d298cf3a2858a6d40f721d274a2ace5169adf97fbb34549"},
|
||||
{file = "ruff-0.0.114-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:65c9a1cb49ffb22d5a65af525fc3079265d74e0286413758aa18f3c51fd34d02"},
|
||||
{file = "ruff-0.0.114-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22df67525a4fecfe20ed5ff0adbd3cd1a72415956e1acb0a833de37ba84fdc29"},
|
||||
{file = "ruff-0.0.114-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:20e427f7d0229a011eee3bde22ed10a39e1d644b620630c8ed1a61ca86874845"},
|
||||
{file = "ruff-0.0.114-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f209199efcc0d0060bf68c87281557d8a0c8c8ea6de322b8437f4c7ed2894840"},
|
||||
{file = "ruff-0.0.114-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:7532a141300887f4f967ce87f906e1d9638fcb93602ca3e176f5b73a69f7e21d"},
|
||||
{file = "ruff-0.0.114-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c2440f0c0944c16408de59ce46fdd74116cd28ffdcea32dc86152fc02d773dfd"},
|
||||
{file = "ruff-0.0.114-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:34e602bb05cdcce6fe558da86af52fc9477cac815033228a8896cf7b70e255c0"},
|
||||
{file = "ruff-0.0.114-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:632d3b1dc8b486524ecf6ea232d16bade2ac027c6ff21baf80829b3c7da5faa1"},
|
||||
{file = "ruff-0.0.114-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:433876350ea69906be752918970ef3439da16f225ccf68064b78cad1c8dc8a6b"},
|
||||
{file = "ruff-0.0.114-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:5f5a4f09060383f4115a82001e5961d1fc84ac0c4ae4a89f09d5a7ba6b283eae"},
|
||||
{file = "ruff-0.0.114-py3-none-musllinux_1_2_i686.whl", hash = "sha256:3d4fbef47cbb0653d88d8d9e94bc50e62a2fecbd22d095a11ed6bc4335b53021"},
|
||||
{file = "ruff-0.0.114-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:d811feaa871b45ffe35e079fbfbd1975558a488dee7771ce24c9821d8311e2ae"},
|
||||
{file = "ruff-0.0.114-py3-none-win32.whl", hash = "sha256:5861419bed7b7297d5f91a59848f4fcc76a05f01eb24d87748166012c7a7ee05"},
|
||||
{file = "ruff-0.0.114-py3-none-win_amd64.whl", hash = "sha256:6929b84917b47e0adcad3b586753c1abc88ee2234d088ba1b95fd7fbebf2e4e8"},
|
||||
{file = "ruff-0.0.114.tar.gz", hash = "sha256:8706a4cb3eeaba325135b8f29478f1bc3cb8f8a349ed16f0e838c0b4398651a4"},
|
||||
]
|
||||
safety = [
|
||||
{file = "safety-2.3.1-py3-none-any.whl", hash = "sha256:8f098d12b607db2756886280e85c28ece8db1bba4f45fc5f981f4663217bd619"},
|
||||
|
@ -38,6 +38,7 @@ line-length = 120
|
||||
select = ["E", "F", "U", "N", "C", "B"]
|
||||
ignore = ["B008"]
|
||||
# B008 - Do not perform function calls in argument defaults. https://github.com/tiangolo/fastapi/issues/1522
|
||||
# B008 - fixed https://github.com/charliermarsh/ruff/releases/tag/v0.0.115
|
||||
|
||||
# Exclude a variety of commonly ignored directories.
|
||||
exclude = [
|
||||
@ -48,3 +49,8 @@ target-version = "py310"
|
||||
|
||||
[tool.ruff.flake8-quotes]
|
||||
docstring-quotes = "double"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "-v --doctest-modules --doctest-glob=*.md --ignore=alembic"
|
||||
asyncio_mode = "strict"
|
||||
env_files = [".env"]
|
@ -1,6 +0,0 @@
|
||||
[pytest]
|
||||
asyncio_mode=strict
|
||||
python_files = tests.py test_*.py *_tests.py
|
||||
addopts = --cov=.
|
||||
--cov-report html:htmlcov
|
||||
--cov-report term-missing
|
Loading…
x
Reference in New Issue
Block a user