From fb356511f06f558b1e887fe2ff05c767a77ed94a Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Thu, 7 Dec 2023 01:35:11 +0100 Subject: [PATCH] chore: Updates poetry dependency sync w/ CI (#39) * chore: Updates poetry lock * docs: Updates makefile * ci: Updates style job * ci: Fixes poetry resolution in CI --- .github/workflows/style.yml | 39 ++++++++++++++++++++++++++++++------- .github/workflows/tests.yml | 2 +- Makefile | 4 ++-- poetry.lock | 36 +++++++++++++++++----------------- pyproject.toml | 20 ++++++++++++------- 5 files changed, 66 insertions(+), 35 deletions(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index e46dbad..b3cfda7 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -16,13 +16,26 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} architecture: x64 + - uses: abatilo/actions-poetry@v2 + with: + poetry-version: "1.6.1" + - name: Resolve dependencies + run: poetry export -f requirements.txt --without-hashes --only quality --output requirements.txt + - name: Cache python modules + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements.txt') }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt - name: Run ruff run: | - pip install "ruff==0.1.7" ruff --version ruff check --diff . @@ -42,7 +55,7 @@ jobs: with: poetry-version: "1.6.1" - name: Resolve dependencies - run: poetry export -f requirements.txt --without-hashes --output requirements.txt + run: poetry export -f requirements.txt --without-hashes --with quality --output requirements.txt - name: Cache python modules uses: actions/cache@v2 with: @@ -51,8 +64,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt --upgrade - pip install "mypy==1.4.1" types-requests types-python-jose types-passlib + pip install -r requirements.txt - name: Run mypy run: | mypy --version @@ -67,12 +79,25 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} architecture: x64 + - uses: abatilo/actions-poetry@v2 + with: + poetry-version: "1.6.1" + - name: Resolve dependencies + run: poetry export -f requirements.txt --without-hashes --only quality --output requirements.txt + - name: Cache python modules + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements.txt') }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt - name: Run ruff run: | - pip install "ruff==0.1.3" ruff --version ruff format --check --diff . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bde34b3..fd994f3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: with: poetry-version: "1.6.1" - name: Resolve dependencies - run: poetry export -f requirements.txt --without-hashes --with dev --output requirements.txt + run: poetry export -f requirements.txt --without-hashes --with test --output requirements.txt - name: Build & run docker env: SUPERADMIN_GH_PAT: ${{ secrets.SUPERADMIN_GH_PAT }} diff --git a/Makefile b/Makefile index 13c18a9..fb3be09 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ stop: docker compose down run-dev: - poetry export -f requirements.txt --without-hashes --with dev --output requirements.txt + poetry export -f requirements.txt --without-hashes --with test --output requirements.txt docker compose -f docker-compose.test.yml up -d --build stop-dev: @@ -36,7 +36,7 @@ stop-dev: # Run tests for the library test: - poetry export -f requirements.txt --without-hashes --with dev --output requirements.txt + poetry export -f requirements.txt --without-hashes --with test --output requirements.txt docker compose -f docker-compose.test.yml up -d --build docker compose exec -T backend pytest --cov=app docker compose -f docker-compose.test.yml down diff --git a/poetry.lock b/poetry.lock index f5f4ecf..67c2293 100644 --- a/poetry.lock +++ b/poetry.lock @@ -210,7 +210,7 @@ pycparser = "*" name = "cfgv" version = "3.4.0" description = "Validate configuration and produce human readable error messages." -optional = true +optional = false python-versions = ">=3.8" files = [ {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"}, @@ -412,7 +412,7 @@ toml = ["tomli"] name = "distlib" version = "0.3.7" description = "Distribution utilities" -optional = true +optional = false python-versions = "*" files = [ {file = "distlib-0.3.7-py2.py3-none-any.whl", hash = "sha256:2e24928bc811348f0feb63014e97aaae3037f2cf48712d51ae61df7fd6075057"}, @@ -475,7 +475,7 @@ all = ["email-validator (>=2.0.0)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)" name = "filelock" version = "3.12.4" description = "A platform independent file lock." -optional = true +optional = false python-versions = ">=3.8" files = [ {file = "filelock-3.12.4-py3-none-any.whl", hash = "sha256:08c21d87ded6e2b9da6728c3dff51baf1dcecf973b768ef35bcbc3447edb9ad4"}, @@ -616,7 +616,7 @@ socks = ["socksio (==1.*)"] name = "identify" version = "2.5.30" description = "File identification library for Python" -optional = true +optional = false python-versions = ">=3.8" files = [ {file = "identify-2.5.30-py2.py3-none-any.whl", hash = "sha256:afe67f26ae29bab007ec21b03d4114f41316ab9dd15aa8736a167481e108da54"}, @@ -776,7 +776,7 @@ files = [ name = "mypy" version = "1.6.1" description = "Optional static typing for Python" -optional = true +optional = false python-versions = ">=3.8" files = [ {file = "mypy-1.6.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e5012e5cc2ac628177eaac0e83d622b2dd499e28253d4107a08ecc59ede3fc2c"}, @@ -822,7 +822,7 @@ reports = ["lxml"] name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." -optional = true +optional = false python-versions = ">=3.5" files = [ {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, @@ -833,7 +833,7 @@ files = [ name = "nodeenv" version = "1.8.0" description = "Node.js virtual environment builder" -optional = true +optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" files = [ {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, @@ -878,7 +878,7 @@ totp = ["cryptography"] name = "platformdirs" version = "3.11.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -optional = true +optional = false python-versions = ">=3.7" files = [ {file = "platformdirs-3.11.0-py3-none-any.whl", hash = "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e"}, @@ -931,7 +931,7 @@ test = ["coverage", "flake8", "freezegun (==0.3.15)", "mock (>=2.0.0)", "pylint" name = "pre-commit" version = "2.21.0" description = "A framework for managing and maintaining multi-language pre-commit hooks." -optional = true +optional = false python-versions = ">=3.7" files = [ {file = "pre_commit-2.21.0-py2.py3-none-any.whl", hash = "sha256:e2f91727039fc39a92f58a588a25b87f936de6567eed4f0e673e0507edc75bad"}, @@ -1158,7 +1158,7 @@ six = ">=1.4.0" name = "pyyaml" version = "6.0.1" description = "YAML parser and emitter for Python" -optional = true +optional = false python-versions = ">=3.6" files = [ {file = "PyYAML-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a"}, @@ -1260,7 +1260,7 @@ pyasn1 = ">=0.1.3" name = "ruff" version = "0.1.7" description = "An extremely fast Python linter and code formatter, written in Rust." -optional = true +optional = false python-versions = ">=3.7" files = [ {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7f80496854fdc65b6659c271d2c26e90d4d401e6a4a31908e7e334fab4645aac"}, @@ -1332,7 +1332,7 @@ tornado = ["tornado (>=5)"] name = "setuptools" version = "68.2.2" description = "Easily download, build, install, upgrade, and uninstall Python packages" -optional = true +optional = false python-versions = ">=3.8" files = [ {file = "setuptools-68.2.2-py3-none-any.whl", hash = "sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a"}, @@ -1531,7 +1531,7 @@ files = [ name = "types-passlib" version = "1.7.7.13" description = "Typing stubs for passlib" -optional = true +optional = false python-versions = "*" files = [ {file = "types-passlib-1.7.7.13.tar.gz", hash = "sha256:f152639f1f2103d7f59a56e2aec5f9398a75a80830991d0d68aac5c2b9c32a77"}, @@ -1542,7 +1542,7 @@ files = [ name = "types-pyasn1" version = "0.5.0.0" description = "Typing stubs for pyasn1" -optional = true +optional = false python-versions = ">=3.7" files = [ {file = "types-pyasn1-0.5.0.0.tar.gz", hash = "sha256:4bfea6548206866302885c36aba945c0deaa40898a313112b5cff7f903a56d71"}, @@ -1553,7 +1553,7 @@ files = [ name = "types-python-jose" version = "3.3.4.8" description = "Typing stubs for python-jose" -optional = true +optional = false python-versions = "*" files = [ {file = "types-python-jose-3.3.4.8.tar.gz", hash = "sha256:3c316675c3cee059ccb9aff87358254344915239fa7f19cee2787155a7db14ac"}, @@ -1567,7 +1567,7 @@ types-pyasn1 = "*" name = "types-requests" version = "2.31.0.10" description = "Typing stubs for requests" -optional = true +optional = false python-versions = ">=3.7" files = [ {file = "types-requests-2.31.0.10.tar.gz", hash = "sha256:dc5852a76f1eaf60eafa81a2e50aefa3d1f015c34cf0cba130930866b1b22a92"}, @@ -1628,7 +1628,7 @@ standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", name = "virtualenv" version = "20.24.6" description = "Virtual Python Environment builder" -optional = true +optional = false python-versions = ">=3.7" files = [ {file = "virtualenv-20.24.6-py3-none-any.whl", hash = "sha256:520d056652454c5098a00c0f073611ccbea4c79089331f60bf9d7ba247bb7381"}, @@ -1647,4 +1647,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "de453a39ca441a5a61a9d1b9bb8c92e3eaa0127e4118bdd75de4a3d2b106cadb" +content-hash = "26d3daa2258c53c4d02e9caff460e2e6e006c204c90177471ad3f1818285fc4e" diff --git a/pyproject.toml b/pyproject.toml index 29e4e5d..fb7aae4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,15 +29,21 @@ sentry-sdk = { version = "^1.14.0", extras = ["fastapi"] } alembic = "^1.8.1" posthog = "^3.0.0" +[tool.poetry.group.quality] +optional = true + [tool.poetry.group.quality.dependencies] -ruff = { version = "==0.1.7", optional = true } -mypy = { version = "==1.6.1", optional = true } -types-requests = { version = ">=2.0.0", optional = true } -types-python-jose = { version = ">=3.3.0", optional = true } -types-passlib = { version = ">=1.7.0", optional = true } -pre-commit = { version = "^2.17.0", optional = true } +ruff = "==0.1.7" +mypy = "==1.6.1" +types-requests = ">=2.0.0" +types-python-jose = ">=3.3.0" +types-passlib = ">=1.7.0" +pre-commit = "^2.17.0" + +[tool.poetry.group.test] +optional = true -[tool.poetry.group.dev.dependencies] +[tool.poetry.group.test.dependencies] pytest = ">=5.3.2,<8.0.0" pytest-asyncio = ">=0.17.0,<1.0.0" httpx = ">=0.23.0"