Results:
➤ uv run with_httpx.py
time taken to make 10000 requests: 20.2337 seconds
Counter({200: 10000})
➤ uv run with_thread_pool.py
| #!/usr/bin/env -S uv run --script | |
| # /// script | |
| # requires-python = ">=3.11" | |
| # dependencies = [ | |
| # "httpx", | |
| # "pydantic", | |
| # "pygments", | |
| # ] | |
| # /// | |
| import argparse |
| # /// script | |
| # requires-python = ">=3.13" | |
| # dependencies = [ | |
| # "mcp", | |
| # "python-dotenv", | |
| # ] | |
| # /// | |
| import asyncio | |
| import os |
| # /// script | |
| # requires-python = ">=3.13" | |
| # dependencies = [ | |
| # "devtools", | |
| # "mcp", | |
| # "python-dotenv", | |
| # ] | |
| # /// | |
| import asyncio | |
| import os |
| SELECT | |
| COUNT(*) AS num_downloads, | |
| 100 * COUNT(*) / SUM(COUNT(*)) OVER () AS percent_of_total, | |
| 'installer=' || coalesce(details.installer.name, '?') || | |
| ' system=' || coalesce(details.system.name || details.system.release, '?') || | |
| ' distro=' || coalesce(details.distro.name || details.distro.version, '?') as setup | |
| FROM `bigquery-public-data.pypi.file_downloads` | |
| WHERE | |
| file.project = '...' | |
| AND DATE_TRUNC(DATE(timestamp), MONTH) >= DATE_TRUNC(current_date(), month) |
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "logfire", | |
| # "pydantic-ai-slim[google]", | |
| # ] | |
| # /// | |
| import logfire | |
| from pydantic_ai import Agent |
| from typing_extensions import TypedDict | |
| import logfire | |
| from httpx import AsyncClient | |
| from agents import RunContextWrapper, Agent, function_tool, Runner | |
| from agents.tool import WebSearchTool | |
| logfire.configure() | |
| logfire.instrument_openai_agents() |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Am I active</title> | |
| </head> | |
| <body> | |
| <input name="testing"/> | |
| <div class="context" style="margin-bottom: 100px"> |
| PointPydanticBaseModel v2.10.4: 538ns | |
| PointPydanticTypedDict v2.10.4: 247ns | |
| attrs v24.3.0: 551ns |
| import json | |
| from dataclasses import dataclass | |
| from typing import Annotated, Any, Callable, Union | |
| import pydantic_core | |
| import pytest | |
| from inline_snapshot import snapshot | |
| from pydantic import BaseModel, Field | |
| from pydantic_core import PydanticSerializationError |