Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLIVVS CodeWWindsurf+15 more

    Python Development Engine

    by Joker

    1

    Python project routing for Web API/crawler/automation/data/CLI. FastAPI/Django/Flask selection, async patterns, deployment strategies.

    Free

    1 installSecurity scanned

    See it in action

    You say

    Building a REST API that scrapes 10K product pages daily, processes data, and serves results. Should I use FastAPI or Django? Async or Celery?

    Your agent does

    Tech Stack Decision: Scraping + API Service

    Project Profile

    • Type: Data pipeline + Web API
    • Scale: 10K pages/day (~7/minute avg, 50/minute peak)
    • Output: REST API serving processed results

    Framework: FastAPI ✅

    | Factor | FastAPI | Django | |--------|---------|--------| | Async support | Native | Requires ASGI + DRF | | Scraping integration | Direct asyncio | Needs Celery bridge | | Performance | 2-3x faster for I/O-heavy | Overhead for ORM | | Setup speed | 1 day | 2-3 days |

    Concurrency: asyncio + Background Tasks ✅

    • 10K pages/day doesn't need Celery complexity
    • FastAPI BackgroundTasks for scheduled scraping
    • asyncio + aiohttp for concurrent page fetching
    • Only add Celery if you need: retries, monitoring, multi-worker queues

    Architecture

    FastAPI app
    ├── /api/* (endpoints)
    ├── BackgroundTasks (daily scrape scheduler)
    ├── Scraper module (asyncio + aiohttp)
    ├── Processing pipeline (Pandas/Polars)
    └── SQLite → PostgreSQL (when concurrent users > 50)
    

    Don't Over-Engineer

    Start with: FastAPI + asyncio + SQLite. Add Celery/Redis/PostgreSQL only when you hit actual bottlenecks.

    About this skill

    Python开发决策引擎

    专家级决策系统——不是教Python语法,而是在框架选型、并发模型、爬虫架构、部署策略这些关键岔路做对选择。


    目录

    1. 项目类型路由器
    2. 框架决策树
    3. 异步方案决策
    4. 爬虫架构决策
    5. 数据工具链
    6. CLI工具开发
    7. 部署决策
    8. 2026年趋势
    9. 质量门控三级清单
    10. 10个常见错误模式
    11. 执行流程

    1. 项目类型路由器

    输入: 项目需求 → 输出: 框架+并发模型+部署方案+数据库选择
    
    决策流程:
      │
      ├─ 是Web API/微服务吗?
      │   ├─ Yes → FastAPI + asyncio + Docker + PostgreSQL
      │   └─ No
      │
      ├─ 需要Admin后台/用户系统/认证吗?
      │   ├─ Yes → Django 5.x + WSGI/ASGI + Docker + MySQL/PostgreSQL
      │   └─ No
      │
      ├─ 是爬虫项目吗?
      │   ├─ 静态页面 + 大规模 → Scrapy + asyncio + Redis队列 + 代理池
      │   ├─ 动态页面/JS渲染 → Playwright + asyncio + IP轮换
      │   └─ 快速原型 → requests + BeautifulSoup
      │
      ├─ 是数据处理/ETL吗?
      │   ├─ <1GB数据 → Polars + Pandas
      │   ├─ 1-10GB数据 → Polars + DuckDB
      │   └─ >10GB数据 → DuckDB + 分区 + 流式处理
      │
      ├─ 是自动化脚本吗?
      │   └─ Typer/Click + subprocess + cron + 日志
      │
      ├─ 是CLI工具吗?
      │   ├─ 分发简单 → Typer + Rich + PyInstaller
      │   └─ 性能敏感 → Typer + Rich + Nuitka编译
      │
      └─ 是AI/ML推理服务吗?
          └─ FastAPI + ONNX Runtime + Docker GPU + 批处理
    

    1.1 Web API完整决策矩阵

    | 需求维度 | 轻量API | 中型API | 企业级API | 性能敏感型 | |----------|---------|---------|-----------|-----------| | 推荐框架 | FastAPI | FastAPI | FastAPI/Django | FastAPI + uvicorn | | ORM | SQLAlchemy | SQLAlchemy | SQLAlchemy/Django ORM | asyncpg + SQLAlchemy | | 缓存 | 内存Cache | Redis | Redis + 分布式 | Redis Cluster | | 认证 | API Key | JWT | OAuth2 + SSO | JWT + Refresh Token | | 文档 | OpenAPI自动 | OpenAPI自动 | OpenAPI + Swagger | OpenAPI + ReDoc | | 测试 | pytest + httpx | pytest + coverage | pytest + CI | pytest + loadtest | | 部署 | Docker单实例 | Docker + Load Balancer | K8s + HPA | K8s + HPA + 监控 | | 数据库 | SQLite/PostgreSQL | PostgreSQL | PostgreSQL + 读写分离 | PostgreSQL + 连接池 | | 日日夜夜 | 日志 | 结构化日志 | 结构化日志 + ELK | 结构化日志 + 链路追踪 |

    1.2 爬虫项目决策矩阵

    | 维度 | 快速原型 | 中等规模 | 大规模分布式 | 企业级 | |------|---------|---------|-------------|--------| | 爬取量/天 | <1000 | 1000-10万 | 10万-1000万 | >1000万 | | 页面类型 | 静态 | 静态+简单JS | 混合 | 混合+反爬 | | 技术栈 | requests+BS4 | Scrapy | Scrapy+Redis | Playwright集群 | | 存储 | CSV/JSON | PostgreSQL | PostgreSQL+MongoDB | 数据湖 | | 代理需求 | 无 | 少量代理 | 代理池 | 代理池+轮换策略 | | 失败重试 | 简单重试 | 指数退避 | 队列重试 | 智能重试 | | 调度 | 单机 | 单机+多线程 | Redis队列 | 分布式调度 | | 监控 | 手动 | 日志 | Prometheus | Grafana看板 |

    1.3 数据处理项目决策矩阵

    | 数据规模 | <100MB | 100MB-1GB | 1GB-10GB | >10GB | |----------|--------|-----------|---------|-------| | 推荐工具 | Pandas | Polars | Polars + DuckDB | DuckDB | | 处理模式 | 全量加载 | 全量/分块 | 分块/流式 | 流式/分区 | | 并行处理 | 单线程 | 单/多线程 | 多进程 | 多进程+分布式 | | 内存需求 | <2GB | 2-8GB | 8-32GB | 可溢出磁盘 | | SQL支持 | 无 | 有限 | 良好 | 完整SQL | | 生态集成 | 丰富 | 成长中 | 良好 | 良好 | | 学习曲线 | 低 | 中 | 中 | 中高 |

    1.4 CLI工具决策矩阵

    | 场景 | 简单脚本 | 内部工具 | 分发工具 | 企业级CLI | |------|---------|---------|---------|-----------| | 用户 | 开发者自己 | 团队成员 | 外部用户 | 客户/运维 | | 框架 | argparse | Typer/Click | Typer + Rich | Typer + Rich + 测试 | | 输出美化 | print | Rich | Rich | Rich + 进度条 | | 打包 | 直接运行 | PyInstaller | PyInstaller/nuitka | pip install / conda | | 自动补全 | 无 | bash/zsh | fish/zsh | 全平台 | | 文档 | README | README + --help | Sphinx/MkDocs | 完整文档站 | | 版本管理 | 无 | 简单 | semver | click-replace | | 错误处理 | sys.exit | Rich traceback | Rich traceback | 国际化错误 |

    1.5 技术栈推荐速查表

    # Web API 技术栈推荐
    WEB_API_STACK = {
        "fast": {
            "framework": "FastAPI",
            "orm": "SQLAlchemy[asyncio] + asyncpg",
            "cache": "Redis",
            "auth": "python-jose + passlib",
            "docs": "OpenAPI (auto)",
            "test": "pytest + httpx + pytest-asyncio",
            "deploy": "uvicorn (ASGI)"
        },
        "full": {
            "framework": "Django 5.x + Django REST Framework",
            "orm": "Django ORM",
            "cache": "Redis + django-redis",
            "auth": "django-allauth / JWT",
            "docs": "drf-spectacular (OpenAPI)",
            "test": "pytest-django",
            "deploy": "gunicorn (WSGI)"
        },
        "light": {
            "framework": "Flask",
            "orm": "SQLAlchemy",
            "cache": "Flask-Caching",
            "auth": "Flask-JWT-Extended",
            "docs": "flask-restx",
            "test": "pytest + Flask-Testing",
            "deploy": "gunicorn"
        }
    }
    
    # 爬虫技术栈推荐
    CRAWLER_STACK = {
        "simple": {
            "framework": "requests + BeautifulSoup",
            "parser": "lxml",
            "storage": "CSV/JSON",
            "concurrent": "concurrent.futures"
        },
        "medium": {
            "framework": "Scrapy",
            "parser": "parsel (内置)",
            "storage": "PostgreSQL/MongoDB",
            "concurrent": "asyncio + scrapy-asyncio"
        },
        "complex": {
            "framework": "Playwright + Scrapy",
            "parser": "parsel + JS执行",
            "storage": "PostgreSQL + S3",
            "concurrent": "asyncio + 进程池",
            "proxy": "代理池 + 轮换",
            "anti_detection": "stealth插件"
        }
    }
    
    # 数据处理技术栈推荐
    DATA_STACK = {
        "small": {
            "main": "pandas",
         
    

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    1 install

    Downloaded by developers to date

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean 1 month ago

    • Free forever, no account required

    Installs1
    Listed1 month ago

    Creator

    Frequently Asked Questions

    Popular in API Development

    Free