diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..23b7c8a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,14 @@ +name: Lint and Tests + +on: [push, pull_request] + +jobs: + lint: + name: 'Check Linting' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + python-version: 3.11 + - uses: chartboost/ruff-action@v1 + - run: ruff check . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 491bba3..60efe6a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,4 +12,13 @@ repos: hooks: - id: flake8 exclude: "src/tests/" - additional_dependencies: [Flake8-pyproject] \ No newline at end of file + additional_dependencies: [Flake8-pyproject] + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.3.0 + hooks: + # Run the linter. + - id: ruff + args: [ --fix ] + # Run the formatter. + - id: ruff-format \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index a3abf71..7a8e8a5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1388,6 +1388,32 @@ files = [ [package.dependencies] pyasn1 = ">=0.1.3" +[[package]] +name = "ruff" +version = "0.3.0" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.3.0-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7deb528029bacf845bdbb3dbb2927d8ef9b4356a5e731b10eef171e3f0a85944"}, + {file = "ruff-0.3.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:e1e0d4381ca88fb2b73ea0766008e703f33f460295de658f5467f6f229658c19"}, + {file = "ruff-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2f7dbba46e2827dfcb0f0cc55fba8e96ba7c8700e0a866eb8cef7d1d66c25dcb"}, + {file = "ruff-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:23dbb808e2f1d68eeadd5f655485e235c102ac6f12ad31505804edced2a5ae77"}, + {file = "ruff-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3ef655c51f41d5fa879f98e40c90072b567c666a7114fa2d9fe004dffba00932"}, + {file = "ruff-0.3.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:d0d3d7ef3d4f06433d592e5f7d813314a34601e6c5be8481cccb7fa760aa243e"}, + {file = "ruff-0.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b08b356d06a792e49a12074b62222f9d4ea2a11dca9da9f68163b28c71bf1dd4"}, + {file = "ruff-0.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9343690f95710f8cf251bee1013bf43030072b9f8d012fbed6ad702ef70d360a"}, + {file = "ruff-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a1f3ed501a42f60f4dedb7805fa8d4534e78b4e196f536bac926f805f0743d49"}, + {file = "ruff-0.3.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:cc30a9053ff2f1ffb505a585797c23434d5f6c838bacfe206c0e6cf38c921a1e"}, + {file = "ruff-0.3.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:5da894a29ec018a8293d3d17c797e73b374773943e8369cfc50495573d396933"}, + {file = "ruff-0.3.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:755c22536d7f1889be25f2baf6fedd019d0c51d079e8417d4441159f3bcd30c2"}, + {file = "ruff-0.3.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:dd73fe7f4c28d317855da6a7bc4aa29a1500320818dd8f27df95f70a01b8171f"}, + {file = "ruff-0.3.0-py3-none-win32.whl", hash = "sha256:19eacceb4c9406f6c41af806418a26fdb23120dfe53583df76d1401c92b7c14b"}, + {file = "ruff-0.3.0-py3-none-win_amd64.whl", hash = "sha256:128265876c1d703e5f5e5a4543bd8be47c73a9ba223fd3989d4aa87dd06f312f"}, + {file = "ruff-0.3.0-py3-none-win_arm64.whl", hash = "sha256:e3a4a6d46aef0a84b74fcd201a4401ea9a6cd85614f6a9435f2d33dd8cefbf83"}, + {file = "ruff-0.3.0.tar.gz", hash = "sha256:0886184ba2618d815067cf43e005388967b67ab9c80df52b32ec1152ab49f53a"}, +] + [[package]] name = "s3transfer" version = "0.8.2" @@ -1744,4 +1770,4 @@ email = ["email-validator"] [metadata] lock-version = "2.0" python-versions = "3.11.6" -content-hash = "b4af5db14ae22ec081212b910e95c0d64cacc8a931890dec42b02fb31809a7f6" +content-hash = "fb9a0bc6095dc0a74053509846525bc2645c6c5d23ff81a12b3e09331149608e" diff --git a/pyproject.toml b/pyproject.toml index 2ed9fd3..c8afea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ readme = "README.md" [tool.poetry.dependencies] -python = "3.11.6" +python = "3.11.3" fastapi = "^0.103.1" pydantic = {extras = ["email"], version = "^2.3.0"} uvicorn = "^0.23.2" @@ -34,6 +34,7 @@ Pillow = "10.1.0" sentry-sdk = {extras = ["asyncpg", "fastapi"], version = "^1.39.1"} + [tool.poetry.group.dev.dependencies] pytest = "^7.4.2" isort = "^5.12.0" @@ -43,11 +44,21 @@ flake8-pyproject = "^1.2.3" pytest-asyncio = "^0.21.1" pytest-env = "^1.0.1" pytest-mock = "^3.11.1" +ruff = "0.3.0" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +extend-select = ["W", "E", "I"] +preview = true + + [tool.black] line-length = 120 @@ -58,6 +69,7 @@ skip_glob = ["**/migrations/**"] [tool.flake8] max-line-length = 120 +exclude = ["tests"] [tool.pytest.ini_options] filterwarnings = ["ignore::DeprecationWarning"]