mirror of
https://github.com/Wan-Video/Wan2.1.git
synced 2025-12-15 19:53:22 +00:00
ci: add GitHub Actions CI/CD pipeline and pre-commit hooks
Implements automated testing, code quality checks, and dependency management for continuous integration and deployment. GitHub Actions Workflows: - Code quality & linting (YAPF, Black, isort, mypy) - CPU-based unit tests for Python 3.10 and 3.11 - Security scanning (safety, bandit) - Package building and validation - Documentation building Pre-commit Hooks: - File checks (trailing whitespace, EOF, YAML/JSON validation) - Code formatting (YAPF, Black) - Import sorting (isort) - Linting (flake8) - Type checking (mypy) - Security checks (bandit) - Docstring coverage (interrogate) - Markdown linting Dependabot Configuration: - Weekly dependency updates for Python packages - Grouped updates for related ecosystems (PyTorch, Transformers) - Automatic PR creation with labels and reviewers - Security-focused update strategy Type Checking: - mypy.ini with gradual typing configuration - External dependency stub configuration - Per-module strictness levels Files Added: - .github/workflows/ci.yml - CI/CD pipeline - .github/dependabot.yml - Dependency updates - .github/pull_request_template.md - PR template - .github/ISSUE_TEMPLATE/bug_report.yml - Bug report template - .github/ISSUE_TEMPLATE/feature_request.yml - Feature request template - .pre-commit-config.yaml - Pre-commit hooks - mypy.ini - Type checking configuration Benefits: - Automated code quality enforcement - Early detection of bugs and security issues - Consistent code style across contributors - Reduced manual review burden
This commit is contained in:
parent
67f00b6f47
commit
59d86dfe65
163
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
163
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
name: Bug Report
|
||||
description: File a bug report to help us improve
|
||||
title: "[Bug]: "
|
||||
labels: ["bug", "needs-triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report! Please provide as much detail as possible.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Bug Description
|
||||
description: A clear and concise description of the bug
|
||||
placeholder: What went wrong?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: Steps to reproduce the behavior
|
||||
placeholder: |
|
||||
1. Load model with '...'
|
||||
2. Run inference with '...'
|
||||
3. See error
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: What you expected to happen
|
||||
placeholder: What should have happened?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual
|
||||
attributes:
|
||||
label: Actual Behavior
|
||||
description: What actually happened
|
||||
placeholder: What actually happened?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Error Logs
|
||||
description: Please copy and paste any relevant error messages or logs
|
||||
render: shell
|
||||
|
||||
- type: dropdown
|
||||
id: pipeline
|
||||
attributes:
|
||||
label: Pipeline
|
||||
description: Which pipeline are you using?
|
||||
options:
|
||||
- Text-to-Video (T2V)
|
||||
- Image-to-Video (I2V)
|
||||
- First-Last-Frame-to-Video (FLF2V)
|
||||
- VACE (Video Creation & Editing)
|
||||
- Text-to-Image (T2I)
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Wan2.1 Version
|
||||
description: What version of Wan2.1 are you using?
|
||||
placeholder: "2.1.0"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: model-size
|
||||
attributes:
|
||||
label: Model Size
|
||||
description: Which model size are you using?
|
||||
options:
|
||||
- 14B
|
||||
- 1.3B
|
||||
- Not applicable
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: python-version
|
||||
attributes:
|
||||
label: Python Version
|
||||
description: What version of Python are you using?
|
||||
placeholder: "3.10.0"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: pytorch-version
|
||||
attributes:
|
||||
label: PyTorch Version
|
||||
description: What version of PyTorch are you using?
|
||||
placeholder: "2.4.0"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: cuda-version
|
||||
attributes:
|
||||
label: CUDA Version
|
||||
description: What version of CUDA are you using? (or N/A for CPU)
|
||||
placeholder: "11.8"
|
||||
|
||||
- type: dropdown
|
||||
id: gpu
|
||||
attributes:
|
||||
label: GPU Type
|
||||
description: What GPU are you using?
|
||||
options:
|
||||
- NVIDIA A100
|
||||
- NVIDIA V100
|
||||
- NVIDIA RTX 4090
|
||||
- NVIDIA RTX 3090
|
||||
- NVIDIA RTX 3080
|
||||
- Other NVIDIA GPU
|
||||
- AMD GPU
|
||||
- CPU only
|
||||
- Other
|
||||
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment Details
|
||||
description: Any additional environment details
|
||||
placeholder: |
|
||||
- OS: Ubuntu 22.04
|
||||
- RAM: 64GB
|
||||
- Number of GPUs: 2
|
||||
- Other relevant details
|
||||
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Add any other context about the problem here
|
||||
placeholder: Screenshots, videos, or additional information
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Checklist
|
||||
description: Please confirm the following
|
||||
options:
|
||||
- label: I have searched existing issues to ensure this is not a duplicate
|
||||
required: true
|
||||
- label: I have provided all required information
|
||||
required: true
|
||||
- label: I have included error logs (if applicable)
|
||||
required: false
|
||||
118
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
118
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
name: Feature Request
|
||||
description: Suggest a new feature or enhancement
|
||||
title: "[Feature]: "
|
||||
labels: ["enhancement", "needs-triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for suggesting a feature! Please provide as much detail as possible to help us understand your request.
|
||||
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem Statement
|
||||
description: Is your feature request related to a problem? Please describe.
|
||||
placeholder: I'm frustrated when...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Proposed Solution
|
||||
description: Describe the solution you'd like
|
||||
placeholder: I would like to see...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives Considered
|
||||
description: Describe any alternative solutions or features you've considered
|
||||
placeholder: I also considered...
|
||||
|
||||
- type: dropdown
|
||||
id: feature-type
|
||||
attributes:
|
||||
label: Feature Type
|
||||
description: What type of feature is this?
|
||||
options:
|
||||
- New Pipeline/Model
|
||||
- Performance Improvement
|
||||
- API Enhancement
|
||||
- Documentation
|
||||
- Developer Experience
|
||||
- Infrastructure
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: priority
|
||||
attributes:
|
||||
label: Priority
|
||||
description: How important is this feature to you?
|
||||
options:
|
||||
- Critical - Blocking my work
|
||||
- High - Needed soon
|
||||
- Medium - Would be nice to have
|
||||
- Low - Nice to have eventually
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: use-case
|
||||
attributes:
|
||||
label: Use Case
|
||||
description: Describe your use case for this feature
|
||||
placeholder: |
|
||||
I want to use this feature to...
|
||||
This would help me...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: implementation
|
||||
attributes:
|
||||
label: Implementation Ideas
|
||||
description: If you have ideas about how to implement this, please share
|
||||
placeholder: |
|
||||
This could be implemented by...
|
||||
Potential challenges might include...
|
||||
|
||||
- type: textarea
|
||||
id: examples
|
||||
attributes:
|
||||
label: Examples
|
||||
description: Provide code examples or mockups of how this feature would work
|
||||
render: python
|
||||
|
||||
- type: checkboxes
|
||||
id: contribution
|
||||
attributes:
|
||||
label: Contribution
|
||||
description: Would you be willing to contribute to this feature?
|
||||
options:
|
||||
- label: I would like to implement this feature
|
||||
- label: I can help test this feature
|
||||
- label: I can help with documentation
|
||||
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Add any other context, screenshots, or examples
|
||||
placeholder: Links to similar features in other projects, mockups, etc.
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Checklist
|
||||
description: Please confirm the following
|
||||
options:
|
||||
- label: I have searched existing issues to ensure this is not a duplicate
|
||||
required: true
|
||||
- label: I have clearly described the problem and proposed solution
|
||||
required: true
|
||||
94
.github/dependabot.yml
vendored
Normal file
94
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
# Dependabot configuration for automated dependency updates
|
||||
# Documentation: https://docs.github.com/en/code-security/dependabot
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
# Python dependencies
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
time: "09:00"
|
||||
open-pull-requests-limit: 10
|
||||
reviewers:
|
||||
- "kuaishou/wan-maintainers" # Update with actual team
|
||||
assignees:
|
||||
- "kuaishou/wan-maintainers" # Update with actual team
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "python"
|
||||
commit-message:
|
||||
prefix: "deps"
|
||||
prefix-development: "deps-dev"
|
||||
include: "scope"
|
||||
# Group minor and patch updates together
|
||||
groups:
|
||||
pytorch-ecosystem:
|
||||
patterns:
|
||||
- "torch*"
|
||||
- "torchvision"
|
||||
update-types:
|
||||
- "minor"
|
||||
- "patch"
|
||||
transformers-ecosystem:
|
||||
patterns:
|
||||
- "transformers"
|
||||
- "diffusers"
|
||||
- "accelerate"
|
||||
update-types:
|
||||
- "minor"
|
||||
- "patch"
|
||||
dev-dependencies:
|
||||
dependency-type: "development"
|
||||
update-types:
|
||||
- "minor"
|
||||
- "patch"
|
||||
# Ignore specific dependencies that need manual updates
|
||||
ignore:
|
||||
# Flash attention requires specific CUDA versions
|
||||
- dependency-name: "flash-attn"
|
||||
update-types: ["version-update:semver-major"]
|
||||
# PyTorch major updates require testing
|
||||
- dependency-name: "torch"
|
||||
update-types: ["version-update:semver-major"]
|
||||
- dependency-name: "torchvision"
|
||||
update-types: ["version-update:semver-major"]
|
||||
# Allow specific versions
|
||||
allow:
|
||||
- dependency-type: "direct"
|
||||
- dependency-type: "production"
|
||||
- dependency-type: "development"
|
||||
|
||||
# GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
time: "09:00"
|
||||
open-pull-requests-limit: 5
|
||||
reviewers:
|
||||
- "kuaishou/wan-maintainers"
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "github-actions"
|
||||
commit-message:
|
||||
prefix: "ci"
|
||||
include: "scope"
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
update-types:
|
||||
- "minor"
|
||||
- "patch"
|
||||
|
||||
# Docker (if Dockerfile exists)
|
||||
# - package-ecosystem: "docker"
|
||||
# directory: "/"
|
||||
# schedule:
|
||||
# interval: "weekly"
|
||||
# labels:
|
||||
# - "dependencies"
|
||||
# - "docker"
|
||||
128
.github/pull_request_template.md
vendored
Normal file
128
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
## Description
|
||||
|
||||
<!-- Provide a brief description of the changes in this PR -->
|
||||
|
||||
## Type of Change
|
||||
|
||||
<!-- Mark the relevant option with an 'x' -->
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] Documentation update
|
||||
- [ ] Performance improvement
|
||||
- [ ] Code refactoring
|
||||
- [ ] Test addition/modification
|
||||
- [ ] CI/CD changes
|
||||
- [ ] Dependency update
|
||||
|
||||
## Related Issues
|
||||
|
||||
<!-- Link to related issues using #issue_number -->
|
||||
|
||||
Closes #
|
||||
Relates to #
|
||||
|
||||
## Changes Made
|
||||
|
||||
<!-- Provide a detailed list of changes -->
|
||||
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
## Testing
|
||||
|
||||
### Test Environment
|
||||
|
||||
- Python version:
|
||||
- PyTorch version:
|
||||
- CUDA version:
|
||||
- GPU type:
|
||||
- Number of GPUs:
|
||||
|
||||
### Testing Performed
|
||||
|
||||
<!-- Describe the tests you ran and their results -->
|
||||
|
||||
- [ ] All existing tests pass
|
||||
- [ ] Added new unit tests
|
||||
- [ ] Added new integration tests
|
||||
- [ ] Manual testing completed
|
||||
- [ ] Tested on CPU
|
||||
- [ ] Tested on GPU
|
||||
- [ ] Tested with 14B model
|
||||
- [ ] Tested with 1.3B model
|
||||
|
||||
### Test Results
|
||||
|
||||
<!-- Paste relevant test output -->
|
||||
|
||||
```
|
||||
pytest output here
|
||||
```
|
||||
|
||||
## Performance Impact
|
||||
|
||||
<!-- If applicable, describe any performance changes -->
|
||||
|
||||
- Inference speed:
|
||||
- Memory usage:
|
||||
- GPU utilization:
|
||||
|
||||
## Breaking Changes
|
||||
|
||||
<!-- If this is a breaking change, describe what breaks and migration steps -->
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
## Documentation
|
||||
|
||||
<!-- Mark the relevant options with an 'x' -->
|
||||
|
||||
- [ ] README.md updated
|
||||
- [ ] INSTALL.md updated
|
||||
- [ ] Code comments added/updated
|
||||
- [ ] Docstrings added/updated
|
||||
- [ ] API documentation updated
|
||||
- [ ] CHANGELOG.md updated
|
||||
- [ ] No documentation needed
|
||||
|
||||
## Checklist
|
||||
|
||||
<!-- Ensure all items are completed before requesting review -->
|
||||
|
||||
- [ ] My code follows the project's style guidelines (YAPF/Black formatted)
|
||||
- [ ] I have performed a self-review of my code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
- [ ] Any dependent changes have been merged and published
|
||||
- [ ] I have run `make format` to format the code
|
||||
- [ ] I have checked my code with `mypy` for type errors
|
||||
- [ ] I have updated type hints where necessary
|
||||
- [ ] Pre-commit hooks pass
|
||||
|
||||
## Screenshots/Videos
|
||||
|
||||
<!-- If applicable, add screenshots or videos to demonstrate the changes -->
|
||||
|
||||
## Additional Notes
|
||||
|
||||
<!-- Add any additional notes, concerns, or context for reviewers -->
|
||||
|
||||
## Reviewer Notes
|
||||
|
||||
<!-- Anything specific you want reviewers to focus on? -->
|
||||
|
||||
---
|
||||
|
||||
**For Maintainers:**
|
||||
|
||||
- [ ] Code review completed
|
||||
- [ ] Tests pass in CI
|
||||
- [ ] Documentation is adequate
|
||||
- [ ] Ready to merge
|
||||
198
.github/workflows/ci.yml
vendored
Normal file
198
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
name: CI/CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, dev, 'claude/**' ]
|
||||
pull_request:
|
||||
branches: [ main, dev ]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Code Quality & Linting
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install yapf black isort mypy
|
||||
|
||||
- name: Check formatting with YAPF
|
||||
run: |
|
||||
yapf --diff --recursive wan/ tests/
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check formatting with Black
|
||||
run: |
|
||||
black --check wan/ tests/
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check import sorting with isort
|
||||
run: |
|
||||
isort --check-only wan/ tests/
|
||||
continue-on-error: true
|
||||
|
||||
- name: Type check with mypy
|
||||
run: |
|
||||
mypy wan/
|
||||
continue-on-error: true
|
||||
|
||||
test-cpu:
|
||||
name: CPU Tests
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.10', '3.11']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libavformat-dev libavcodec-dev libavutil-dev libswscale-dev
|
||||
|
||||
- name: Install Python dependencies (CPU-only)
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
||||
pip install -e .[dev]
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
pytest tests/ -v -m "not cuda and not requires_model and not integration" --tb=short
|
||||
|
||||
- name: Run import tests
|
||||
run: |
|
||||
python -c "from wan.modules.model import WanModel; print('WanModel import OK')"
|
||||
python -c "from wan.modules.vae import WanVAE_; print('WanVAE import OK')"
|
||||
python -c "from wan.modules.attention import attention; print('attention import OK')"
|
||||
python -c "from wan.text2video import WanT2V; print('WanT2V import OK')"
|
||||
python -c "from wan.image2video import WanI2V; print('WanI2V import OK')"
|
||||
|
||||
test-gpu:
|
||||
name: GPU Tests (CUDA)
|
||||
runs-on: ubuntu-latest
|
||||
# Note: This requires a self-hosted runner with GPU access
|
||||
# For public CI, this job can be skipped
|
||||
if: false # Disable by default (enable for self-hosted runners with GPU)
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install CUDA dependencies
|
||||
run: |
|
||||
# Add CUDA installation steps here
|
||||
echo "CUDA installation required"
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
|
||||
pip install -e .[dev]
|
||||
|
||||
- name: Run GPU tests
|
||||
run: |
|
||||
pytest tests/ -v -m "cuda" --tb=short
|
||||
|
||||
security:
|
||||
name: Security Scanning
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install safety bandit
|
||||
|
||||
- name: Run safety check
|
||||
run: |
|
||||
pip install -e .
|
||||
safety check --json || true
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run bandit security scan
|
||||
run: |
|
||||
bandit -r wan/ -f json || true
|
||||
continue-on-error: true
|
||||
|
||||
build:
|
||||
name: Build Package
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test-cpu]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install build tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build twine
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
python -m build
|
||||
|
||||
- name: Check package
|
||||
run: |
|
||||
twine check dist/*
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
|
||||
docs:
|
||||
name: Build Documentation
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install sphinx sphinx-rtd-theme
|
||||
|
||||
- name: Build documentation
|
||||
run: |
|
||||
# Add sphinx build commands when docs/ is set up
|
||||
echo "Documentation build placeholder"
|
||||
continue-on-error: true
|
||||
120
.pre-commit-config.yaml
Normal file
120
.pre-commit-config.yaml
Normal file
@ -0,0 +1,120 @@
|
||||
# Pre-commit hooks configuration for Wan2.1
|
||||
# Install: pip install pre-commit
|
||||
# Setup: pre-commit install
|
||||
# Run: pre-commit run --all-files
|
||||
|
||||
repos:
|
||||
# General file checks
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
exclude: ^(.*\.md|.*\.txt)$
|
||||
- id: end-of-file-fixer
|
||||
exclude: ^(.*\.md|.*\.txt)$
|
||||
- id: check-yaml
|
||||
- id: check-json
|
||||
- id: check-toml
|
||||
- id: check-added-large-files
|
||||
args: ['--maxkb=10000'] # 10MB max
|
||||
- id: check-merge-conflict
|
||||
- id: check-case-conflict
|
||||
- id: detect-private-key
|
||||
- id: mixed-line-ending
|
||||
args: ['--fix=lf']
|
||||
|
||||
# Python code formatting with YAPF
|
||||
- repo: https://github.com/google/yapf
|
||||
rev: v0.40.2
|
||||
hooks:
|
||||
- id: yapf
|
||||
name: yapf
|
||||
args: ['--in-place']
|
||||
additional_dependencies: ['toml']
|
||||
|
||||
# Python import sorting
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.13.2
|
||||
hooks:
|
||||
- id: isort
|
||||
name: isort
|
||||
args: ['--profile', 'black', '--line-length', '100']
|
||||
|
||||
# Python code formatting with Black (alternative to YAPF)
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 24.1.1
|
||||
hooks:
|
||||
- id: black
|
||||
name: black
|
||||
language_version: python3.10
|
||||
args: ['--line-length', '100']
|
||||
|
||||
# Python linting
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 7.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
name: flake8
|
||||
args: ['--max-line-length=120', '--ignore=E203,E266,E501,W503,F403,F401']
|
||||
additional_dependencies: ['flake8-docstrings']
|
||||
|
||||
# Type checking with mypy
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.8.0
|
||||
hooks:
|
||||
- id: mypy
|
||||
name: mypy
|
||||
args: ['--config-file=mypy.ini', '--ignore-missing-imports']
|
||||
additional_dependencies:
|
||||
- types-PyYAML
|
||||
- types-requests
|
||||
- types-setuptools
|
||||
exclude: ^(tests/|gradio/|examples/)
|
||||
|
||||
# Security checks
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.7.6
|
||||
hooks:
|
||||
- id: bandit
|
||||
name: bandit
|
||||
args: ['-r', 'wan/', '-ll', '-i']
|
||||
exclude: ^tests/
|
||||
|
||||
# Docstring coverage
|
||||
- repo: https://github.com/econchick/interrogate
|
||||
rev: 1.5.0
|
||||
hooks:
|
||||
- id: interrogate
|
||||
name: interrogate
|
||||
args: ['-v', '--fail-under=50', 'wan/']
|
||||
pass_filenames: false
|
||||
|
||||
# Python security
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
|
||||
rev: v1.3.3
|
||||
hooks:
|
||||
- id: python-safety-dependencies-check
|
||||
name: safety
|
||||
files: requirements\.txt$
|
||||
|
||||
# Markdown linting
|
||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||
rev: v0.38.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
name: markdownlint
|
||||
args: ['--fix']
|
||||
|
||||
# Configuration for specific hooks
|
||||
exclude: |
|
||||
(?x)^(
|
||||
\.git/|
|
||||
\.pytest_cache/|
|
||||
__pycache__/|
|
||||
.*\.egg-info/|
|
||||
build/|
|
||||
dist/|
|
||||
\.venv/|
|
||||
venv/|
|
||||
node_modules/
|
||||
)
|
||||
97
mypy.ini
Normal file
97
mypy.ini
Normal file
@ -0,0 +1,97 @@
|
||||
[mypy]
|
||||
# Mypy configuration for Wan2.1
|
||||
# Run with: mypy wan
|
||||
|
||||
# Global options
|
||||
python_version = 3.10
|
||||
warn_return_any = True
|
||||
warn_unused_configs = True
|
||||
disallow_untyped_defs = False
|
||||
disallow_incomplete_defs = False
|
||||
check_untyped_defs = True
|
||||
disallow_untyped_decorators = False
|
||||
no_implicit_optional = True
|
||||
warn_redundant_casts = True
|
||||
warn_unused_ignores = True
|
||||
warn_no_return = True
|
||||
warn_unreachable = True
|
||||
strict_equality = True
|
||||
show_error_codes = True
|
||||
show_column_numbers = True
|
||||
pretty = True
|
||||
|
||||
# Import discovery
|
||||
namespace_packages = True
|
||||
ignore_missing_imports = True
|
||||
follow_imports = normal
|
||||
|
||||
# Suppress errors for external dependencies
|
||||
[mypy-torch.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-torchvision.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-transformers.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-diffusers.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-flash_attn.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-accelerate.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-xfuser.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-gradio.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-PIL.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-cv2.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-av.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-dashscope.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-openai.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-safetensors.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-einops.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-scipy.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-setuptools.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
# Per-module options for gradual typing adoption
|
||||
[mypy-wan.modules.*]
|
||||
# Core modules - stricter checking
|
||||
disallow_untyped_defs = False
|
||||
check_untyped_defs = True
|
||||
|
||||
[mypy-wan.utils.*]
|
||||
# Utilities - moderate checking
|
||||
check_untyped_defs = True
|
||||
|
||||
[mypy-wan.distributed.*]
|
||||
# Distributed code - moderate checking
|
||||
check_untyped_defs = True
|
||||
|
||||
[mypy-tests.*]
|
||||
# Tests can be less strict
|
||||
ignore_errors = False
|
||||
check_untyped_defs = False
|
||||
Loading…
Reference in New Issue
Block a user