Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

python-containersPython containers 搜索

Agent Skill

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

总安装

1,544

周安装

65

GitHub Stars

28

下载量

541
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:python-containers(Python containers 搜索)
来源仓库:https://github.com/laurigates/claude-plugins
仓库路径:skills/python-containers
安装命令:
npx skills add https://github.com/laurigates/claude-plugins --skill python-containers
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/laurigates/claude-plugins --skill python-containers

简介

探索 Python 容器化部署的最佳实践与镜像构建。

  • 优化 Dockerfile 结构和依赖分层策略。
  • 减少镜像体积并提升启动速度。python-containers 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 安装方式:从 claude-plugins 项目获取容器化技能集。
  • 生产镜像应基于最小化基础镜像以减少攻击面。

SKILL.md

Python Container Optimization

Expert knowledge for building optimized Python container images using slim base images, virtual environments, modern package managers (uv, poetry), and multi-stage build patterns.

When to Use This Skill

Use this skill when...Use container-development instead when...
Building Python-specific DockerfilesGeneral multi-stage build patterns
Optimizing Python image sizesLanguage-agnostic container security
Handling pip/poetry/uv in containersDocker Compose configuration
Dealing with musl/glibc issuesNon-Python container optimization

Core Expertise

Python Container Challenges:

  • Large base images with unnecessary packages (~1GB)
  • Critical: Alpine causes issues with Python (musl vs glibc)
  • Complex dependency management (pip, poetry, pipenv, uv)
  • Compiled C extensions requiring build tools
  • Virtual environment handling in containers

Key Capabilities:

  • Slim-based images (NOT Alpine for Python)
  • Multi-stage builds with modern tools (uv recommended)
  • Virtual environment optimization
  • Compiled extension handling
  • Non-root user configuration

Why NOT Alpine for Python

Use slim instead of Alpine for Python containers. Alpine uses musl libc which causes:

  • Many wheels don't work (numpy, pandas, scipy)
  • Forces compilation from source (slow builds)
  • Larger final images due to build tools
  • Runtime errors with native extensions

Optimized Dockerfile Pattern (uv)

The recommended pattern achieves ~80-120MB images:

# Build stage
FROM python:3.11-slim AS builder
WORKDIR /app

RUN pip install --no-cache-dir uv

# Copy dependency files
COPY pyproject.toml uv.lock ./

# Install dependencies with uv (much faster than pip)
RUN uv sync --frozen --no-dev

COPY . .

# Runtime stage
FROM python:3.11-slim
WORKDIR /app

# Install only runtime dependencies (if needed)
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    libpq5 \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN addgroup --gid 1001 appgroup && \
    adduser --uid 1001 --gid 1001 --disabled-password appuser

# Copy only what's needed
COPY --from=builder --chown=appuser:appgroup /app/.venv /app/.venv
COPY --chown=appuser:appgroup app/ /app/app/
COPY --chown=appuser:appgroup pyproject.toml /app/

ENV PATH="/app/.venv/bin:$PATH" \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

USER appuser
EXPOSE 8000

HEALTHCHECK --interval=30s CMD python -c "import requests; requests.get('http://localhost:8000/health')" || exit 1

CMD ["python", "-m", "app"]

Package Manager Summary

ManagerSpeedCommandNotes
uv10-100x fasteruv sync --frozen --no-devRecommended
poetryStandardpoetry install --only=mainSet POETRY_VIRTUALENVS_IN_PROJECT=1
pipStandardpip install --no-cache-dir --prefix=/install -r requirements.txtUse --prefix for multi-stage

Performance Impact

MetricFull (1GB)Slim (400MB)Multi-Stage (150MB)Optimized (100MB)
Image Size1GB400MB150MB100MB
Pull Time4m1m 30s35s20s
Build Time (pip)5m4m3m3m
Build Time (uv)--45s30s
Memory Usage600MB350MB200MB150MB

Security Impact

Image TypeVulnerabilitiesSizeRisk
python:3.11 (full)50-70 CVEs1GBHigh
python:3.11-slim12-18 CVEs400MBMedium
Multi-stage slim8-12 CVEs150MBLow
Distroless Python4-6 CVEs140MBVery Low

Agentic Optimizations

ContextCommandPurpose
Quick buildDOCKER_BUILDKIT=1 docker build -t app.Fast build with cache
Size checkdocker images app --format "table {{.Repository}}\t{{.Size}}"Check image size
Layer analysis`docker history app:latest --human \head -20`Find large layers
Test importsdocker run --rm app python -c "import app"Verify imports work
Dependency listdocker run --rm app pip list --format=freezeSee installed packages
Security scandocker run --rm app pip-auditCheck for vulnerabilities

Best Practices

  • Use slim NOT alpine for Python
  • Use uv for fastest builds (10-100x faster than pip)
  • Use multi-stage builds
  • Set PYTHONUNBUFFERED=1 and PYTHONDONTWRITEBYTECODE=1
  • Run as non-root user
  • Use virtual environments and pin dependencies with lock files
  • Use --no-cache-dir with pip

For detailed examples, advanced patterns, and best practices, see REFERENCE.md.

Related Skills

  • container-development - General container patterns, multi-stage builds, security
  • go-containers - Go-specific container optimizations
  • nodejs-containers - Node.js-specific container optimizations

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.18%
按下载量换算201

Claude

28.08%
按下载量换算152

Cursor

18.68%
按下载量换算101

Gemini CLI

10.41%
按下载量换算56

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills