Skip to content

Commit e4d16e1

Browse files
authored
Merge pull request #98 from devitocodes/devito
Devito Edition
2 parents ca1a775 + 24bc811 commit e4d16e1

File tree

102 files changed

+14346
-1798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+14346
-1798
lines changed

.github/workflows/ci.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, devito]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
# Run tests for mathematical derivations and operators with coverage
11+
test-derivations:
12+
name: Test Mathematical Derivations
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.11'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pytest pytest-cov numpy sympy matplotlib ipython
28+
29+
- name: Run tests with coverage
30+
run: |
31+
pytest tests/test_operators.py tests/test_derivations.py -v --cov=src --cov-report=xml --cov-report=term-missing
32+
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v4
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
files: ./coverage.xml
38+
flags: derivations
39+
name: derivations-coverage
40+
fail_ci_if_error: false
41+
42+
# Run explicit Devito solver tests with coverage
43+
test-devito-explicit:
44+
name: Test Devito Explicit Solvers
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v4
50+
51+
- name: Set up Python
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: '3.11'
55+
56+
- name: Install dependencies
57+
run: |
58+
python -m pip install --upgrade pip
59+
pip install pytest pytest-cov numpy sympy matplotlib
60+
pip install devito
61+
62+
- name: Run Devito tests with coverage
63+
run: |
64+
pytest tests/ -v -m "devito" --cov=src --cov-report=xml --cov-report=term-missing --tb=short
65+
continue-on-error: true # Allow to continue even if Devito tests fail initially
66+
67+
- name: Upload coverage to Codecov
68+
uses: codecov/codecov-action@v4
69+
with:
70+
token: ${{ secrets.CODECOV_TOKEN }}
71+
files: ./coverage.xml
72+
flags: devito
73+
name: devito-coverage
74+
fail_ci_if_error: false
75+
76+
# Lint and style checks
77+
lint:
78+
name: Lint and Style
79+
runs-on: ubuntu-latest
80+
81+
steps:
82+
- name: Checkout repository
83+
uses: actions/checkout@v4
84+
85+
- name: Set up Python
86+
uses: actions/setup-python@v5
87+
with:
88+
python-version: '3.11'
89+
90+
- name: Install linting tools
91+
run: |
92+
python -m pip install --upgrade pip
93+
pip install ruff isort
94+
95+
- name: Run ruff check
96+
run: |
97+
# Check only new Devito code (skip legacy code with many pre-existing issues)
98+
ruff check src/wave/*_devito.py src/diffu/*_devito.py src/advec/*_devito.py src/nonlin/ src/symbols.py src/operators.py src/display.py src/verification.py src/plotting.py tests/ --select=E,W,F --ignore=F403,F405,E501,E741,E743,E731,E402,F841,E722
99+
100+
- name: Check import ordering
101+
run: |
102+
isort --check-only src/ tests/ --skip __init__.py
103+
continue-on-error: true
104+
105+
# Build Quarto book
106+
build-book:
107+
name: Build Quarto Book
108+
runs-on: ubuntu-latest
109+
110+
steps:
111+
- name: Checkout repository
112+
uses: actions/checkout@v4
113+
114+
- name: Set up Python
115+
uses: actions/setup-python@v5
116+
with:
117+
python-version: '3.11'
118+
119+
- name: Install Python dependencies
120+
run: |
121+
python -m pip install --upgrade pip
122+
pip install numpy sympy matplotlib jupyter
123+
124+
- name: Set up Quarto
125+
uses: quarto-dev/quarto-actions/setup@v2
126+
with:
127+
version: '1.4.554'
128+
129+
- name: Install TinyTeX
130+
run: |
131+
quarto install tinytex
132+
133+
- name: Render book
134+
run: |
135+
quarto render --to pdf
136+
continue-on-error: true # Book may not build initially
137+
138+
- name: Upload book artifact
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: book-pdf
142+
path: _book/*.pdf
143+
if: success()

.github/workflows/publish.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish Book
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch: # Allow manual triggers
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: '3.12'
30+
cache: 'pip'
31+
32+
- name: Set up Quarto
33+
uses: quarto-dev/quarto-actions/setup@v2
34+
with:
35+
version: '1.6.40'
36+
37+
- name: Install TeX Live
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y --no-install-recommends \
41+
texlive-latex-base \
42+
texlive-latex-recommended \
43+
texlive-latex-extra \
44+
texlive-fonts-recommended \
45+
texlive-fonts-extra \
46+
texlive-science \
47+
texlive-pictures \
48+
texlive-bibtex-extra \
49+
texlive-plain-generic \
50+
lmodern \
51+
biber \
52+
latexmk \
53+
cm-super \
54+
dvipng \
55+
ghostscript
56+
57+
- name: Install Python dependencies
58+
run: |
59+
python -m pip install --upgrade pip
60+
pip install numpy scipy matplotlib sympy jupyter
61+
62+
- name: Build HTML
63+
run: quarto render --to html
64+
65+
- name: Build PDF
66+
run: quarto render --to pdf
67+
68+
- name: Copy PDF to HTML output
69+
run: |
70+
cp _book/Finite-Difference-Computing-with-PDEs.pdf _book/book.pdf
71+
72+
- name: Upload artifact
73+
uses: actions/upload-pages-artifact@v3
74+
with:
75+
path: _book
76+
77+
deploy:
78+
environment:
79+
name: github-pages
80+
url: ${{ steps.deployment.outputs.page_url }}
81+
runs-on: ubuntu-latest
82+
needs: build
83+
steps:
84+
- name: Deploy to GitHub Pages
85+
id: deployment
86+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,16 @@ temp*
4646
.idea
4747
__pycache__
4848
_minted-*
49-
# doconce:
50-
.*_html_file_collection
51-
.*.exerinfo
52-
.*.copyright
53-
sphinx-rootdir
54-
Trash
5549
# Generated/published content (regenerated by build scripts):
5650
doc/pub/
5751

58-
# Generated LaTeX files (in doc/.src/book/):
59-
book.tex
60-
book.pdf
61-
book.dlog
62-
latex_figs/
63-
svmonodo.cls
64-
t4do.sty
65-
newcommands_keep.tex
66-
tmp_mako__*.do.txt
67-
tmp_preprocess__*.do.txt
68-
# Test files:
69-
title_test.*
70-
7152
/.quarto/
7253
/_book/
7354
**/*.quarto_ipynb
55+
56+
# Coverage
57+
.coverage
58+
coverage.xml
59+
htmlcov/
60+
.pytest_cache/
61+
devito_repo/

