Skip to content
Merged
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
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
max-line-length = 100
extend-ignore = E203, W503
exclude =
.git,
__pycache__,
build,
dist,
.venv,
*.egg-info
133 changes: 133 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# =============================================================================
# Git Attributes for TIDE Pipeline
# =============================================================================

# Auto detect text files and normalize line endings
* text=auto

# =============================================================================
# Source Code
# =============================================================================

*.py text diff=python
*.pyx text diff=python
*.pxd text diff=python
*.pxi text diff=python

# =============================================================================
# Documentation
# =============================================================================

*.md text diff=markdown
*.rst text
*.txt text
*.html text diff=html
*.css text diff=css
*.js text
*.json text

# =============================================================================
# Configuration
# =============================================================================

*.yml text
*.yaml text
*.toml text
*.ini text
*.cfg text
*.conf text
*.config text

# =============================================================================
# Shell Scripts
# =============================================================================

*.sh text eol=lf
*.bash text eol=lf
*.zsh text eol=lf
*.fish text eol=lf

# Windows batch files
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

# =============================================================================
# Binary Files
# =============================================================================

# Images
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.svg text
*.webp binary

# Fonts
*.ttf binary
*.eot binary
*.woff binary
*.woff2 binary

# Archives
*.zip binary
*.tar binary
*.tar.gz binary
*.tgz binary
*.gz binary

# =============================================================================
# Data Files (Large Binary)
# =============================================================================

# NIfTI files
*.nii binary
*.nii.gz binary filter=lfs diff=lfs merge=lfs -text

# Tractography files
*.trk binary filter=lfs diff=lfs merge=lfs -text
*.tck binary filter=lfs diff=lfs merge=lfs -text

# Mesh files
*.msh binary filter=lfs diff=lfs merge=lfs -text

# SimNIBS files
*.stmpx binary

# HDF5 files
*.h5 binary filter=lfs diff=lfs merge=lfs -text
*.hdf5 binary filter=lfs diff=lfs merge=lfs -text

# MATLAB files
*.mat binary

# =============================================================================
# GitHub Linguist Overrides
# =============================================================================

# Exclude from language statistics
tests/* linguist-detectable=false
docs/* linguist-documentation
examples/* linguist-documentation

# Vendored files (if any)
# vendor/* linguist-vendored

# =============================================================================
# Diff Drivers
# =============================================================================

# Better diffs for Jupyter notebooks (requires nbstripout)
*.ipynb diff=jupyternotebook

# =============================================================================
# Export Ignore (for git archive)
# =============================================================================

.gitattributes export-ignore
.gitignore export-ignore
.github/ export-ignore
tests/ export-ignore
docs/ export-ignore
134 changes: 134 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: CI

on:
push:
branches: [main]
pull_request:
workflow_call:

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Linux tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package + test tools
# SimNIBS is a system dependency (not on PyPI) and is intentionally not
# installed; SimNIBS-dependent tests are skipped below. Installing the
# package editable pulls the *pinned* runtime deps from pyproject
# (numpy 1.26.4, scipy, nibabel, dipy 1.9.0, pandas, matplotlib, ...),
# all wheel-available — no source builds, no numpy-2 resolution.
run: |
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install pytest==9.0.3
- name: Run tests
# Individual SimNIBS integration cases carry their own skip markers;
# all SimNIBS-independent geometry tests remain part of the CI gate.
run: python -m pytest tests/ -q

windows-test:
name: Windows tests (Python 3.11)
runs-on: windows-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
- name: Install package + test tools
run: |
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install pytest==9.0.3
- name: Run tests
run: python -m pytest tests/ -q

coverage:
name: Coverage regression gate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
- name: Install package + coverage tools
run: |
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install pytest==9.0.3 pytest-cov==4.1.0
- name: Run branch coverage gate
env:
COVERAGE_FILE: ${{ runner.temp }}/.coverage
run: >-
python -m pytest tests/ -q
--cov=tide
--cov-config="${GITHUB_WORKSPACE}/pyproject.toml"
--cov-report=term-missing
--cov-fail-under=45

package-smoke:
name: Wheel install + CLI smoke test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
- name: Install project as a regular package
run: |
python -m pip install --upgrade pip
python -m pip install --no-deps .
- name: Verify installed package, bundled config, and console entry point
working-directory: /tmp
run: |
python -I -c "import importlib.metadata as m, importlib.resources as r, tide; print(m.version('tide-pipeline')); print(tide.__file__); assert r.files('tide').joinpath('assets').joinpath('logo.ansi').is_file(); assert r.files('tide').joinpath('data').joinpath('config_template.yml').is_file()"
python -m tide --help
tide --help
tide --init-config /tmp/tide-ci-config.yml
test -s /tmp/tide-ci-config.yml
grep -q '^subject:' /tmp/tide-ci-config.yml

lint:
name: Lint (format + critical errors)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
- name: Verify release metadata synchronization
run: python scripts/check_release_metadata.py
- name: Verify README logo asset
run: test -s src/tide/assets/logo.png
- name: Install lint tools
run: >-
python -m pip install
black==26.3.1
isort==5.13.2
flake8==7.0.0
mypy==1.8.0
types-PyYAML==6.0.12.12
- name: black (format check)
run: black --check --diff .
- name: isort (import order check)
run: isort --check-only --diff .
- name: flake8 (syntax / undefined names only)
# Style-only findings (unused imports, line length) are deliberately not
# gated to avoid churning the scientific core; this catches real defects.
run: flake8 . --select=E9,F63,F7,F82 --show-source --statistics
- name: mypy (incremental typed-module gate)
run: mypy --cache-dir="${RUNNER_TEMP}/mypy-cache" src/tide
Loading
Loading