diff --git a/.github/workflows/code_quality.yaml b/.github/workflows/code_quality.yaml index 4c9b7fb6983..4fb33dcf0ad 100644 --- a/.github/workflows/code_quality.yaml +++ b/.github/workflows/code_quality.yaml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: "3.11" - name: Install git-secrets in the repository run: git secrets --install - name: Install git-secrets aws register in the repository diff --git a/Pipfile b/Pipfile index 5c98dff1c1b..8477554b343 100644 --- a/Pipfile +++ b/Pipfile @@ -4,41 +4,27 @@ verify_ssl = true name = "pypi" [packages] -redis = "==5.0.8" -alembic = "==1.13.2" +aio-pika = "==9.4.3" +aiofiles = "==24.1.0" +aiohttp = "==3.10.9" +alembic = "==1.13.3" asyncpg = "==0.29.0" +azure-storage-blob = "==12.22.0" +bcrypt = "==4.2.0" boto3 = "==1.26.10" fastapi = "==0.110.3" # The latest version of the fastapi is not taken because of the issue -# with fastapi-mail that requires 0.21 < starlette < 0.22 # starlette version for those deps ==0.21.0 +# with fastapi-mail that requires 0.21 < starlette < 0.22 + fastapi-mail = "==1.2.9" +firebase-admin = "==6.5.0" httpx = "==0.27.2" jinja2 = "==3.1.4" -bcrypt = "==4.2.0" -passlib = { version = "==1.7.4", extras = ["bcrypt"] } -pyOpenSSL = "==24.2.1" -pydantic = { extras = ["email"], version = "==1.10.18" } -python-jose = { version = "==3.3.0", extras = ["cryptography"] } -python-multipart = "==0.0.9" -sentry-sdk = "~=2.13" -sqlalchemy = { extras = ["asyncio"], version = "==1.4.53" } -uvicorn = { extras = ["standard"], version = "==0.30.6" } -taskiq = { extras = ["reload"], version = "==0.11.7" } -aiohttp = "==3.10.5" -firebase-admin = "==6.5.0" -aio-pika = "==9.4.3" -azure-storage-blob = "==12.22.0" -taskiq-fastapi = "==0.3.2" -taskiq-redis = "==1.0.0" -taskiq-aio-pika = "==0.4.1" -sqlalchemy-utils = "==0.41.2" -typer = "==0.12.5" -aiofiles = "==24.1.0" +nh3 = "==0.2.18" opentelemetry-api = "==1.27.0" -opentelemetry-sdk = "==1.27.0" -opentelemetry-exporter-otlp = "==1.27.0" opentelemetry-distro = "==0.48b0" +opentelemetry-exporter-otlp = "==1.27.0" opentelemetry-instrumentation = "==0.48b0" opentelemetry-instrumentation-asgi = "==0.48b0" opentelemetry-instrumentation-asyncio = "==0.48b0" @@ -49,51 +35,57 @@ opentelemetry-instrumentation-sqlite3 = "==0.48b0" opentelemetry-instrumentation-tortoiseorm = "==0.48b0" opentelemetry-instrumentation-urllib = "==0.48b0" opentelemetry-instrumentation-wsgi = "==0.48b0" +opentelemetry-propagator-aws-xray = "==1.0.2" +opentelemetry-sdk = "==1.27.0" +opentelemetry-sdk-extension-aws = "==2.0.2" opentelemetry-semantic-conventions = "==0.48b0" opentelemetry-test-utils = "==0.48b0" opentelemetry-util-http = "==0.48b0" -opentelemetry-propagator-aws-xray = "==1.0.2" -opentelemetry-sdk-extension-aws = "==2.0.2" -nh3 = "==0.2.18" +pyOpenSSL = "==24.2.1" +pydantic = { extras = ["email"], version = "==1.10.18" } pymongo = "*" +python-multipart = "==0.0.12" +redis = "==5.1.0" +sentry-sdk = "~=2.13" +sqlalchemy = { extras = ["asyncio"], version = "==1.4.53" } +sqlalchemy-utils = "==0.41.2" +taskiq = { extras = ["reload"], version = "==0.11.7" } +taskiq-aio-pika = "==0.4.1" +taskiq-fastapi = "==0.3.2" +taskiq-redis = "==1.0.2" +typer = "==0.12.5" +uvicorn = { extras = ["standard"], version = "==0.30.6" } +pyjwt = "==2.9.0" [dev-packages] -# Nobody knows for what its needed ipdb = "==0.13.13" pudb = "==2024.1.2" -# Linters and Formatters pre-commit = "==3.8.0" -ruff = "==0.6.4" -# Tests +ruff = "==0.6.8" allure-pytest = "==2.13.5" pydantic-factories = "==1.17.3" pytest = "==8.3.3" pytest-asyncio = "~=0.19" pytest-cov = "==5.0.0" -pytest-env = "==1.1.4" +pytest-env = "==1.1.5" pytest-lazy-fixtures = "==1.1.1" pytest-mock = "==3.14.0" nest-asyncio = "==1.6.0" gevent = "==24.2.1" -# MyPy mypy = "==1.11.2" -types-passlib = "==1.7.7.20240819" types-python-dateutil = "==2.9.0.20240906" -types-python-jose = "==3.3.4.20240106" typing-extensions = "==4.12.2" -types-requests = "==2.32.0.20240712" -types-pytz = "==2024.1.0.20240417" +types-requests = "==2.32.0.20240914" +types-pytz = "==2024.2.0.20240913" types-aiofiles = "==24.1.0.20240626" types-cachetools = "==5.5.0.20240820" -# https://github.com/sqlalchemy/sqlalchemy/issues/7714 greenlet = "==3.1.0" -# JSONLD deps only for dev reproschema = "*" cachetools = "==5.3.0" pyld = "==2.0.4" [requires] -python_version = "3.10" +python_version = "3.11" [scripts] cli = "python src/cli.py" diff --git a/Pipfile.lock b/Pipfile.lock index 66c5726364e..4ef0375f549 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,11 +1,11 @@ { "_meta": { "hash": { - "sha256": "71c257124ef612ad083bfcfbc540232dd5733ef3896e065d3b5a983469e77993" + "sha256": "07fba85afd88883cc30ca1036d869fc0f7d4e710011fd755224b42b5c4b0cef4" }, "pipfile-spec": 6, "requires": { - "python_version": "3.10" + "python_version": "3.11" }, "sources": [ { @@ -44,101 +44,101 @@ }, "aiohttp": { "hashes": [ - "sha256:02594361128f780eecc2a29939d9dfc870e17b45178a867bf61a11b2a4367277", - "sha256:03f2645adbe17f274444953bdea69f8327e9d278d961d85657cb0d06864814c1", - "sha256:074d1bff0163e107e97bd48cad9f928fa5a3eb4b9d33366137ffce08a63e37fe", - "sha256:0912b8a8fadeb32ff67a3ed44249448c20148397c1ed905d5dac185b4ca547bb", - "sha256:0d277cfb304118079e7044aad0b76685d30ecb86f83a0711fc5fb257ffe832ca", - "sha256:0d93400c18596b7dc4794d48a63fb361b01a0d8eb39f28800dc900c8fbdaca91", - "sha256:123dd5b16b75b2962d0fff566effb7a065e33cd4538c1692fb31c3bda2bfb972", - "sha256:17e997105bd1a260850272bfb50e2a328e029c941c2708170d9d978d5a30ad9a", - "sha256:18a01eba2574fb9edd5f6e5fb25f66e6ce061da5dab5db75e13fe1558142e0a3", - "sha256:1923a5c44061bffd5eebeef58cecf68096e35003907d8201a4d0d6f6e387ccaa", - "sha256:1942244f00baaacaa8155eca94dbd9e8cc7017deb69b75ef67c78e89fdad3c77", - "sha256:1b2c16a919d936ca87a3c5f0e43af12a89a3ce7ccbce59a2d6784caba945b68b", - "sha256:1c19de68896747a2aa6257ae4cf6ef59d73917a36a35ee9d0a6f48cff0f94db8", - "sha256:1e72589da4c90337837fdfe2026ae1952c0f4a6e793adbbfbdd40efed7c63599", - "sha256:22c0a23a3b3138a6bf76fc553789cb1a703836da86b0f306b6f0dc1617398abc", - "sha256:2c634a3207a5445be65536d38c13791904fda0748b9eabf908d3fe86a52941cf", - "sha256:2d21ac12dc943c68135ff858c3a989f2194a709e6e10b4c8977d7fcd67dfd511", - "sha256:2f1f1c75c395991ce9c94d3e4aa96e5c59c8356a15b1c9231e783865e2772699", - "sha256:305be5ff2081fa1d283a76113b8df7a14c10d75602a38d9f012935df20731487", - "sha256:33e6bc4bab477c772a541f76cd91e11ccb6d2efa2b8d7d7883591dfb523e5987", - "sha256:349ef8a73a7c5665cca65c88ab24abe75447e28aa3bc4c93ea5093474dfdf0ff", - "sha256:380f926b51b92d02a34119d072f178d80bbda334d1a7e10fa22d467a66e494db", - "sha256:38172a70005252b6893088c0f5e8a47d173df7cc2b2bd88650957eb84fcf5022", - "sha256:391cc3a9c1527e424c6865e087897e766a917f15dddb360174a70467572ac6ce", - "sha256:3a1c32a19ee6bbde02f1cb189e13a71b321256cc1d431196a9f824050b160d5a", - "sha256:4120d7fefa1e2d8fb6f650b11489710091788de554e2b6f8347c7a20ceb003f5", - "sha256:424ae21498790e12eb759040bbb504e5e280cab64693d14775c54269fd1d2bb7", - "sha256:44b324a6b8376a23e6ba25d368726ee3bc281e6ab306db80b5819999c737d820", - "sha256:4790f0e15f00058f7599dab2b206d3049d7ac464dc2e5eae0e93fa18aee9e7bf", - "sha256:4aff049b5e629ef9b3e9e617fa6e2dfeda1bf87e01bcfecaf3949af9e210105e", - "sha256:4b38b1570242fbab8d86a84128fb5b5234a2f70c2e32f3070143a6d94bc854cf", - "sha256:4d46c7b4173415d8e583045fbc4daa48b40e31b19ce595b8d92cf639396c15d5", - "sha256:4f1c9866ccf48a6df2b06823e6ae80573529f2af3a0992ec4fe75b1a510df8a6", - "sha256:4f7acae3cf1a2a2361ec4c8e787eaaa86a94171d2417aae53c0cca6ca3118ff6", - "sha256:54d9ddea424cd19d3ff6128601a4a4d23d54a421f9b4c0fff740505813739a91", - "sha256:58718e181c56a3c02d25b09d4115eb02aafe1a732ce5714ab70326d9776457c3", - "sha256:5ede29d91a40ba22ac1b922ef510aab871652f6c88ef60b9dcdf773c6d32ad7a", - "sha256:61645818edd40cc6f455b851277a21bf420ce347baa0b86eaa41d51ef58ba23d", - "sha256:66bf9234e08fe561dccd62083bf67400bdbf1c67ba9efdc3dac03650e97c6088", - "sha256:673f988370f5954df96cc31fd99c7312a3af0a97f09e407399f61583f30da9bc", - "sha256:676f94c5480d8eefd97c0c7e3953315e4d8c2b71f3b49539beb2aa676c58272f", - "sha256:6c225286f2b13bab5987425558baa5cbdb2bc925b2998038fa028245ef421e75", - "sha256:7384d0b87d4635ec38db9263e6a3f1eb609e2e06087f0aa7f63b76833737b471", - "sha256:7e2fe37ac654032db1f3499fe56e77190282534810e2a8e833141a021faaab0e", - "sha256:7f2bfc0032a00405d4af2ba27f3c429e851d04fad1e5ceee4080a1c570476697", - "sha256:7f6b639c36734eaa80a6c152a238242bedcee9b953f23bb887e9102976343092", - "sha256:814375093edae5f1cb31e3407997cf3eacefb9010f96df10d64829362ae2df69", - "sha256:8224f98be68a84b19f48e0bdc14224b5a71339aff3a27df69989fa47d01296f3", - "sha256:898715cf566ec2869d5cb4d5fb4be408964704c46c96b4be267442d265390f32", - "sha256:8989f46f3d7ef79585e98fa991e6ded55d2f48ae56d2c9fa5e491a6e4effb589", - "sha256:8ba01ebc6175e1e6b7275c907a3a36be48a2d487549b656aa90c8a910d9f3178", - "sha256:8c5c6fa16412b35999320f5c9690c0f554392dc222c04e559217e0f9ae244b92", - "sha256:8c6a4e5e40156d72a40241a25cc226051c0a8d816610097a8e8f517aeacd59a2", - "sha256:8eaf44ccbc4e35762683078b72bf293f476561d8b68ec8a64f98cf32811c323e", - "sha256:8fb4fc029e135859f533025bc82047334e24b0d489e75513144f25408ecaf058", - "sha256:9093a81e18c45227eebe4c16124ebf3e0d893830c6aca7cc310bfca8fe59d857", - "sha256:94c4381ffba9cc508b37d2e536b418d5ea9cfdc2848b9a7fea6aebad4ec6aac1", - "sha256:94fac7c6e77ccb1ca91e9eb4cb0ac0270b9fb9b289738654120ba8cebb1189c6", - "sha256:95c4dc6f61d610bc0ee1edc6f29d993f10febfe5b76bb470b486d90bbece6b22", - "sha256:975218eee0e6d24eb336d0328c768ebc5d617609affaca5dbbd6dd1984f16ed0", - "sha256:ad146dae5977c4dd435eb31373b3fe9b0b1bf26858c6fc452bf6af394067e10b", - "sha256:afe16a84498441d05e9189a15900640a2d2b5e76cf4efe8cbb088ab4f112ee57", - "sha256:b1c43eb1ab7cbf411b8e387dc169acb31f0ca0d8c09ba63f9eac67829585b44f", - "sha256:b90078989ef3fc45cf9221d3859acd1108af7560c52397ff4ace8ad7052a132e", - "sha256:b98e698dc34966e5976e10bbca6d26d6724e6bdea853c7c10162a3235aba6e16", - "sha256:ba5a8b74c2a8af7d862399cdedce1533642fa727def0b8c3e3e02fcb52dca1b1", - "sha256:c31ad0c0c507894e3eaa843415841995bf8de4d6b2d24c6e33099f4bc9fc0d4f", - "sha256:c3b9162bab7e42f21243effc822652dc5bb5e8ff42a4eb62fe7782bcbcdfacf6", - "sha256:c58c6837a2c2a7cf3133983e64173aec11f9c2cd8e87ec2fdc16ce727bcf1a04", - "sha256:c83f7a107abb89a227d6c454c613e7606c12a42b9a4ca9c5d7dad25d47c776ae", - "sha256:cde98f323d6bf161041e7627a5fd763f9fd829bcfcd089804a5fdce7bb6e1b7d", - "sha256:ce91db90dbf37bb6fa0997f26574107e1b9d5ff939315247b7e615baa8ec313b", - "sha256:d00f3c5e0d764a5c9aa5a62d99728c56d455310bcc288a79cab10157b3af426f", - "sha256:d17920f18e6ee090bdd3d0bfffd769d9f2cb4c8ffde3eb203777a3895c128862", - "sha256:d55f011da0a843c3d3df2c2cf4e537b8070a419f891c930245f05d329c4b0689", - "sha256:d742c36ed44f2798c8d3f4bc511f479b9ceef2b93f348671184139e7d708042c", - "sha256:d9a487ef090aea982d748b1b0d74fe7c3950b109df967630a20584f9a99c0683", - "sha256:d9ef084e3dc690ad50137cc05831c52b6ca428096e6deb3c43e95827f531d5ef", - "sha256:da452c2c322e9ce0cfef392e469a26d63d42860f829026a63374fde6b5c5876f", - "sha256:dc4826823121783dccc0871e3f405417ac116055bf184ac04c36f98b75aacd12", - "sha256:de7a5299827253023c55ea549444e058c0eb496931fa05d693b95140a947cb73", - "sha256:e04a1f2a65ad2f93aa20f9ff9f1b672bf912413e5547f60749fa2ef8a644e061", - "sha256:e1ca1ef5ba129718a8fc827b0867f6aa4e893c56eb00003b7367f8a733a9b072", - "sha256:ee40b40aa753d844162dcc80d0fe256b87cba48ca0054f64e68000453caead11", - "sha256:f071854b47d39591ce9a17981c46790acb30518e2f83dfca8db2dfa091178691", - "sha256:f29930bc2921cef955ba39a3ff87d2c4398a0394ae217f41cb02d5c26c8b1b77", - "sha256:f489a2c9e6455d87eabf907ac0b7d230a9786be43fbe884ad184ddf9e9c1e385", - "sha256:f5bf3ead3cb66ab990ee2561373b009db5bc0e857549b6c9ba84b20bc462e172", - "sha256:f6f18898ace4bcd2d41a122916475344a87f1dfdec626ecde9ee802a711bc569", - "sha256:f8112fb501b1e0567a1251a2fd0747baae60a4ab325a871e975b7bb67e59221f", - "sha256:fd31f176429cecbc1ba499d4aba31aaccfea488f418d60376b911269d3b883c5" - ], - "index": "pypi", - "markers": "python_version >= '3.8'", - "version": "==3.10.5" + "sha256:02d1d6610588bcd743fae827bd6f2e47e0d09b346f230824b4c6fb85c6065f9c", + "sha256:03690541e4cc866eef79626cfa1ef4dd729c5c1408600c8cb9e12e1137eed6ab", + "sha256:0bc059ecbce835630e635879f5f480a742e130d9821fbe3d2f76610a6698ee25", + "sha256:0c21c82df33b264216abffff9f8370f303dab65d8eee3767efbbd2734363f677", + "sha256:1298b854fd31d0567cbb916091be9d3278168064fca88e70b8468875ef9ff7e7", + "sha256:1321658f12b6caffafdc35cfba6c882cb014af86bef4e78c125e7e794dfb927b", + "sha256:143b0026a9dab07a05ad2dd9e46aa859bffdd6348ddc5967b42161168c24f857", + "sha256:16e6a51d8bc96b77f04a6764b4ad03eeef43baa32014fce71e882bd71302c7e4", + "sha256:172ad884bb61ad31ed7beed8be776eb17e7fb423f1c1be836d5cb357a096bf12", + "sha256:17c272cfe7b07a5bb0c6ad3f234e0c336fb53f3bf17840f66bd77b5815ab3d16", + "sha256:1a0ee6c0d590c917f1b9629371fce5f3d3f22c317aa96fbdcce3260754d7ea21", + "sha256:2746d8994ebca1bdc55a1e998feff4e94222da709623bb18f6e5cfec8ec01baf", + "sha256:2914caa46054f3b5ff910468d686742ff8cff54b8a67319d75f5d5945fd0a13d", + "sha256:2bbf94d4a0447705b7775417ca8bb8086cc5482023a6e17cdc8f96d0b1b5aba6", + "sha256:2bd9f3eac515c16c4360a6a00c38119333901b8590fe93c3257a9b536026594d", + "sha256:2c33fa6e10bb7ed262e3ff03cc69d52869514f16558db0626a7c5c61dde3c29f", + "sha256:2d37f4718002863b82c6f391c8efd4d3a817da37030a29e2682a94d2716209de", + "sha256:3668d0c2a4d23fb136a753eba42caa2c0abbd3d9c5c87ee150a716a16c6deec1", + "sha256:36d4fba838be5f083f5490ddd281813b44d69685db910907636bc5dca6322316", + "sha256:40ff5b7660f903dc587ed36ef08a88d46840182d9d4b5694e7607877ced698a1", + "sha256:42775de0ca04f90c10c5c46291535ec08e9bcc4756f1b48f02a0657febe89b10", + "sha256:482c85cf3d429844396d939b22bc2a03849cb9ad33344689ad1c85697bcba33a", + "sha256:4e6cb75f8ddd9c2132d00bc03c9716add57f4beff1263463724f6398b813e7eb", + "sha256:4edc3fd701e2b9a0d605a7b23d3de4ad23137d23fc0dbab726aa71d92f11aaaf", + "sha256:4fd16b30567c5b8e167923be6e027eeae0f20cf2b8a26b98a25115f28ad48ee0", + "sha256:5002a02c17fcfd796d20bac719981d2fca9c006aac0797eb8f430a58e9d12431", + "sha256:51d0a4901b27272ae54e42067bc4b9a90e619a690b4dc43ea5950eb3070afc32", + "sha256:558b3d223fd631ad134d89adea876e7fdb4c93c849ef195049c063ada82b7d08", + "sha256:5c070430fda1a550a1c3a4c2d7281d3b8cfc0c6715f616e40e3332201a253067", + "sha256:5f392ef50e22c31fa49b5a46af7f983fa3f118f3eccb8522063bee8bfa6755f8", + "sha256:60555211a006d26e1a389222e3fab8cd379f28e0fbf7472ee55b16c6c529e3a6", + "sha256:608cecd8d58d285bfd52dbca5b6251ca8d6ea567022c8a0eaae03c2589cd9af9", + "sha256:60ad5b8a7452c0f5645c73d4dad7490afd6119d453d302cd5b72b678a85d6044", + "sha256:63649309da83277f06a15bbdc2a54fbe75efb92caa2c25bb57ca37762789c746", + "sha256:6ebdc3b3714afe1b134b3bbeb5f745eed3ecbcff92ab25d80e4ef299e83a5465", + "sha256:6f3c6648aa123bcd73d6f26607d59967b607b0da8ffcc27d418a4b59f4c98c7c", + "sha256:7003f33f5f7da1eb02f0446b0f8d2ccf57d253ca6c2e7a5732d25889da82b517", + "sha256:776e9f3c9b377fcf097c4a04b241b15691e6662d850168642ff976780609303c", + "sha256:85711eec2d875cd88c7eb40e734c4ca6d9ae477d6f26bd2b5bb4f7f60e41b156", + "sha256:87d1e4185c5d7187684d41ebb50c9aeaaaa06ca1875f4c57593071b0409d2444", + "sha256:8a3f063b41cc06e8d0b3fcbbfc9c05b7420f41287e0cd4f75ce0a1f3d80729e6", + "sha256:8b3fb28a9ac8f2558760d8e637dbf27aef1e8b7f1d221e8669a1074d1a266bb2", + "sha256:8bd9125dd0cc8ebd84bff2be64b10fdba7dc6fd7be431b5eaf67723557de3a31", + "sha256:8be1a65487bdfc285bd5e9baf3208c2132ca92a9b4020e9f27df1b16fab998a9", + "sha256:8cc0d13b4e3b1362d424ce3f4e8c79e1f7247a00d792823ffd640878abf28e56", + "sha256:8d9d10d10ec27c0d46ddaecc3c5598c4db9ce4e6398ca872cdde0525765caa2f", + "sha256:8debb45545ad95b58cc16c3c1cc19ad82cffcb106db12b437885dbee265f0ab5", + "sha256:91aa966858593f64c8a65cdefa3d6dc8fe3c2768b159da84c1ddbbb2c01ab4ef", + "sha256:9331dd34145ff105177855017920dde140b447049cd62bb589de320fd6ddd582", + "sha256:99f9678bf0e2b1b695e8028fedac24ab6770937932eda695815d5a6618c37e04", + "sha256:9fdf5c839bf95fc67be5794c780419edb0dbef776edcfc6c2e5e2ffd5ee755fa", + "sha256:a14e4b672c257a6b94fe934ee62666bacbc8e45b7876f9dd9502d0f0fe69db16", + "sha256:a19caae0d670771ea7854ca30df76f676eb47e0fd9b2ee4392d44708f272122d", + "sha256:a35ed3d03910785f7d9d6f5381f0c24002b2b888b298e6f941b2fc94c5055fcd", + "sha256:a61df62966ce6507aafab24e124e0c3a1cfbe23c59732987fc0fd0d71daa0b88", + "sha256:a6e00c8a92e7663ed2be6fcc08a2997ff06ce73c8080cd0df10cc0321a3168d7", + "sha256:ac3196952c673822ebed8871cf8802e17254fff2a2ed4835d9c045d9b88c5ec7", + "sha256:ac74e794e3aee92ae8f571bfeaa103a141e409863a100ab63a253b1c53b707eb", + "sha256:ad3675c126f2a95bde637d162f8231cff6bc0bc9fbe31bd78075f9ff7921e322", + "sha256:aeebd3061f6f1747c011e1d0b0b5f04f9f54ad1a2ca183e687e7277bef2e0da2", + "sha256:ba1a599255ad6a41022e261e31bc2f6f9355a419575b391f9655c4d9e5df5ff5", + "sha256:bbdb8def5268f3f9cd753a265756f49228a20ed14a480d151df727808b4531dd", + "sha256:c2555e4949c8d8782f18ef20e9d39730d2656e218a6f1a21a4c4c0b56546a02e", + "sha256:c2695c61cf53a5d4345a43d689f37fc0f6d3a2dc520660aec27ec0f06288d1f9", + "sha256:c2b627d3c8982691b06d89d31093cee158c30629fdfebe705a91814d49b554f8", + "sha256:c46131c6112b534b178d4e002abe450a0a29840b61413ac25243f1291613806a", + "sha256:c54dc329cd44f7f7883a9f4baaefe686e8b9662e2c6c184ea15cceee587d8d69", + "sha256:c7d7cafc11d70fdd8801abfc2ff276744ae4cb39d8060b6b542c7e44e5f2cfc2", + "sha256:cb0b2d5d51f96b6cc19e6ab46a7b684be23240426ae951dcdac9639ab111b45e", + "sha256:d15a29424e96fad56dc2f3abed10a89c50c099f97d2416520c7a543e8fddf066", + "sha256:d1f5c9169e26db6a61276008582d945405b8316aae2bb198220466e68114a0f5", + "sha256:d271f770b52e32236d945911b2082f9318e90ff835d45224fa9e28374303f729", + "sha256:d646fdd74c25bbdd4a055414f0fe32896c400f38ffbdfc78c68e62812a9e0257", + "sha256:d6e395c3d1f773cf0651cd3559e25182eb0c03a2777b53b4575d8adc1149c6e9", + "sha256:d7c071235a47d407b0e93aa6262b49422dbe48d7d8566e1158fecc91043dd948", + "sha256:d97273a52d7f89a75b11ec386f786d3da7723d7efae3034b4dda79f6f093edc1", + "sha256:dcf354661f54e6a49193d0b5653a1b011ba856e0b7a76bda2c33e4c6892f34ea", + "sha256:e3e7fabedb3fe06933f47f1538df7b3a8d78e13d7167195f51ca47ee12690373", + "sha256:e525b69ee8a92c146ae5b4da9ecd15e518df4d40003b01b454ad694a27f498b5", + "sha256:e709d6ac598c5416f879bb1bae3fd751366120ac3fa235a01de763537385d036", + "sha256:e83dfefb4f7d285c2d6a07a22268344a97d61579b3e0dce482a5be0251d672ab", + "sha256:e86260b76786c28acf0b5fe31c8dca4c2add95098c709b11e8c35b424ebd4f5b", + "sha256:e883b61b75ca6efc2541fcd52a5c8ccfe288b24d97e20ac08fdf343b8ac672ea", + "sha256:f0a44bb40b6aaa4fb9a5c1ee07880570ecda2065433a96ccff409c9c20c1624a", + "sha256:f82ace0ec57c94aaf5b0e118d4366cff5889097412c75aa14b4fd5fc0c44ee3e", + "sha256:f9ca09414003c0e96a735daa1f071f7d7ed06962ef4fa29ceb6c80d06696d900", + "sha256:fa430b871220dc62572cef9c69b41e0d70fcb9d486a4a207a5de4c1f25d82593", + "sha256:fc262c3df78c8ff6020c782d9ce02e4bcffe4900ad71c0ecdad59943cba54442", + "sha256:fcd546782d03181b0b1d20b43d612429a90a68779659ba8045114b867971ab71", + "sha256:fd4ceeae2fb8cabdd1b71c82bfdd39662473d3433ec95b962200e9e752fb70d0", + "sha256:fec5fac7aea6c060f317f07494961236434928e6f4374e170ef50b3001e14581" + ], + "index": "pypi", + "markers": "python_version >= '3.8'", + "version": "==3.10.9" }, "aiormq": { "hashes": [ @@ -166,12 +166,12 @@ }, "alembic": { "hashes": [ - "sha256:1ff0ae32975f4fd96028c39ed9bb3c867fe3af956bd7bb37343b54c9fe7445ef", - "sha256:6b8733129a6224a9a711e17c99b08462dbf7cc9670ba8f2e2ae9af860ceb1953" + "sha256:203503117415561e203aa14541740643a611f641517f0209fcae63e9fa09f1a2", + "sha256:908e905976d15235fae59c9ac42c4c5b75cfcefe3d27c0fbf7ae15a37715d80e" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==1.13.2" + "version": "==1.13.3" }, "anyio": { "hashes": [ @@ -194,7 +194,7 @@ "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f", "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028" ], - "markers": "python_full_version < '3.11.3'", + "markers": "python_version < '3.12.0'", "version": "==4.0.3" }, "asyncpg": { @@ -594,14 +594,6 @@ "markers": "python_version >= '3.9'", "version": "==2.7.0" }, - "ecdsa": { - "hashes": [ - "sha256:2cea9b88407fdac7bbeca0833b189e4c9c53f2ef1e1eaa29f6224dbc809b707a", - "sha256:60eaad1199659900dd0af521ed462b793bbdf867432b3948e87416ae4caf6bf8" - ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==0.19.0" - }, "email-validator": { "hashes": [ "sha256:49a72f5fa6ed26be1c964f0567d931d10bf3fdeeacdf97bc26ef1cd2a44e0bda", @@ -610,14 +602,6 @@ "markers": "python_version >= '3.5'", "version": "==1.3.1" }, - "exceptiongroup": { - "hashes": [ - "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b", - "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc" - ], - "markers": "python_version < '3.11'", - "version": "==1.2.2" - }, "fastapi": { "hashes": [ "sha256:555700b0159379e94fdbfc6bb66a0f1c43f4cf7060f25239af3d84b63a656626", @@ -1609,16 +1593,6 @@ "markers": "python_version >= '3.7'", "version": "==3.3.0" }, - "passlib": { - "extras": [ - "bcrypt" - ], - "hashes": [ - "sha256:aa6bca462b8d8bda89c70b382f0c298a20b5560af6cbfa2dce410c0a2fb669f1", - "sha256:defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04" - ], - "version": "==1.7.4" - }, "propcache": { "hashes": [ "sha256:00181262b17e517df2cd85656fcd6b4e70946fe62cd625b9d74ac9977b64d8d9", @@ -1848,6 +1822,7 @@ "sha256:3b02fb0f44517787776cf48f2ae25d8e14f300e6d7545a4315cee571a415e850", "sha256:7e1e5b56cc735432a7369cbfa0efe50fa113ebecdc04ae6922deba8b84582d0c" ], + "index": "pypi", "markers": "python_version >= '3.8'", "version": "==2.9.0" }, @@ -1949,24 +1924,14 @@ ], "version": "==1.0.1" }, - "python-jose": { - "extras": [ - "cryptography" - ], - "hashes": [ - "sha256:55779b5e6ad599c6336191246e95eb2293a9ddebd555f796a65f838f07e5d78a", - "sha256:9b1376b023f8b298536eedd47ae1089bcdb848f1535ab30555cd92002d78923a" - ], - "version": "==3.3.0" - }, "python-multipart": { "hashes": [ - "sha256:03f54688c663f1b7977105f021043b0793151e4cb1c1a9d4a11fc13d622c4026", - "sha256:97ca7b8ea7b05f977dc3849c3ba99d51689822fab725c3703af7c866a0c2b215" + "sha256:045e1f98d719c1ce085ed7f7e1ef9d8ccc8c02ba02b5566d5f7521410ced58cb", + "sha256:43dcf96cf65888a9cd3423544dd0d75ac10f7aa0c3c28a175bbcd00c9ce1aebf" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==0.0.9" + "version": "==0.0.12" }, "pytz": { "hashes": [ @@ -2035,12 +2000,12 @@ }, "redis": { "hashes": [ - "sha256:0c5b10d387568dfe0698c6fad6615750c24170e548ca2deac10c649d463e9870", - "sha256:56134ee08ea909106090934adc36f65c9bcbbaecea5b21ba704ba6fb561f8eb4" + "sha256:b756df1e4a3858fcc0ef861f3fc53623a96c41e2b1f5304e09e0fe758d333d40", + "sha256:fd4fccba0d7f6aa48c58a78d76ddb4afc698f5da4a2c1d03d916e4fd7ab88cdd" ], "index": "pypi", - "markers": "python_version >= '3.7'", - "version": "==5.0.8" + "markers": "python_version >= '3.8'", + "version": "==5.1.0" }, "requests": { "hashes": [ @@ -2224,12 +2189,12 @@ }, "taskiq-redis": { "hashes": [ - "sha256:45b2ac312a61725b4a5bdc5595f160d83986eac21eb5bc080ede5e6272d87d61", - "sha256:867949594e63402bdb8378fcc9f1e4e1a18360cb7d3da30fe06d8c33cb74822f" + "sha256:9a8e8b8e26847e25fbe6e6f8f910632a66f3d38bb5249699193efcfd1e84e25f", + "sha256:d24c4ba34560eb882af351ec34eab4fc90ff6b82ef9b3245d0a499d335b92086" ], "index": "pypi", "markers": "python_full_version >= '3.8.1' and python_full_version < '4.0.0'", - "version": "==1.0.0" + "version": "==1.0.2" }, "typer": { "extras": [ @@ -2988,7 +2953,7 @@ "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330", "sha256:b8c3f85900b9dc423225913c5aace94729fe1fa9763b38939a95226f02d37186" ], - "markers": "python_version > '3.6' and python_version < '3.11'", + "markers": "python_version >= '3.11'", "version": "==5.1.1" }, "distlib": { @@ -3005,14 +2970,6 @@ "markers": "python_version >= '3.7'", "version": "==0.3.1" }, - "exceptiongroup": { - "hashes": [ - "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b", - "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc" - ], - "markers": "python_version < '3.11'", - "version": "==1.2.2" - }, "executing": { "hashes": [ "sha256:8d63781349375b5ebccc3142f4b30350c0cd9c79f921cde38be2be4637e98eaf", @@ -3023,11 +2980,11 @@ }, "faker": { "hashes": [ - "sha256:8760fbb34564fbb2f394345eef24aec5b8f6506b6cfcefe8195ed66dd1032bdb", - "sha256:e8a15fd1b0f72992b008f5ea94c70d3baa0cb51b0d5a0e899c17b1d1b23d2771" + "sha256:6fd328db7195e70cdee479ee687fef6623c9b57b8023c582adbe88a01dc54297", + "sha256:b6c2d61861dcf1084b8e10959418fe3380a1a3dcd2796a73d43f738a42aabb4c" ], "markers": "python_version >= '3.8'", - "version": "==30.3.0" + "version": "==30.4.0" }, "filelock": { "hashes": [ @@ -3261,7 +3218,7 @@ "sha256:0d0d15ca1e01faeb868ef56bc7ee5a0de5bd66885735682e8a322ae289a13d1a", "sha256:530ef1e7bb693724d3cdc37287c80b07ad9b25986c007a53aa1857272dac3f35" ], - "markers": "python_version > '3.6' and python_version < '3.11'", + "markers": "python_version >= '3.11'", "version": "==8.28.0" }, "isodate": { @@ -3708,12 +3665,12 @@ }, "pytest-env": { "hashes": [ - "sha256:86653658da8f11c6844975db955746c458a9c09f1e64957603161e2ff93f5133", - "sha256:a4212056d4d440febef311a98fdca56c31256d58fb453d103cba4e8a532b721d" + "sha256:91209840aa0e43385073ac464a554ad2947cc2fd663a9debf88d03b01e0cc1cf", + "sha256:ce90cf8772878515c24b31cd97c7fa1f4481cd68d588419fd45f10ecaee6bc30" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==1.1.4" + "version": "==1.1.5" }, "pytest-lazy-fixtures": { "hashes": [ @@ -3836,28 +3793,28 @@ }, "ruff": { "hashes": [ - "sha256:0308610470fcc82969082fc83c76c0d362f562e2f0cdab0586516f03a4e06ec6", - "sha256:0b52387d3289ccd227b62102c24714ed75fbba0b16ecc69a923a37e3b5e0aaaa", - "sha256:0ea086601b22dc5e7693a78f3fcfc460cceabfdf3bdc36dc898792aba48fbad6", - "sha256:34d5efad480193c046c86608dbba2bccdc1c5fd11950fb271f8086e0c763a5d1", - "sha256:50e30b437cebef547bd5c3edf9ce81343e5dd7c737cb36ccb4fe83573f3d392e", - "sha256:549daccee5227282289390b0222d0fbee0275d1db6d514550d65420053021a58", - "sha256:66dbfea86b663baab8fcae56c59f190caba9398df1488164e2df53e216248baa", - "sha256:7862f42fc1a4aca1ea3ffe8a11f67819d183a5693b228f0bb3a531f5e40336fc", - "sha256:803b96dea21795a6c9d5bfa9e96127cc9c31a1987802ca68f35e5c95aed3fc0d", - "sha256:932063a03bac394866683e15710c25b8690ccdca1cf192b9a98260332ca93408", - "sha256:ac3b5bfbee99973f80aa1b7cbd1c9cbce200883bdd067300c22a6cc1c7fba212", - "sha256:ac4b75e898ed189b3708c9ab3fc70b79a433219e1e87193b4f2b77251d058d14", - "sha256:bedff9e4f004dad5f7f76a9d39c4ca98af526c9b1695068198b3bda8c085ef60", - "sha256:c44536df7b93a587de690e124b89bd47306fddd59398a0fb12afd6133c7b3818", - "sha256:c4b153fc152af51855458e79e835fb6b933032921756cec9af7d0ba2aa01a258", - "sha256:d02a4127a86de23002e694d7ff19f905c51e338c72d8e09b56bfb60e1681724f", - "sha256:eebe4ff1967c838a1a9618a5a59a3b0a00406f8d7eefee97c70411fefc353617", - "sha256:f0f8968feea5ce3777c0d8365653d5e91c40c31a81d95824ba61d871a11b8523" + "sha256:007dee844738c3d2e6c24ab5bc7d43c99ba3e1943bd2d95d598582e9c1b27750", + "sha256:1085c455d1b3fdb8021ad534379c60353b81ba079712bce7a900e834859182fa", + "sha256:27b87e1801e786cd6ede4ada3faa5e254ce774de835e6723fd94551464c56b8c", + "sha256:5fd0d4b7b1457c49e435ee1e437900ced9b35cb8dc5178921dfb7d98d65a08d0", + "sha256:677e03c00f37c66cea033274295a983c7c546edea5043d0c798833adf4cf4c6f", + "sha256:6cfb227b932ba8ef6e56c9f875d987973cd5e35bc5d05f5abf045af78ad8e098", + "sha256:6ef0411eccfc3909269fed47c61ffebdcb84a04504bafa6b6df9b85c27e813b0", + "sha256:6f5a2f17c7d32991169195d52a04c95b256378bbf0de8cb98478351eb70d526f", + "sha256:70edf6a93b19481affd287d696d9e311388d808671bc209fb8907b46a8c3af44", + "sha256:77944bca110ff0a43b768f05a529fecd0706aac7bcce36d7f1eeb4cbfca5f0f2", + "sha256:792213f7be25316f9b46b854df80a77e0da87ec66691e8f012f887b4a671ab5a", + "sha256:8d3bb2e3fbb9875172119021a13eed38849e762499e3cfde9588e4b4d70968dc", + "sha256:9f1476236b3eacfacfc0f66aa9e6cd39f2a624cb73ea99189556015f27c0bdeb", + "sha256:a5bf44b1aa0adaf6d9d20f86162b34f7c593bfedabc51239953e446aefc8ce18", + "sha256:cd48f945da2a6334f1793d7f701725a76ba93bf3d73c36f6b21fb04d5338dcf5", + "sha256:ce60058d3cdd8490e5e5471ef086b3f1e90ab872b548814e35930e21d848c9ce", + "sha256:ec0517dc0f37cad14a5319ba7bba6e7e339d03fbf967a6d69b0907d61be7a263", + "sha256:f8034b19b993e9601f2ddf2c517451e17a6ab5cdb1c13fdff50c1442a7171d87" ], "index": "pypi", "markers": "python_version >= '3.7'", - "version": "==0.6.4" + "version": "==0.6.8" }, "setuptools": { "hashes": [ @@ -3882,14 +3839,6 @@ ], "version": "==0.6.3" }, - "tomli": { - "hashes": [ - "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38", - "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed" - ], - "markers": "python_version < '3.11'", - "version": "==2.0.2" - }, "traitlets": { "hashes": [ "sha256:9ed0579d3502c94b4b3732ac120375cda96f923114522847de4b3bb98b96b6b7", @@ -3916,23 +3865,6 @@ "markers": "python_version >= '3.8'", "version": "==5.5.0.20240820" }, - "types-passlib": { - "hashes": [ - "sha256:8fc8df71623845032293d5cf7f8091f0adfeba02d387a2888684b8413f14b3d0", - "sha256:c4d299083497b66e12258c7b77c08952574213fdf7009da3135d8181a6a25f23" - ], - "index": "pypi", - "markers": "python_version >= '3.8'", - "version": "==1.7.7.20240819" - }, - "types-pyasn1": { - "hashes": [ - "sha256:95f3cb1fbd63ff91cd0410945f8aeae6b0be359533c00f39d8e17124884157af", - "sha256:a1da054db13d3d4ccfa69c515678154014336ad3d9f9ade01845f9edb1a2bc71" - ], - "markers": "python_version >= '3.8'", - "version": "==0.6.0.20240913" - }, "types-python-dateutil": { "hashes": [ "sha256:27c8cc2d058ccb14946eebcaaa503088f4f6dbc4fb6093d3d456a49aef2753f6", @@ -3942,32 +3874,23 @@ "markers": "python_version >= '3.8'", "version": "==2.9.0.20240906" }, - "types-python-jose": { - "hashes": [ - "sha256:b18cf8c5080bbfe1ef7c3b707986435d9efca3e90889acb6a06f65e06bc3405a", - "sha256:b515a6c0c61f5e2a53bc93e3a2b024cbd42563e2e19cbde9fd1c2cc2cfe77ccc" - ], - "index": "pypi", - "markers": "python_version >= '3.8'", - "version": "==3.3.4.20240106" - }, "types-pytz": { "hashes": [ - "sha256:6810c8a1f68f21fdf0f4f374a432487c77645a0ac0b31de4bf4690cf21ad3981", - "sha256:8335d443310e2db7b74e007414e74c4f53b67452c0cb0d228ca359ccfba59659" + "sha256:4433b5df4a6fc587bbed41716d86a5ba5d832b4378e506f40d34bc9c81df2c24", + "sha256:a1eebf57ebc6e127a99d2fa2ba0a88d2b173784ef9b3defcc2004ab6855a44df" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==2024.1.0.20240417" + "version": "==2024.2.0.20240913" }, "types-requests": { "hashes": [ - "sha256:90c079ff05e549f6bf50e02e910210b98b8ff1ebdd18e19c873cd237737c1358", - "sha256:f754283e152c752e46e70942fa2a146b5bc70393522257bb85bd1ef7e019dcc3" + "sha256:2850e178db3919d9bf809e434eef65ba49d0e7e33ac92d588f4a5e295fffd405", + "sha256:59c2f673eb55f32a99b2894faf6020e1a9f4a402ad0f192bfee0b64469054310" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==2.32.0.20240712" + "version": "==2.32.0.20240914" }, "typing-extensions": { "hashes": [ diff --git a/README.md b/README.md index e7a73cf36b0..2096d053558 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ See MindLogger's [Knowledge Base article](https://mindlogger.atlassian.net/servi ## Technologies -- ✅ [Python3.10+](https://www.python.org/downloads/release/python-3108/) +- ✅ [Python3.11+](https://www.python.org/downloads/release/python-31110/) - ✅ [Pipenv](https://pipenv.pypa.io/en/latest/) - ✅ [FastAPI](https://fastapi.tiangolo.com) - ✅ [Postgresql](https://www.postgresql.org/docs/14/index.html) @@ -61,7 +61,7 @@ And ### Prerequisites -- Python 3.10 +- Python 3.11 - [Docker](https://docs.docker.com/get-docker/) #### Recommended Extras @@ -71,7 +71,7 @@ Installing [pyenv](https://github.com/pyenv/pyenv) is recommended to automatical Alternatively, on macOS you can use a tool like [Homebrew](https://brew.sh/) to install multiple versions and specify when creating the virtual environment: ```bash -pipenv --python /opt/homebrew/bin/python3.10 +pipenv --python /opt/homebrew/bin/python3.11 ``` ### Environment Variables @@ -189,14 +189,15 @@ Create your virtual environment: pipenv shell ``` -If `pyenv` is installed Python 3.10 should automatically be installed in the virtual environment, you can check the correct version of Python is active by running: +If `pyenv` is installed Python 3.11 should automatically be installed in the virtual environment, you can check the +correct version of Python is active by running: ```bash python --version ``` -If the active version is **not** 3.10, you can manually specify a version while creating your virtual environment: +If the active version is **not** 3.11, you can manually specify a version while creating your virtual environment: ```bash -pipenv --python /opt/homebrew/bin/python3.10 +pipenv --python /opt/homebrew/bin/python3.11 ``` Install all dependencies diff --git a/compose/fastapi/Dockerfile b/compose/fastapi/Dockerfile index 5d4aae974ff..bb6fd504ebd 100644 --- a/compose/fastapi/Dockerfile +++ b/compose/fastapi/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim-bookworm AS base +FROM python:3.11-slim-bookworm AS base ENV PYTHONUNBUFFERED=1 ENV PYTHONPATH="src/" @@ -6,7 +6,7 @@ ENV PYTHONPATH="src/" WORKDIR /app/ RUN apt-get -y update && apt-get -y upgrade \ - && apt-get install --no-install-recommends -y build-essential=12.9 curl=7.88* libffi-dev \ + && apt-get install --no-install-recommends -y build-essential curl libffi-dev \ && rm -rf /var/lib/apt/lists/ # Add local non-root user to avoid issue with files @@ -67,8 +67,8 @@ FROM base AS worker USER root RUN apt-get update -y && apt-get install -y --no-install-recommends \ - ffmpeg=7:5.1* \ - imagemagick=8:6.9* \ + ffmpeg \ + imagemagick \ && rm -rf /var/lib/apt/lists/ USER code diff --git a/pyproject.toml b/pyproject.toml index 1b4b90b3bac..3c4d0280256 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ omit = [ [tool.mypy] plugins = ["pydantic.mypy"] ignore_missing_imports = true -python_version = '3.10' +python_version = '3.11' mypy_path = 'src' files = ['*.py'] warn_redundant_casts = true diff --git a/src/apps/activities/domain/conditional_logic.py b/src/apps/activities/domain/conditional_logic.py index 2bbe4fb3073..fb8baccb26d 100644 --- a/src/apps/activities/domain/conditional_logic.py +++ b/src/apps/activities/domain/conditional_logic.py @@ -1,4 +1,4 @@ -from enum import Enum +from enum import StrEnum from pydantic import Field @@ -6,7 +6,7 @@ from apps.shared.domain import PublicModel -class Match(str, Enum): +class Match(StrEnum): ANY = "any" ALL = "all" diff --git a/src/apps/activities/domain/conditions.py b/src/apps/activities/domain/conditions.py index 98c35cbb81d..c652d099166 100644 --- a/src/apps/activities/domain/conditions.py +++ b/src/apps/activities/domain/conditions.py @@ -1,5 +1,5 @@ import datetime -from enum import Enum +from enum import StrEnum from typing import Any, Dict, Optional from pydantic import Field, root_validator, validator @@ -7,7 +7,7 @@ from apps.shared.domain import PublicModel, PublicModelNoExtra -class ConditionType(str, Enum): +class ConditionType(StrEnum): INCLUDES_OPTION = "INCLUDES_OPTION" NOT_INCLUDES_OPTION = "NOT_INCLUDES_OPTION" EQUAL_TO_OPTION = "EQUAL_TO_OPTION" @@ -21,7 +21,7 @@ class ConditionType(str, Enum): EQUAL_TO_SCORE = "EQUAL_TO_SCORE" -class DateConditionType(str, Enum): +class DateConditionType(StrEnum): GREATER_THAN_DATE = "GREATER_THAN_DATE" LESS_THAN_DATE = "LESS_THAN_DATE" EQUAL_TO_DATE = "EQUAL_TO_DATE" @@ -30,7 +30,7 @@ class DateConditionType(str, Enum): OUTSIDE_OF_DATES = "OUTSIDE_OF_DATES" -class TimeRangeConditionType(str, Enum): +class TimeRangeConditionType(StrEnum): GREATER_THAN_TIME_RANGE = "GREATER_THAN_TIME_RANGE" LESS_THAN_TIMES_RANGE = "LESS_THAN_TIME_RANGE" BETWEEN_TIMES_RANGE = "BETWEEN_TIMES_RANGE" @@ -39,7 +39,7 @@ class TimeRangeConditionType(str, Enum): OUTSIDE_OF_TIMES_RANGE = "OUTSIDE_OF_TIMES_RANGE" -class TimeConditionType(str, Enum): +class TimeConditionType(StrEnum): GREATER_THAN_TIME = "GREATER_THAN_TIME" LESS_THAN_TIME = "LESS_THAN_TIME" BETWEEN_TIMES = "BETWEEN_TIMES" @@ -48,27 +48,27 @@ class TimeConditionType(str, Enum): OUTSIDE_OF_TIMES = "OUTSIDE_OF_TIMES" -class MultiSelectConditionType(str, Enum): +class MultiSelectConditionType(StrEnum): INCLUDES_OPTION = "INCLUDES_OPTION" NOT_INCLUDES_OPTION = "NOT_INCLUDES_OPTION" -class MultiSelectionsPerRowConditionType(str, Enum): +class MultiSelectionsPerRowConditionType(StrEnum): INCLUDES_ROW_OPTION = "INCLUDES_ROW_OPTION" NOT_INCLUDES_ROW_OPTION = "NOT_INCLUDES_ROW_OPTION" -class SingleSelectionPerRowConditionType(str, Enum): +class SingleSelectionPerRowConditionType(StrEnum): EQUAL_TO_ROW_OPTION = "EQUAL_TO_ROW_OPTION" NOT_EQUAL_TO_ROW_OPTION = "NOT_EQUAL_TO_ROW_OPTION" -class SingleSelectConditionType(str, Enum): +class SingleSelectConditionType(StrEnum): EQUAL_TO_OPTION = "EQUAL_TO_OPTION" NOT_EQUAL_TO_OPTION = "NOT_EQUAL_TO_OPTION" -class SliderRowConditionType(str, Enum): +class SliderRowConditionType(StrEnum): GREATER_THAN_SLIDER_ROWS = "GREATER_THAN_SLIDER_ROWS" LESS_THAN_SLIDER_ROWS = "LESS_THAN_SLIDER_ROWS" EQUAL_TO_SLIDER_ROWS = "EQUAL_TO_SLIDER_ROWS" @@ -77,7 +77,7 @@ class SliderRowConditionType(str, Enum): OUTSIDE_OF_SLIDER_ROWS = "OUTSIDE_OF_SLIDER_ROWS" -class SliderConditionType(str, Enum): +class SliderConditionType(StrEnum): GREATER_THAN = "GREATER_THAN" LESS_THAN = "LESS_THAN" EQUAL = "EQUAL" @@ -86,7 +86,7 @@ class SliderConditionType(str, Enum): OUTSIDE_OF = "OUTSIDE_OF" -class TimePayloadType(str, Enum): +class TimePayloadType(StrEnum): START_TIME = "startTime" END_TIME = "endTime" diff --git a/src/apps/activities/domain/constants.py b/src/apps/activities/domain/constants.py index 5e1f1041ec6..2946d402f47 100644 --- a/src/apps/activities/domain/constants.py +++ b/src/apps/activities/domain/constants.py @@ -1,8 +1,8 @@ -from enum import Enum - __all__ = ["InputType"] +from enum import StrEnum + -class InputType(str, Enum): +class InputType(StrEnum): RADIOBUTTON = "radiobutton" CHECKBOX = "checkbox" diff --git a/src/apps/activities/domain/response_type_config.py b/src/apps/activities/domain/response_type_config.py index c29e6f15eb7..3348e04f4d2 100644 --- a/src/apps/activities/domain/response_type_config.py +++ b/src/apps/activities/domain/response_type_config.py @@ -1,4 +1,4 @@ -from enum import Enum +from enum import StrEnum from typing import Literal from pydantic import Field, NonNegativeInt, PositiveInt, validator @@ -31,7 +31,7 @@ from apps.shared.domain import PublicModel -class ResponseType(str, Enum): +class ResponseType(StrEnum): TEXT = "text" PARAGRAPHTEXT = "paragraphText" SINGLESELECT = "singleSelect" @@ -268,12 +268,12 @@ class UnityConfig(PublicModel): file: str | None -class InputType(str, Enum): +class InputType(StrEnum): GYROSCOPE = "gyroscope" TOUCH = "touch" -class Phase(str, Enum): +class Phase(StrEnum): PRACTICE = "practice" TEST = "test" @@ -320,12 +320,12 @@ class BlockConfiguration(PublicModel): order: list[StimulusConfigId] -class SamplingMethod(str, Enum): +class SamplingMethod(StrEnum): RANDOMIZE_ORDER = "randomize-order" FIXED_ORDER = "fixed-order" -class BlockType(str, Enum): +class BlockType(StrEnum): TEST = "test" PRACTICE = "practice" @@ -362,14 +362,14 @@ class FlankerConfig(PublicModel): block_type: BlockType -class ABTrailsOrder(str, Enum): +class ABTrailsOrder(StrEnum): FIRST = "first" SECOND = "second" THIRD = "third" FOURTH = "fourth" -class ABTrailsDeviceType(str, Enum): +class ABTrailsDeviceType(StrEnum): TABLET = "tablet" MOBILE = "mobile" @@ -434,7 +434,7 @@ def validate_nodes(cls, value, values) -> ABTrailsNodes | None: return value -class PerformanceTaskType(str, Enum): +class PerformanceTaskType(StrEnum): FLANKER = "flanker" GYROSCOPE = "gyroscope" TOUCH = "touch" diff --git a/src/apps/activities/domain/response_values.py b/src/apps/activities/domain/response_values.py index c4d59824cb0..88ef75e5435 100644 --- a/src/apps/activities/domain/response_values.py +++ b/src/apps/activities/domain/response_values.py @@ -1,4 +1,4 @@ -from enum import Enum +from enum import StrEnum from typing import Literal from pydantic import Field, NonNegativeInt, root_validator, validator @@ -41,13 +41,13 @@ from apps.shared.domain import PublicModel, validate_color, validate_image, validate_uuid -class PhrasalTemplateFieldType(str, Enum): +class PhrasalTemplateFieldType(StrEnum): SENTENCE = "sentence" ITEM_RESPONSE = "item_response" LINE_BREAK = "line_break" -class PhrasalTemplateDisplayMode(str, Enum): +class PhrasalTemplateDisplayMode(StrEnum): BULLET_LIST = "bullet_list" SENTENCE = "sentence" BULLET_LIST_OPTION_ROW = "bullet_list_option_row" diff --git a/src/apps/activities/domain/scores_reports.py b/src/apps/activities/domain/scores_reports.py index ea24fac2fe7..ed278bcd692 100644 --- a/src/apps/activities/domain/scores_reports.py +++ b/src/apps/activities/domain/scores_reports.py @@ -1,5 +1,4 @@ import enum -from enum import Enum from pydantic import Field, PositiveInt, validator @@ -24,7 +23,7 @@ from apps.shared.domain.custom_validations import sanitize_string -class CalculationType(str, Enum): +class CalculationType(enum.StrEnum): SUM = "sum" AVERAGE = "average" PERCENTAGE = "percentage" @@ -46,7 +45,7 @@ def validate_string(cls, value): return value -class ReportType(str, enum.Enum): +class ReportType(enum.StrEnum): score = "score" section = "section" @@ -164,7 +163,7 @@ class ScoreConditionalLogicMobile(PublicModel): conditions: list[ScoreCondition] -class SubscaleCalculationType(str, Enum): +class SubscaleCalculationType(enum.StrEnum): SUM = "sum" AVERAGE = "average" @@ -190,7 +189,7 @@ def validate_age_lookup(cls, value): return validate_age_subscale(value) -class SubscaleItemType(str, Enum): +class SubscaleItemType(enum.StrEnum): ITEM = "item" SUBSCALE = "subscale" diff --git a/src/apps/activities/services/activity_item_change.py b/src/apps/activities/services/activity_item_change.py index 8eaad7e42b5..31ca0e002c3 100644 --- a/src/apps/activities/services/activity_item_change.py +++ b/src/apps/activities/services/activity_item_change.py @@ -23,7 +23,7 @@ RGT = TypeVar("RGT", None, ActivityHistoryFull, ActivityItemHistoryFull) -class ChangeStatusEnum(str, enum.Enum): +class ChangeStatusEnum(enum.StrEnum): ADDED = "added" UPDATED = "updated" REMOVED = "removed" diff --git a/src/apps/authentication/api/auth.py b/src/apps/authentication/api/auth.py index 7582b62ba1a..b220b8e6777 100644 --- a/src/apps/authentication/api/auth.py +++ b/src/apps/authentication/api/auth.py @@ -1,8 +1,8 @@ import uuid from datetime import datetime +import jwt from fastapi import Body, Depends -from jose import JWTError, jwt from pydantic import ValidationError from apps.authentication.deps import get_current_token, get_current_user @@ -82,7 +82,7 @@ async def refresh_access_token( settings.authentication.refresh_token.secret_key, algorithms=[settings.authentication.algorithm], ) - except JWTError: + except jwt.PyJWTError: # check transition key transition_key = settings.authentication.refresh_token.transition_key transition_expire_date = settings.authentication.refresh_token.transition_expire_date @@ -93,14 +93,14 @@ async def refresh_access_token( raise payload = jwt.decode( schema.refresh_token, - transition_key, + str(transition_key), algorithms=[settings.authentication.algorithm], ) regenerate_refresh_token = True token_data = TokenPayload(**payload) - except (JWTError, ValidationError) as e: + except (jwt.PyJWTError, ValidationError) as e: raise InvalidRefreshToken() from e # Check if the token is in the blacklist diff --git a/src/apps/authentication/deps.py b/src/apps/authentication/deps.py index b12413e8bf1..717aa9cf597 100644 --- a/src/apps/authentication/deps.py +++ b/src/apps/authentication/deps.py @@ -1,9 +1,9 @@ from datetime import datetime +import jwt from fastapi import Depends, HTTPException, status from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from fastapi.websockets import WebSocket -from jose import JWTError, jwt from pydantic import EmailStr, ValidationError from starlette.requests import Request @@ -46,7 +46,7 @@ async def get_current_user_for_ws(websocket: WebSocket, session=Depends(get_sess if datetime.utcfromtimestamp(token_data.exp) < datetime.utcnow(): raise AuthenticationError - except (JWTError, ValidationError): + except (jwt.PyJWTError, ValidationError): raise AuthenticationError # Check if the token is in the blacklist @@ -77,7 +77,7 @@ async def _get_current_token( if datetime.utcfromtimestamp(token_payload.exp) < datetime.utcnow(): raise AuthenticationError - except (JWTError, ValidationError): + except (jwt.PyJWTError, ValidationError): raise AuthenticationError return InternalToken(payload=token_payload, raw_token=token) diff --git a/src/apps/authentication/domain/token/internal.py b/src/apps/authentication/domain/token/internal.py index 93c97723f11..a346af4ea54 100644 --- a/src/apps/authentication/domain/token/internal.py +++ b/src/apps/authentication/domain/token/internal.py @@ -1,19 +1,19 @@ import uuid -from enum import Enum +from enum import StrEnum from pydantic import EmailStr from apps.shared.domain.base import InternalModel -class TokenPurpose(str, Enum): +class TokenPurpose(StrEnum): """This enumeration is used for internal needs (cache, ...).""" ACCESS = "access" REFRESH = "refresh" -class JWTClaim(str, Enum): +class JWTClaim(StrEnum): sub = "sub" jti = "jti" exp = "exp" diff --git a/src/apps/authentication/services/security.py b/src/apps/authentication/services/security.py index 524198e7c84..cdf3416b379 100644 --- a/src/apps/authentication/services/security.py +++ b/src/apps/authentication/services/security.py @@ -1,13 +1,13 @@ import uuid from datetime import datetime, timedelta, timezone -from jose import jwt +import jwt from apps.authentication.domain.login import UserLoginRequest from apps.authentication.domain.token import InternalToken, JWTClaim, TokenPayload, TokenPurpose from apps.authentication.errors import BadCredentials, InvalidCredentials from apps.authentication.services.core import TokensService -from apps.shared.passlib import get_password_hash, verify +from apps.shared.bcrypt import get_password_hash, verify from apps.users.cruds.user import UsersCRUD from apps.users.domain import User from config import settings diff --git a/src/apps/authentication/tests/test_auth.py b/src/apps/authentication/tests/test_auth.py index e4ce4b93e60..4464aff35d3 100644 --- a/src/apps/authentication/tests/test_auth.py +++ b/src/apps/authentication/tests/test_auth.py @@ -3,8 +3,8 @@ import uuid from unittest import mock +import jwt import pytest -from jose import jwt from pytest_mock import MockerFixture from sqlalchemy.ext.asyncio import AsyncSession diff --git a/src/apps/authentication/tests/unit/test_auth_deps.py b/src/apps/authentication/tests/unit/test_auth_deps.py index 8eaeee849f1..4d49b9136d8 100644 --- a/src/apps/authentication/tests/unit/test_auth_deps.py +++ b/src/apps/authentication/tests/unit/test_auth_deps.py @@ -1,11 +1,11 @@ import uuid from typing import cast +import jwt import pytest from fastapi import HTTPException from fastapi.security import OAuth2PasswordRequestForm from fastapi.websockets import WebSocket -from jose import JWTError from pytest_mock import MockerFixture from sqlalchemy.ext.asyncio import AsyncSession @@ -68,7 +68,7 @@ async def test_get_current_user_for_ws__expired_time_is_less_than_now( async def test_get_current_user_for_ws__internal_error( session: AsyncSession, mock_ws: WebSocket, mocker: MockerFixture, access_token: str ): - mocker.patch("jose.jwt.decode", side_effect=JWTError()) + mocker.patch("jwt.decode", side_effect=jwt.PyJWTError()) mock_ws.headers["sec-websocket-protocol"] = f"{settings.authentication.token_type}|{access_token}" # type: ignore[index] with pytest.raises(AuthenticationError): await get_current_user_for_ws(mock_ws, session=session) @@ -113,7 +113,7 @@ async def test_get_current_refresh_token(refresh_token: str, user: User): async def test_get_current_access_token__internal_error(access_token: str, mocker: MockerFixture): - mocker.patch("jose.jwt.decode", side_effect=JWTError()) + mocker.patch("jwt.decode", side_effect=jwt.PyJWTError()) coro = get_current_token() with pytest.raises(AuthenticationError): await coro(token=access_token) diff --git a/src/apps/file/domain.py b/src/apps/file/domain.py index bb308badf29..0d122a3dff6 100644 --- a/src/apps/file/domain.py +++ b/src/apps/file/domain.py @@ -5,7 +5,7 @@ from apps.shared.domain import PublicModel -class WebmTargetExtenstion(str, enum.Enum): +class WebmTargetExtenstion(enum.StrEnum): MP3 = ".mp3" MP4 = ".mp4" diff --git a/src/apps/file/enums.py b/src/apps/file/enums.py index 85ddf62c754..91f9302a561 100644 --- a/src/apps/file/enums.py +++ b/src/apps/file/enums.py @@ -1,6 +1,6 @@ -from enum import Enum +from enum import StrEnum -class FileScopeEnum(str, Enum): +class FileScopeEnum(StrEnum): CONTENT = "content" ANSWER = "answer" diff --git a/src/apps/healthcheck/domain.py b/src/apps/healthcheck/domain.py index 11e020afdcb..385c06ff3da 100644 --- a/src/apps/healthcheck/domain.py +++ b/src/apps/healthcheck/domain.py @@ -5,7 +5,7 @@ from apps.shared.domain import PublicModel -class EmergencyMessageType(str, enum.Enum): +class EmergencyMessageType(enum.StrEnum): info = "info" warning = "warning" blocker = "blocker" diff --git a/src/apps/invitations/constants.py b/src/apps/invitations/constants.py index 2059883a779..d3cf4b266ae 100644 --- a/src/apps/invitations/constants.py +++ b/src/apps/invitations/constants.py @@ -1,7 +1,7 @@ -from enum import Enum +from enum import StrEnum -class InvitationStatus(str, Enum): +class InvitationStatus(StrEnum): PENDING = "pending" APPROVED = "approved" DECLINED = "declined" diff --git a/src/apps/invitations/domain.py b/src/apps/invitations/domain.py index f2b80c8ea6a..17ffab9d7e4 100644 --- a/src/apps/invitations/domain.py +++ b/src/apps/invitations/domain.py @@ -1,6 +1,6 @@ import uuid from datetime import datetime -from enum import Enum +from enum import StrEnum from pydantic import EmailStr, Extra, Field, root_validator, validator @@ -15,7 +15,7 @@ class Applet(PublicModel): display_name: str -class InvitationLanguage(str, Enum): +class InvitationLanguage(StrEnum): EN = "en" # English FR = "fr" # French EL = "el" # Greek diff --git a/src/apps/job/constants.py b/src/apps/job/constants.py index d3ebdc64e8f..1f0139ac394 100644 --- a/src/apps/job/constants.py +++ b/src/apps/job/constants.py @@ -1,7 +1,7 @@ import enum -class JobStatus(str, enum.Enum): +class JobStatus(enum.StrEnum): pending = "pending" in_progress = "in_progress" success = "success" diff --git a/src/apps/jsonld_converter/service/base.py b/src/apps/jsonld_converter/service/base.py index 823d13d82db..5d911341281 100644 --- a/src/apps/jsonld_converter/service/base.py +++ b/src/apps/jsonld_converter/service/base.py @@ -8,7 +8,7 @@ from apps.jsonld_converter.errors import JsonLDLoaderError, JsonLDProcessingError -class LdKeyword(str, enum.Enum): +class LdKeyword(enum.StrEnum): context = "@context" type = "@type" id = "@id" diff --git a/src/apps/jsonld_converter/service/converter.py b/src/apps/jsonld_converter/service/converter.py index 9f30790d344..3e3f3669f19 100644 --- a/src/apps/jsonld_converter/service/converter.py +++ b/src/apps/jsonld_converter/service/converter.py @@ -101,7 +101,7 @@ async def convert(self, input_: str | dict, base_url: str | None = None): return obj.export() -class ExportFormat(enum.Enum): +class ExportFormat(enum.StrEnum): zip = "zip" list = "list" diff --git a/src/apps/schedule/domain/constants.py b/src/apps/schedule/domain/constants.py index 627841119d1..21406e46c68 100644 --- a/src/apps/schedule/domain/constants.py +++ b/src/apps/schedule/domain/constants.py @@ -1,6 +1,6 @@ import uuid from datetime import time, timedelta -from enum import Enum +from enum import StrEnum from pydantic import BaseModel @@ -12,7 +12,7 @@ ] -class PeriodicityType(str, Enum): +class PeriodicityType(StrEnum): ONCE = "ONCE" DAILY = "DAILY" WEEKLY = "WEEKLY" @@ -21,7 +21,7 @@ class PeriodicityType(str, Enum): ALWAYS = "ALWAYS" -class TimerType(str, Enum): +class TimerType(StrEnum): NOT_SET = "NOT_SET" TIMER = "TIMER" IDLE = "IDLE" @@ -45,11 +45,11 @@ class DefaultEvent(BaseModel): flow_id: uuid.UUID | None -class AvailabilityType(str, Enum): +class AvailabilityType(StrEnum): ALWAYS_AVAILABLE = "AlwaysAvailable" SCHEDULED_ACCESS = "ScheduledAccess" -class NotificationTriggerType(str, Enum): +class NotificationTriggerType(StrEnum): FIXED = "FIXED" RANDOM = "RANDOM" diff --git a/src/apps/shared/bcrypt.py b/src/apps/shared/bcrypt.py new file mode 100644 index 00000000000..03436b00cfb --- /dev/null +++ b/src/apps/shared/bcrypt.py @@ -0,0 +1,16 @@ +import bcrypt + + +# Hash a password using bcrypt +def get_password_hash(password) -> str: + pwd_bytes = password.encode("utf-8") + salt = bcrypt.gensalt() + hashed_password = bcrypt.hashpw(password=pwd_bytes, salt=salt) + return hashed_password.decode("utf8") + + +# Check if the provided password matches the stored password (hashed) +def verify(plain_password: str, hashed_password: str) -> bool: + password_byte_enc = plain_password.encode("utf-8") + hashed_password_enc = hashed_password.encode("utf-8") + return bcrypt.checkpw(password=password_byte_enc, hashed_password=hashed_password_enc) diff --git a/src/apps/shared/domain/response/errors.py b/src/apps/shared/domain/response/errors.py index 061734f9bd0..a001384123e 100644 --- a/src/apps/shared/domain/response/errors.py +++ b/src/apps/shared/domain/response/errors.py @@ -1,4 +1,4 @@ -from enum import Enum +from enum import StrEnum from typing import Any from pydantic import Field, conlist @@ -8,7 +8,7 @@ from apps.shared.domain.types import ResponseType -class ErrorResponseType(str, Enum): +class ErrorResponseType(StrEnum): UNDEFINED = "UNDEFINED" diff --git a/src/apps/shared/enums.py b/src/apps/shared/enums.py index e951780f9b5..30f0623cd3a 100644 --- a/src/apps/shared/enums.py +++ b/src/apps/shared/enums.py @@ -1,7 +1,7 @@ -from enum import Enum +from enum import StrEnum -class Language(str, Enum): +class Language(StrEnum): ENGLISH = "en" FRENCH = "fr" RUSSIAN = "ru" diff --git a/src/apps/shared/exception.py b/src/apps/shared/exception.py index 809aa386543..4ef39250654 100644 --- a/src/apps/shared/exception.py +++ b/src/apps/shared/exception.py @@ -1,4 +1,4 @@ -from enum import Enum +from enum import StrEnum from gettext import gettext as _ from starlette import status @@ -6,7 +6,7 @@ from apps.shared.enums import Language -class ExceptionTypes(str, Enum): +class ExceptionTypes(StrEnum): UNDEFINED = "UNDEFINED" BAD_REQUEST = "BAD_REQUEST" INVALID_VALUE = "INVALID_VALUE" diff --git a/src/apps/shared/filtering.py b/src/apps/shared/filtering.py index f5d0164312a..e2966468673 100644 --- a/src/apps/shared/filtering.py +++ b/src/apps/shared/filtering.py @@ -2,12 +2,12 @@ __all__ = ["Filtering", "FilterField"] -from enum import Enum +from enum import StrEnum from sqlalchemy import Column -class Comparisons(str, Enum): +class Comparisons(StrEnum): EQUAL = "eq" NOT_EQUAL = "neq" IN = "in" diff --git a/src/apps/shared/passlib.py b/src/apps/shared/passlib.py deleted file mode 100644 index 17b504aca07..00000000000 --- a/src/apps/shared/passlib.py +++ /dev/null @@ -1,11 +0,0 @@ -from passlib.context import CryptContext - -pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") - - -def verify(plain_password: str, hashed_password: str) -> bool: - return pwd_context.verify(plain_password, hashed_password) - - -def get_password_hash(password: str) -> str: - return pwd_context.hash(password) diff --git a/src/apps/subjects/constants.py b/src/apps/subjects/constants.py index f97484c86d8..871fa9ac1e3 100644 --- a/src/apps/subjects/constants.py +++ b/src/apps/subjects/constants.py @@ -1,18 +1,18 @@ -from enum import Enum +from enum import StrEnum -class SubjectStatus(str, Enum): +class SubjectStatus(StrEnum): INVITED = "invited" NOT_INVITED = "not_invited" PENDING = "pending" -class Relation(str, Enum): +class Relation(StrEnum): self = "self" admin = "admin" other = "other" -class SubjectTag(str, Enum): +class SubjectTag(StrEnum): TEAM = "Team" # Todo: Add more tags diff --git a/src/apps/transfer_ownership/constants.py b/src/apps/transfer_ownership/constants.py index 4f9d445c0ac..4854596a2c1 100644 --- a/src/apps/transfer_ownership/constants.py +++ b/src/apps/transfer_ownership/constants.py @@ -1,7 +1,7 @@ -from enum import Enum +from enum import StrEnum -class TransferOwnershipStatus(str, Enum): +class TransferOwnershipStatus(StrEnum): PENDING = "pending" APPROVED = "approved" DECLINED = "declined" diff --git a/src/apps/users/domain.py b/src/apps/users/domain.py index 929989ff278..553125a220c 100644 --- a/src/apps/users/domain.py +++ b/src/apps/users/domain.py @@ -3,10 +3,10 @@ from pydantic import EmailStr, Field, root_validator, validator +from apps.shared.bcrypt import get_password_hash from apps.shared.domain import InternalModel, PublicModel from apps.shared.domain.custom_validations import lowercase_email from apps.shared.hashing import hash_sha224 -from apps.shared.passlib import get_password_hash from apps.users.db.schemas import UserDeviceSchema from apps.users.errors import PasswordHasSpacesError diff --git a/src/apps/users/tests/unit/test_user_domain.py b/src/apps/users/tests/unit/test_user_domain.py index 933f348c1a8..09edb9eb366 100644 --- a/src/apps/users/tests/unit/test_user_domain.py +++ b/src/apps/users/tests/unit/test_user_domain.py @@ -3,8 +3,8 @@ import pytest from pydantic import ValidationError +from apps.shared.bcrypt import verify from apps.shared.hashing import hash_sha224 -from apps.shared.passlib import verify from apps.users import domain, errors BaseData = dict[str, str] diff --git a/src/apps/workspaces/constants.py b/src/apps/workspaces/constants.py index 4a94e01d72b..fcab4217ffb 100644 --- a/src/apps/workspaces/constants.py +++ b/src/apps/workspaces/constants.py @@ -1,7 +1,7 @@ import enum -class StorageType(str, enum.Enum): +class StorageType(enum.StrEnum): AWS = "aws" AZURE = "azure" GCP = "gcp" diff --git a/src/apps/workspaces/domain/constants.py b/src/apps/workspaces/domain/constants.py index 3cbe4638ea0..b44c3047da0 100644 --- a/src/apps/workspaces/domain/constants.py +++ b/src/apps/workspaces/domain/constants.py @@ -1,8 +1,8 @@ -from enum import Enum +from enum import StrEnum from functools import lru_cache -class Role(str, Enum): +class Role(StrEnum): SUPER_ADMIN = "super_admin" OWNER = "owner" MANAGER = "manager" @@ -55,18 +55,18 @@ def reviewers(cls) -> list["Role"]: return [cls.OWNER, cls.MANAGER, cls.REVIEWER] -class ManagersRole(str, Enum): +class ManagersRole(StrEnum): MANAGER = "manager" COORDINATOR = "coordinator" EDITOR = "editor" -class UserPinRole(str, Enum): +class UserPinRole(StrEnum): manager = "manager" respondent = "respondent" -class DataRetention(str, Enum): +class DataRetention(StrEnum): INDEFINITELY = "indefinitely" DAYS = "days" WEEKS = "weeks" diff --git a/src/infrastructure/http/domain.py b/src/infrastructure/http/domain.py index a8b3741fa6e..273a802d009 100644 --- a/src/infrastructure/http/domain.py +++ b/src/infrastructure/http/domain.py @@ -1,7 +1,7 @@ -from enum import Enum +from enum import StrEnum -class MindloggerContentSource(str, Enum): +class MindloggerContentSource(StrEnum): """The allowed values for the Mindlogger-Content-Source HTTP header.""" web = "web" diff --git a/src/infrastructure/utility/notification_client.py b/src/infrastructure/utility/notification_client.py index 63bee0e79ac..b3fc290b1a3 100644 --- a/src/infrastructure/utility/notification_client.py +++ b/src/infrastructure/utility/notification_client.py @@ -11,7 +11,7 @@ from config import settings -class FirebaseNotificationType(str, enum.Enum): +class FirebaseNotificationType(enum.StrEnum): RESPONSE = "response-data-alert" APPLET_UPDATE = "applet-update-alert" APPLET_DELETE = "applet-delete-alert"