.markdownlint-cli2.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,13 @@
33
globs:
44
- "**/*.md"
55
- "**/*.qmd"
6+
7+
# Exclude external and generated directories
8+
ignores:
9+
- "devito_repo/**"
10+
- "venv/**"
11+
- ".venv/**"
12+
- "node_modules/**"
13+
- "_book/**"
14+
- "doc/pub/**"
15+
- "devito-plan.md"

.markdownlint.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ MD022: false
5353
# MD012 - Multiple consecutive blank lines (false positives in Python code blocks with PEP8 style)
5454
MD012: false
5555

56-
# MD004 - Unordered list style (allow both dash and plus - converted from DocOnce)
56+
# MD018 - No space after hash (false positive from #!/bin/bash shebangs in code blocks)
57+
MD018: false
58+
59+
# MD036 - Emphasis as heading (false positive from a) b) c) exercise labels)
60+
MD036: false
61+
62+
# MD004 - Unordered list style (allow both dash and plus)
5763
MD004: false
5864

5965
# MD031 - Blanks around fences (false positives in nested documentation examples)

.markdownlintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ _book/
88
# Virtual environments
99
venv/
1010
.venv/
11+
12+
# External repositories
13+
devito_repo/
14+
15+
# Planning documents (not code)
16+
devito-plan.md

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ repos:
4242
- id: markdownlint-cli2
4343
name: "Check markdown files"
4444
stages: [pre-commit]
45+
exclude: '^(devito_repo/|venv/|devito-plan\.md)'
4546
#
4647
# These stages modify the files applying fixes where possible
4748
# Since this may be undesirable they will not run automatically
@@ -79,3 +80,4 @@ repos:
7980
name: "Fix markdown files"
8081
args: [--fix]
8182
stages: [manual]
83+
exclude: '^(devito_repo/|venv/|devito-plan\.md)'

.typos.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
Thi = "Thi"
44
# Equation label suffix (exact solution "u_e")
55
ue = "ue"
6+
# Strang splitting (named after mathematician Gilbert Strang)
7+
strang = "strang"
8+
Strang = "Strang"

0 commit comments

Comments
 (0)