From bb50ce54b4c5528f84c43bd3566e5aa8593e5040 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 29 Jul 2026 15:09:48 +0200 Subject: [PATCH 1/2] chore: Enable Ruff formatting of Python code blocks in Markdown --- .rules.md | 1 + docs/guides/stagehand_crawler.mdx | 3 ++- docs/upgrading/upgrading_to_v1.md | 4 +++- pyproject.toml | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.rules.md b/.rules.md index a44024a3fe..486620e08c 100644 --- a/.rules.md +++ b/.rules.md @@ -113,6 +113,7 @@ Pluggable via `HttpClient` interface in `src/crawlee/http_clients/`: @crawler.router.default_handler async def handler(context: BeautifulSoupCrawlingContext): ... + @crawler.router.handler(label='detail') async def detail(context: BeautifulSoupCrawlingContext): ... ``` diff --git a/docs/guides/stagehand_crawler.mdx b/docs/guides/stagehand_crawler.mdx index 048f9afbf9..adbd31b3e9 100644 --- a/docs/guides/stagehand_crawler.mdx +++ b/docs/guides/stagehand_crawler.mdx @@ -104,7 +104,8 @@ result = await context.page.execute( agent_config={}, execute_options={ 'instruction': 'Search for "web scraping" and return the titles of the first five results', - }) + }, +) ``` ## Browserbase integration diff --git a/docs/upgrading/upgrading_to_v1.md b/docs/upgrading/upgrading_to_v1.md index 0ba4352d6f..412a8919f2 100644 --- a/docs/upgrading/upgrading_to_v1.md +++ b/docs/upgrading/upgrading_to_v1.md @@ -281,7 +281,7 @@ crawler_2 = BasicCrawler( configuration=custom_configuration_2, event_manager=custom_event_manager_2, storage_client=custom_storage_client_2, - ) +) # use crawlers without runtime crash... ``` @@ -311,6 +311,7 @@ The method `HttpResponse.read` is now asynchronous. This affects all HTTP-based ```python from crawlee.crawlers import ParselCrawler, ParselCrawlingContext + async def main() -> None: crawler = ParselCrawler() @@ -328,6 +329,7 @@ async def main() -> None: ```python from crawlee.crawlers import ParselCrawler, ParselCrawlingContext + async def main() -> None: crawler = ParselCrawler() diff --git a/pyproject.toml b/pyproject.toml index a10b02e69b..c21db630a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -169,11 +169,16 @@ include = [ "scripts/**/*.py", "docs/**/*.py", "website/**/*.py", + # Ruff formats Python code blocks embedded in Markdown files. + "**/*.md", + "**/*.mdx", ] exclude = [ "website/versioned_docs/**", ] extend-exclude = ["src/crawlee/project_template"] +# MDX is Markdown; without this mapping Ruff would try to parse `.mdx` files as Python. +extension = { mdx = "markdown" } [tool.ruff.lint] select = ["ALL"] From 847cfcf2daa41528542f921da686293d32f78ae6 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 29 Jul 2026 15:12:12 +0200 Subject: [PATCH 2/2] chore: Simplify Ruff include patterns to a single Python glob --- pyproject.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c21db630a9..6f036ebb95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -164,11 +164,7 @@ only-include = [ [tool.ruff] line-length = 120 include = [ - "src/**/*.py", - "tests/**/*.py", - "scripts/**/*.py", - "docs/**/*.py", - "website/**/*.py", + "**/*.py", # Ruff formats Python code blocks embedded in Markdown files. "**/*.md", "**/*.mdx",