From ff67298890ebacbba43bdf60152dc576e54fccee Mon Sep 17 00:00:00 2001 From: vladkens Date: Thu, 21 May 2026 05:57:24 +0300 Subject: [PATCH] build: split lint/check and fix pyright example --- .github/workflows/ci.yml | 2 +- Dockerfile.py-matrix | 4 ++-- Makefile | 15 +++++++++------ examples/parallel_search.py | 3 +-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc480a7..5d57a62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: python-version: ${{ matrix.python-version }} - run: uv sync --frozen - - run: make lint + - run: make check - run: make test release: diff --git a/Dockerfile.py-matrix b/Dockerfile.py-matrix index bdbea7e..2fddc9f 100644 --- a/Dockerfile.py-matrix +++ b/Dockerfile.py-matrix @@ -1,11 +1,11 @@ ARG VER=3.12 FROM python:${VER}-alpine -RUN apk add git uv +RUN apk add make git uv nodejs WORKDIR /app COPY pyproject.toml readme.md uv.lock /app/ RUN uv sync --frozen COPY . /app -CMD ["sh", "-c", "uv run pytest tests/"] +CMD ["sh", "-c", "make check && make test"] diff --git a/Makefile b/Makefile index 1ebd707..2851a64 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -.PHONY: prepare install update lint test test-py test-sq test-matrix-py test-matrix-sq +.PHONY: prepare install update lint check test test-py test-sq test-matrix-py test-matrix-sq -prepare: lint +prepare: lint check install: uv sync @@ -9,10 +9,13 @@ update: uv sync --upgrade --all-groups lint: - @uv run ruff check --select I --fix . - @uv run ruff format . - @uv run ruff check . - @uv run pyright . + uv run ruff check --select I --fix . + uv run ruff format . + +check: + uv run ruff format --check . + uv run ruff check . + uv run pyright . test: @uv run pytest -s --cov=twscrape tests/ diff --git a/examples/parallel_search.py b/examples/parallel_search.py index e3d4ae5..730adc7 100644 --- a/examples/parallel_search.py +++ b/examples/parallel_search.py @@ -15,8 +15,7 @@ async def worker(api: twscrape.API, q: str): tweets.append(doc) except Exception as e: print(e) - finally: - return tweets + return tweets async def main():