A professional tool for auditing NVIDIA NIM containers
Project description
nim-audit
Stop deploying NIM containers blind.
A professional CLI tool for auditing NVIDIA NIM containers before they hit production.
Installation โข Quick Start โข Commands โข User Guide
Why nim-audit?
Ever upgraded a NIM container and had everything crash 10 minutes later?
nim-audit catches what humans miss:
- ๐ Breaking changes between container versions
- ๐ฎ GPU compatibility issues before deployment
- โ๏ธ Environment variable risks and impacts
- ๐ Policy violations that slip through review
- ๐ Behavioral drift between model versions
One command before every upgrade. Never be surprised again.
Installation
pip install nim-audit
Requirements: Python 3.11+
For development:
git clone https://github.com/ashzak/nim-audit.git
cd nim-audit
pip install -e ".[dev]"
Quick Start
Compare versions before upgrading
nim-audit diff nvcr.io/nim/llama3:1.0.0 nvcr.io/nim/llama3:1.1.0
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโ Diff Report โโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Source: nvcr.io/nim/llama3:1.0.0 โ
โ Target: nvcr.io/nim/llama3:1.1.0 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โ ๏ธ Breaking Changes Detected
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โข API: /v1/completions response schema changed
โข Config: NIM_MAX_BATCH_SIZE default: 4 โ 8
โข Requirement: Min GPU memory increased to 24GB
Check GPU compatibility
nim-audit compat --image nvcr.io/nim/llama3:1.1.0 --gpu A10
โญโโโโโโโโโโโโโโโโโโโโโโโ Compatibility Report โโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Image: nvcr.io/nim/llama3:1.1.0 โ
โ Status: โ
COMPATIBLE โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Lint your environment file
nim-audit env lint --env-file production.env
โญโโโโโโโโโโโโโโโโโโโโโ Environment Lint Report โโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Status: โ ๏ธ WARN โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โ Severity โ Variable โ Message โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ WARN โ NIM_MAX_BATCH_SIZE โ Registry marks as increasing memory โ
Commands
| Command | Description |
|---|---|
diff |
Compare two NIM versions, detect breaking changes |
config |
Analyze configuration with impact assessment |
compat |
Check GPU and driver compatibility |
lint |
Validate against enterprise policies |
fingerprint |
Compare runtime behavioral signatures |
cluster |
Scan Kubernetes cluster compatibility |
env |
Environment variable analysis suite |
diff
Compare two NIM container versions:
# Basic diff
nim-audit diff old:tag new:tag
# Only breaking changes
nim-audit diff old:tag new:tag --breaking-only
# JSON output for CI/CD
nim-audit diff old:tag new:tag --format json --output report.json
# Filter by category
nim-audit diff old:tag new:tag --category api
Categories: metadata, model, tokenizer, api, runtime, layer, config, environment
config
Analyze NIM configuration and environment variables:
# Analyze image configuration
nim-audit config --image nvcr.io/nim/llama3:1.1.0
# With your env file
nim-audit config --image nvcr.io/nim/llama3:1.1.0 --env-file prod.env
# Validate configuration
nim-audit config --image nvcr.io/nim/llama3:1.1.0 --env-file prod.env --validate
# Show all options including defaults
nim-audit config --image nvcr.io/nim/llama3:1.1.0 --all
compat
Check GPU and driver compatibility:
# Check specific GPU
nim-audit compat --image nvcr.io/nim/llama3:1.1.0 --gpu A100
# With driver version
nim-audit compat --image nvcr.io/nim/llama3:1.1.0 --gpu A10 --driver 535.104.05
# Auto-detect local GPU
nim-audit compat --image nvcr.io/nim/llama3:1.1.0 --detect
Supported GPUs: A10, A100, H100, L4, L40, L40S, T4, V100, A6000, RTX 4090, RTX 6000
lint
Validate containers against policies:
# Lint with built-in rules
nim-audit lint --image nvcr.io/nim/llama3:1.1.0
# Custom enterprise policy
nim-audit lint --image nvcr.io/nim/llama3:1.1.0 --policy enterprise.yaml
# Only show errors
nim-audit lint --image nvcr.io/nim/llama3:1.1.0 --severity error
Built-in rules:
nim-001: Require version labelnim-002: No root usernim-003: Require model namenim-004: Check exposed portsnim-005: No sensitive environment variables
Custom Policy Example
name: enterprise-policy
version: "1.0.0"
rules:
- id: ent-001
name: require-security-scan
description: Image must have security scan label
severity: error
condition: labels['security.scan.status'] == 'passed'
remediation: Run security scan and add label
- id: ent-002
name: max-batch-size
description: Batch size must not exceed 64
severity: warning
condition: int(env.get('NIM_MAX_BATCH_SIZE', '1')) <= 64
fingerprint
Generate and compare behavioral signatures:
# Generate fingerprint from running container
nim-audit fingerprint --image nvcr.io/nim/llama3:1.0.0 \
--endpoint http://localhost:8000 \
--output v1.0.0.json
# Compare two fingerprints
nim-audit fingerprint compare v1.0.0.json v1.1.0.json --tolerance 0.05
cluster
Scan Kubernetes cluster for NIM compatibility:
# Scan cluster
nim-audit cluster --image nvcr.io/nim/llama3:1.1.0
# Specific context
nim-audit cluster --image nvcr.io/nim/llama3:1.1.0 --context production
env
Environment variable analysis tools:
# Lint environment file
nim-audit env lint --env-file prod.env
# Describe a variable
nim-audit env describe NIM_MAX_BATCH_SIZE
# Diff two env files
nim-audit env diff staging.env production.env
# List all known variables
nim-audit env registry-list
Library API
Use nim-audit programmatically:
from nim_audit import NIMImage, DiffEngine, ConfigAnalyzer, CompatChecker
# Load images
img1 = NIMImage.from_local("nvcr.io/nim/llama3:1.0.0")
img2 = NIMImage.from_local("nvcr.io/nim/llama3:1.1.0")
# Diff
engine = DiffEngine()
result = engine.diff(img1, img2)
for bc in result.report.breaking_changes:
print(f"Breaking: {bc.title}")
# Config analysis
analyzer = ConfigAnalyzer()
result = analyzer.analyze(img2, env={"NIM_MAX_BATCH_SIZE": "64"})
for entry in result.report.entries:
print(f"{entry.name}: {entry.impact.level}")
# Compatibility
checker = CompatChecker()
result = checker.check(img2, gpu="A100")
print(f"Compatible: {result.report.compatible}")
CI/CD Integration
Add nim-audit to your pipeline:
# .github/workflows/nim-validate.yml
name: NIM Validation
on:
pull_request:
paths:
- 'k8s/nim/*.yaml'
- '.env.nim'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install nim-audit
run: pip install nim-audit
- name: Lint environment
run: nim-audit env lint --env-file .env.nim
- name: Check compatibility
run: nim-audit compat --image ${{ vars.NIM_IMAGE }} --gpu A100
- name: Policy check
run: nim-audit lint --image ${{ vars.NIM_IMAGE }} --policy policies/enterprise.yaml
Configuration
Create ~/.nim-audit.yaml:
cache:
enabled: true
ttl: 3600
registry:
ngc_api_key: ${NGC_API_KEY}
output:
default_format: terminal
color: true
lint:
include_builtin: true
fail_on_warning: false
# Shortcuts for common images
aliases:
llama3: nvcr.io/nim/meta/llama3-8b-instruct:latest
llama3-70b: nvcr.io/nim/meta/llama3-70b-instruct:latest
Environment Variables:
NGC_API_KEY: NVIDIA NGC API keyNIM_AUDIT_CONFIG: Config file overrideNIM_AUDIT_NO_COLOR: Disable colors
Documentation
- User Guide - Comprehensive usage documentation
- CLI Reference - All commands and options
Architecture
nim-audit/
โโโ src/nim_audit/
โ โโโ cli/ # CLI commands (Typer)
โ โโโ core/ # Core domain logic
โ โ โโโ env/ # Environment analysis
โ โโโ extractors/ # Artifact extractors
โ โโโ registry/ # Container registry clients
โ โโโ renderers/ # Output formatters
โ โโโ models/ # Pydantic data models
โ โโโ knowledge/ # NIM knowledge base
โ โโโ utils/ # Utilities
โโโ tests/
โโโ unit/ # Unit tests
โโโ integration/ # Integration tests
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing) - Make your changes
- Run tests (
pytest) - Submit a pull request
License
MIT - Use it however you want.
Built to prevent production incidents.
Star โญ if this saved you from a 3am page.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nim_audit-0.1.0.tar.gz.
File metadata
- Download URL: nim_audit-0.1.0.tar.gz
- Upload date:
- Size: 114.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a561855962ea11f80bcc6f20c290ec8370c196050be558e4b9075ce0e521efcb
|
|
| MD5 |
da954e51de5c41ea9b5e7a11f0874561
|
|
| BLAKE2b-256 |
9a6e62c5817c390310fe710e656b32cf71e64e66bb4e967230b83f5fef073f07
|
File details
Details for the file nim_audit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nim_audit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 124.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2c69cf74c9afcca1f7d95411a53e1307e7ec19ec0a948838c52018e29229893
|
|
| MD5 |
a0ac9ce987dfd44d61de2a067c387b19
|
|
| BLAKE2b-256 |
b1912870c301b0e6be0e0a2d0537cd985d4d06133b8a9c6d498cff1e2f0f2beb
|