uv-ci-cd-integration
Set up uv (Rust-based Python package manager) in CI/CD pipelines. Use when configuring GitHub Actions workflows, GitLab CI/CD, Docker builds, or matrix testing across Python versions. Includes patterns for cache optimization, frozen lockfiles, multi-stage builds, and PyPI publishing with trusted publishing. Covers GitHub Actions setup-uv action, Docker multi-stage production/development builds, and deployment patterns.
What this skill does
# uv CI/CD Integration Skill
## Purpose
This skill helps integrate **uv** (the fast Rust-based Python package manager) into CI/CD pipelines and containerized deployments. It provides proven patterns for GitHub Actions, GitLab CI, Docker, and PyPI publishing that optimize for performance, reliability, and maintainability.
## Quick Start
**GitHub Actions (basic CI workflow):**
```bash
# Create .github/workflows/ci.yml
curl -s https://docs.astral.sh/uv/guides/integration/github/ | grep -A 30 "name: CI" > temp.yaml
```
**Docker (production build):**
```dockerfile
FROM python:3.12-slim AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
FROM python:3.12-slim
COPY --from=builder /app/.venv /app/.venv
COPY . .
ENV PATH="/app/.venv/bin:$PATH"
CMD ["python", "-m", "myapp"]
```
**GitLab CI (basic pipeline):**
```bash
# Install uv in before_script, sync dependencies, run tests
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync --all-extras --dev
uv run pytest
```
## Instructions
### Step 1: Choose Your CI/CD Platform
Identify where your code is deployed:
1. **GitHub Actions** - Recommended for GitHub repositories (native support, `setup-uv` action)
2. **GitLab CI** - For GitLab instances (self-hosted or cloud)
3. **Docker** - For containerized deployments (multi-stage builds for optimization)
4. **Other** - Jenkins, Cirrus CI, GitHub Enterprise (manual setup required)
For each platform, you'll set up uv installation, dependency caching, and frozen lockfile enforcement.
### Step 2: Set Up Dependency Caching
**Why:** Cache shared across workflow runs dramatically reduces CI time (10-100x faster warm starts).
**GitHub Actions with setup-uv action:**
```yaml
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.8" # Optional: pin specific version
enable-cache: true # Enable dependency caching
cache-dependency-glob: "uv.lock" # Track changes to this file
```
**GitLab CI with custom cache:**
```yaml
variables:
UV_CACHE_DIR: .uv-cache
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .uv-cache
```
**Docker (layer caching):**
```dockerfile
# Layer caching: Only rebuild if pyproject.toml or uv.lock changes
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
```
### Step 3: Configure Matrix Testing (Multiple Python Versions)
**Why:** Test against multiple Python versions to ensure compatibility.
**GitHub Actions with matrix:**
```yaml
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: astral-sh/setup-uv@v6
- run: uv python install ${{ matrix.python-version }}
env:
UV_PYTHON: ${{ matrix.python-version }}
- run: uv sync --all-extras --dev
- run: uv run pytest
```
**GitLab CI with parallel jobs:**
```yaml
test:3.11:
image: python:3.11
script:
- curl -LsSf https://astral.sh/uv/install.sh | sh
- uv sync --all-extras --dev
- uv run pytest
test:3.12:
image: python:3.12
script:
- curl -LsSf https://astral.sh/uv/install.sh | sh
- uv sync --all-extras --dev
- uv run pytest
```
### Step 4: Use Frozen Lockfiles in Production
**Why:** Frozen lockfiles ensure exact reproducibility - prevents unexpected updates.
**Command pattern:**
```bash
# Fails if lockfile is out of sync with pyproject.toml
uv sync --frozen --no-dev
# For development environments (interactive)
uv sync --all-extras --dev
```
**Docker production:** Always use `--frozen` flag
```dockerfile
RUN uv sync --frozen --no-dev --no-install-project
```
**GitHub Actions CI:**
```yaml
- name: Sync with frozen lockfile
run: uv sync --frozen --all-extras --dev
```
Commit `uv.lock` to version control. Update it with `uv lock --upgrade` when ready.
### Step 5: Implement Production Deployment Patterns
**Multi-stage Docker build (recommended for size/security):**
```dockerfile
# Stage 1: Builder - compile dependencies
FROM python:3.12-slim AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
# Stage 2: Runtime - minimal image with only .venv
FROM python:3.12-slim
WORKDIR /app
COPY --from=builder /app/.venv /app/.venv
# Copy application code
COPY . .
# Ensure virtual environment is in PATH
ENV PATH="/app/.venv/bin:$PATH"
# Run application
CMD ["python", "-m", "myapp"]
```
**Benefits:**
- Final image ~70% smaller (builder dependencies not included)
- Faster deployments and reduced bandwidth
- Improved security (build tools not in production)
### Step 6: Set Up PyPI Publishing with Trusted Publishing
**Why:** Trusted publishing (OIDC) is more secure than static tokens. No need to manage secrets.
**GitHub Actions workflow:**
```yaml
name: Publish
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC/trusted publishing
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Build distributions
run: uv build
- name: Publish to PyPI
run: uv publish
# No credentials needed - uses OIDC tokens
```
**Setup in PyPI (one-time):**
1. Go to https://pypi.org/manage/account/
2. Add "Trusted Publisher" for your GitHub repository
3. Set trusted publisher to your GitHub organization/repository + workflow name
**For custom index/private PyPI:**
```yaml
- name: Publish to custom index
run: uv publish --index-url https://example.org/pypi
env:
UV_PUBLISH_TOKEN: ${{ secrets.CUSTOM_PYPI_TOKEN }}
```
## Examples
### Example 1: Complete GitHub Actions CI Workflow
See `examples/github-actions-complete.yml` for a production-ready workflow including:
- uv installation with caching
- Multiple Python version matrix
- Linting, type checking, testing
- Coverage reporting
- Dependency vulnerability scanning
### Example 2: Docker Development Environment
See `examples/dockerfile-development` for a development-optimized Dockerfile that includes:
- uv installation with all dev dependencies
- Source code mounting for hot reload
- All development tools (linters, type checkers, test frameworks)
### Example 3: GitLab CI Pipeline Configuration
See `examples/gitlab-ci-complete.yml` for a complete GitLab CI setup including:
- Matrix testing across Python versions
- Parallel jobs for linting and testing
- Cache optimization
- Test coverage artifacts
### Example 4: PyPI Publishing Workflow
See `examples/pypi-publishing-workflow.yml` for:
- Trusted publishing (OIDC) setup
- Automated versioning from git tags
- Publication to both PyPI and test PyPI
- Release notes generation
## Requirements
### System Requirements
- **Git repository**: GitHub, GitLab, or another CI/CD platform
- **uv available**: Version 0.9.0 or later (action/installation script ensures this)
- **Docker** (if using container deployments): Docker 20.10+ for multi-stage builds
- **lockfile**: `uv.lock` must be committed to version control
### Credentials (Optional)
- **PyPI Token** (only for legacy token auth): Create at https://pypi.org/manage/account/publishing/
- Better approach: Use trusted publishing (OIDC) - no credentials needed
- **Private PyPI credentials** (if using custom index): Configure via environment variables or keyring
### Python Versions
- **Tested**: Python 3.11, 3.12, 3.13
- **Minimum**: Python 3.9 (for uv itself), but recommend 3.11+
- **Pin in `.python-version`**: Create with `uv python pin 3.12`
## See Also
- [examples/github-actions-complete.yml](./examples/github-actions-complete.yml) - Full CI workflow with all features
- [examples/dockerfile-development](./examples/dockerfile-development) - Development container setup
- [examples/gitlab-ci-complete.yml](./examples/gitlab-ci-complete.yml) - GitLab CI pipeline
- [examples/pypi-publishing-workflow.yml]Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.