diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml index 09e8724f22..30f735453a 100644 --- a/.devcontainer/docker-compose.yaml +++ b/.devcontainer/docker-compose.yaml @@ -30,4 +30,4 @@ services: networks: faststream-network: - name: "${USER}-faststream-network" \ No newline at end of file + name: "${USER}-faststream-network" diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index fb0b3f4fc4..22c724e4d6 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -4,4 +4,4 @@ uv venv .venv uv pip install -e ".[dev]" -source .venv/bin/activate \ No newline at end of file +source .venv/bin/activate diff --git a/.github/workflows/pr_tests.yaml b/.github/workflows/pr_tests.yaml index b5dc7afc31..8e064b1eaf 100644 --- a/.github/workflows/pr_tests.yaml +++ b/.github/workflows/pr_tests.yaml @@ -18,36 +18,24 @@ concurrency: cancel-in-progress: true jobs: - static_analysis: + pre-commit-check: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: 3.9 - - name: Install Dependencies and library - shell: bash - run: | - set -ux - python -m pip install uv - uv pip install --system .[lint] - - - name: Run ruff - shell: bash - run: ruff check - - - name: Run mypy - shell: bash - run: mypy - - - name: Run bandit - shell: bash - run: bandit -c pyproject.toml -r faststream - - - name: Run Semgrep - shell: bash - run: semgrep scan --config auto --error + python-version: | + 3.8 + 3.9 + 3.10 + - name: Set $PY environment variable + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }} + - uses: pre-commit/action@v3.0.1 test-basic: if: github.event.pull_request.draft == false @@ -481,7 +469,7 @@ jobs: if: github.event.pull_request.draft == false needs: - - static_analysis + - pre-commit-check - coverage-combine - test-macos-latest - test-windows-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a864ee48c..1427063edc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -17,7 +17,7 @@ repos: - id: check-added-large-files - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell args: [--ignore-words=.codespell-whitelist.txt] @@ -60,7 +60,7 @@ repos: verbose: true - repo: https://github.com/Yelp/detect-secrets - rev: v1.4.0 + rev: v1.5.0 hooks: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] diff --git a/.secrets.baseline b/.secrets.baseline index 81e8e12bdc..297b9ca6b8 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -1,5 +1,5 @@ { - "version": "1.4.0", + "version": "1.5.0", "plugins_used": [ { "name": "ArtifactoryDetector" @@ -26,6 +26,9 @@ { "name": "GitHubTokenDetector" }, + { + "name": "GitLabTokenDetector" + }, { "name": "HexHighEntropyString", "limit": 3.0 @@ -36,6 +39,9 @@ { "name": "IbmCosHmacDetector" }, + { + "name": "IPPublicDetector" + }, { "name": "JwtTokenDetector" }, @@ -49,9 +55,15 @@ { "name": "NpmDetector" }, + { + "name": "OpenAIDetector" + }, { "name": "PrivateKeyDetector" }, + { + "name": "PypiTokenDetector" + }, { "name": "SendGridDetector" }, @@ -67,6 +79,9 @@ { "name": "StripeDetector" }, + { + "name": "TelegramBotTokenDetector" + }, { "name": "TwilioKeyDetector" } @@ -112,6 +127,16 @@ } ], "results": { + "docs/docs/en/confluent/security.md": [ + { + "type": "Secret Keyword", + "filename": "docs/docs/en/confluent/security.md", + "hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8", + "is_verified": false, + "line_number": 88, + "is_secret": false + } + ], "docs/docs/en/getting-started/config/index.md": [ { "type": "Basic Auth Credentials", @@ -128,7 +153,7 @@ "filename": "docs/docs/en/release.md", "hashed_secret": "35675e68f4b5af7b995d9205ad0fc43842f16450", "is_verified": false, - "line_number": 1423, + "line_number": 1550, "is_secret": false } ], @@ -151,17 +176,7 @@ "line_number": 15, "is_secret": false } - ], - "faststream/rabbit/broker.py": [ - { - "type": "Basic Auth Credentials", - "filename": "faststream/rabbit/broker.py", - "hashed_secret": "35675e68f4b5af7b995d9205ad0fc43842f16450", - "is_verified": false, - "line_number": 69, - "is_secret": false - } ] }, - "generated_at": "2024-07-23T21:38:30Z" + "generated_at": "2024-08-20T07:41:38Z" } diff --git a/docs/docs/en/release.md b/docs/docs/en/release.md index b72b68031c..fd9eaa0427 100644 --- a/docs/docs/en/release.md +++ b/docs/docs/en/release.md @@ -42,7 +42,7 @@ Just a hotfix for the following case: @broker.subscriber(...) async def handler(): return NatsResponse(...) - + await broker.publish(..., rpc=True) ``` @@ -58,7 +58,7 @@ await broker.publish(..., rpc=True) ### What's Changed -Well, seems like it is the biggest patch release ever 😃 +Well, seems like it is the biggest patch release ever 😃 #### Detail Responses diff --git a/faststream/broker/fastapi/route.py b/faststream/broker/fastapi/route.py index 0c084ee061..1040acfcd1 100644 --- a/faststream/broker/fastapi/route.py +++ b/faststream/broker/fastapi/route.py @@ -39,7 +39,7 @@ class StreamRoute( - BaseRoute, # type: ignore[misc] + BaseRoute, Generic[MsgType, P_HandlerParams, T_HandlerReturn], ): """A class representing a stream route.""" @@ -123,7 +123,7 @@ def __init__( ) -class StreamMessage(Request): # type: ignore[misc] +class StreamMessage(Request): """A class to represent a stream message.""" scope: "AnyDict" diff --git a/faststream/broker/fastapi/router.py b/faststream/broker/fastapi/router.py index c7a31a73a2..5072476f18 100644 --- a/faststream/broker/fastapi/router.py +++ b/faststream/broker/fastapi/router.py @@ -69,7 +69,7 @@ async def after_processed( exc_tb: Optional["TracebackType"] = None, ) -> Optional[bool]: if not exc_type and ( - background := cast( # type: ignore[redundant-cast] + background := cast( Optional[BackgroundTasks], getattr(context.get_local("message"), "background", None), ) @@ -80,7 +80,7 @@ async def after_processed( class StreamRouter( - APIRouter, # type: ignore[misc] + APIRouter, AsyncAPIApplication, Generic[MsgType], ): diff --git a/faststream/cli/supervisors/watchfiles.py b/faststream/cli/supervisors/watchfiles.py index 01c7374270..9b70dbff5b 100644 --- a/faststream/cli/supervisors/watchfiles.py +++ b/faststream/cli/supervisors/watchfiles.py @@ -10,7 +10,7 @@ from faststream.types import DecoratedCallable -class ExtendedFilter(watchfiles.PythonFilter): # type: ignore[misc] +class ExtendedFilter(watchfiles.PythonFilter): """A class that extends the `watchfiles.PythonFilter` class.""" def __init__( diff --git a/pyproject.toml b/pyproject.toml index 7bfee4aea9..40026e47e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -174,7 +174,7 @@ no_implicit_optional = true check_untyped_defs = true warn_return_any = true show_error_codes = true -warn_unused_ignores = false +warn_unused_ignores = true disallow_incomplete_defs = true disallow_untyped_decorators = true @@ -339,5 +339,5 @@ omit = [ [tool.bandit] [tool.codespell] -skip = "./venv,./docs/site/*" +skip = "./venv*,./docs/site/*,./htmlcov" ignore-words = ".codespell-whitelist.txt"