360 Secure SkillHub
360 安全技能中心

MLOps Validation CN

提供 pre-commit 钩子与 pytest 共享夹具的复制和运行说明,覆盖 Ruff、MyPy、Bandit 与 pytest 覆盖率命令,用于在 Python 项目中建立自动化质量与安全检查。

guohongbin-git
guohongbin-git
热度 61.63
最近更新 2026-05-11 17:26:18
分类:开发依赖:代码执行 / 读写文件应用场景:代码审查 / DevOps / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add mlops-validation-cn
Metadata
name
mlops-validation-cn
version
1.0.0
description
Rigorous validation with typing, linting, testing, and security
license
MIT

MLOps Validation ✅

Automated quality and security checks.

Features

1. Pre-commit Hooks 🔧

Setup automated checks:

cp references/pre-commit-config.yaml ../your-project/.pre-commit-config.yaml
cd ../your-project
pre-commit install

Runs on every commit:

  • Ruff (linting + formatting)
  • MyPy (type checking)
  • Bandit (security)

2. Test Fixtures 🧪

Shared pytest setup:

cp references/conftest.py ../your-project/tests/

Provides fixtures:

  • sample_df - Test dataframe
  • temp_dir - Temporary directory
  • sample_config - Config dict
  • train_test_split - Pre-split data

Quick Start

# Copy pre-commit config
cp references/pre-commit-config.yaml ./.pre-commit-config.yaml

# Install hooks
pre-commit install

# Run manually
pre-commit run --all-files

# Setup test fixtures
cp references/conftest.py tests/

# Run tests
pytest tests/ -v --cov=src

Commands

# Type check
mypy src/

# Lint
ruff check src/ tests/

# Format
ruff format src/ tests/

# Test
pytest tests/ --cov=src

# Security scan
bandit -r src/

Author

Converted from MLOps Coding Course

Changelog

v1.0.0 (2026-02-18)

  • Initial OpenClaw conversion
  • Added pre-commit config
  • Added test fixtures