Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/ci-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: CI Audit - Tests and Code Quality

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

# Set minimal permissions for GITHUB_TOKEN
permissions:
contents: read

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive # Initialize any git submodules if present

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip

# Install test dependencies
pip install pytest pytest-cov pytest-xdist

# Install GA_denoise_selector dependencies
if [ -f GA_denoise_selector/requirements.txt ]; then
pip install -r GA_denoise_selector/requirements.txt
fi

# Install Mamba-SSM-Denoise dependencies
if [ -f Mamba-SSM-Denoise/Track_H_cross_validation/requirements.txt ]; then
pip install -r Mamba-SSM-Denoise/Track_H_cross_validation/requirements.txt
fi

# Install GA_smoother_classic dependencies
if [ -f GA_smoother_classic/requirements.txt ]; then
pip install -r GA_smoother_classic/requirements.txt
fi

- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=$PYTHONPATH:$(pwd):$(pwd)/GA_denoise_selector:$(pwd)/Mamba-SSM-Denoise/Track_H_cross_validation:$(pwd)/GA_smoother_classic" >> $GITHUB_ENV

- name: Run tests
run: |
# Export PYTHONPATH for pytest (belt and suspenders approach)
export PYTHONPATH=$PYTHONPATH:$(pwd):$(pwd)/GA_denoise_selector:$(pwd)/Mamba-SSM-Denoise/Track_H_cross_validation:$(pwd)/GA_smoother_classic

# Run tests with quick marker if available, otherwise run all tests
if grep -r "pytest.mark.quick" tests/ 2>/dev/null; then
pytest tests -m "quick" --maxfail=1 --cov=GA_denoise_selector/smoothers --cov=Mamba-SSM-Denoise/Track_H_cross_validation/src --cov-report=term --cov-report=html
else
pytest tests --maxfail=1 --cov=GA_denoise_selector/smoothers --cov=Mamba-SSM-Denoise/Track_H_cross_validation/src --cov-report=term --cov-report=html
fi

- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report-${{ matrix.python-version }}
path: htmlcov/
retention-days: 30

lint:
name: Code Quality Checks
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install flake8 black isort mypy
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy is installed here but not used in any subsequent step, which adds CI time and dependency surface without benefit. Either add a mypy check step or remove mypy from the install list to keep the workflow lean.

Suggested change
pip install flake8 black isort mypy
pip install flake8 black isort

Copilot uses AI. Check for mistakes.

- name: Run flake8
continue-on-error: true
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Check code formatting with black
continue-on-error: true
run: |
black --check --diff .

- name: Check import ordering with isort
continue-on-error: true
run: |
isort --check-only --diff .
93 changes: 93 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyTorch
*.pth
*.pt
checkpoints/
runs/
lightning_logs/

# Testing
.pytest_cache/
.coverage
.coverage.*
htmlcov/
.tox/
.nox/
coverage.xml
*.cover
.hypothesis/
pytest_cache/

# Jupyter Notebook
.ipynb_checkpoints
*.ipynb

# Environment
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Data
*.csv
*.h5
*.hdf5
*.pkl
*.pickle
data/
datasets/
output/
outputs/
results/

# Logs
*.log
logs/
tensorboard/

# Git submodules (if any future submodules are added)
external/

# Temporary files
tmp/
temp/
*.tmp

# OS-specific
.DS_Store
Thumbs.db
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,58 @@
This repository collects quick experiments and reusable components for transformer architectures and state-space model (SSM) projects. Expect lightweight prototypes, training scripts, and utility code that make it easy to compare and iterate on modern sequence modeling ideas.

Jump in, explore the models, and use the pieces that help you move faster on your own AI workflows.

## Projects

- **GA_denoise_selector**: Genetic algorithm-based smoother selection with 13+ filter implementations
- **Mamba-SSM-Denoise**: Deep learning denoising using Mamba state-space models
- **GA_smoother_classic**: Classic genetic algorithm smoother implementation

## Testing

This repository includes a test infrastructure to ensure code quality and prevent import errors.

### Running Tests

```bash
# Install test dependencies
pip install pytest pytest-cov

# Run all tests
pytest tests/

# Run quick tests only
pytest tests/ -m "quick"

# Run with coverage
pytest tests/ --cov=GA_denoise_selector/smoothers --cov=Mamba-SSM-Denoise/Track_H_cross_validation/src
```

### Configuration

- **pytest configuration**: `setup.cfg` - Configures Python path for all projects
- **Test directory**: `tests/` - All test files
- **CI/CD**: `.github/workflows/ci-audit.yml` - Automated testing on push/PR

For more details, see [tests/README.md](tests/README.md).

## Development

### Prerequisites

Each project has its own dependencies. Install them as needed:

```bash
# GA_denoise_selector
pip install -r GA_denoise_selector/requirements.txt

# Mamba-SSM-Denoise
pip install -r Mamba-SSM-Denoise/Track_H_cross_validation/requirements.txt

# GA_smoother_classic
pip install -r GA_smoother_classic/requirements.txt
```

### Python Path

The repository uses a multi-project structure. When importing modules, the Python path is configured via `setup.cfg` to include all project directories. This prevents `ModuleNotFoundError` issues in tests.
38 changes: 38 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[tool:pytest]
# Configure pytest to find source modules for all projects
pythonpath =
.
GA_denoise_selector
Mamba-SSM-Denoise/Track_H_cross_validation
GA_smoother_classic

# Test discovery patterns
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*

# Custom markers
markers =
quick: marks tests as quick (deselect with '-m "not quick"')

# Coverage configuration
[coverage:run]
source =
GA_denoise_selector/smoothers
Mamba-SSM-Denoise/Track_H_cross_validation/src

omit =
*/tests/*
*/test_*.py
*/__pycache__/*

[coverage:report]
exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if __name__ == '__main__':
if TYPE_CHECKING:
@abstractmethod
Loading
Loading