Skip to content

Commit e40c7b0

Browse files
eric-wieserutensil
authored andcommitted
Add a sympy 1.5 run for CircleCI (#164)
This needs some extra sanitization rules in nbval
1 parent d8e533f commit e40c7b0

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.circleci/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ defaults: &defaults
99
command: |
1010
sudo pip install -r test_requirements.txt
1111
sudo pip install -e .
12+
if [ -n "$PIP_EXTRA_INSTALLATION" ]; then
13+
# deliberately not quoted
14+
sudo pip install $PIP_EXTRA_INSTALLATION
15+
fi
1216
sudo pip check
1317
- run:
1418
name: Test
@@ -28,6 +32,13 @@ defaults: &defaults
2832
path: test-reports
2933

3034
jobs:
35+
"python-3.7-sympy-1.5":
36+
<<: *defaults
37+
environment:
38+
PIP_EXTRA_INSTALLATION: sympy==1.5
39+
docker:
40+
- image: circleci/python:3.7
41+
3142
"python-3.7":
3243
<<: *defaults
3344
docker:
@@ -53,3 +64,4 @@ workflows:
5364
- "python-3.6"
5465
- "python-3.5"
5566
- "python-2.7"
67+
- "python-3.7-sympy-1.5"

test/.nbval_sanitize.cfg

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,29 @@ replace: $
1010

1111
regex: \s*\$\s*
1212
replace: $
13+
14+
[sympy printing changes]
15+
regex: \\left \(
16+
replace: \\left(
17+
regex: \\right \)
18+
replace: \\right)
19+
regex: \\left \[
20+
replace: \\left[
21+
regex: \\right \]
22+
replace: \\right]
23+
24+
# note hacks to avoid trailing spaces which editors may trim
25+
regex: , \\quad( )
26+
replace: , \ \1
27+
28+
# sympy 1.5 seems to reorder a few additions compared to 1.3
29+
regex: \\begin\{matrix}- \\frac\{\\sqrt\{2}}\{4} \+ \\frac\{1}\{2}\\end\{matrix}
30+
replace: \\begin{matrix}\\frac{1}{2} - \\frac{\\sqrt{2}}{4}\\end{matrix}
31+
regex: =( +)- \\frac\{\\sqrt\{2}}\{4} \+ \\frac\{1}\{2}(?=\$| \\end\{equation\*})
32+
replace: =\1\\frac{1}{2} - \\frac{\\sqrt{2}}{4}
33+
34+
regex: \{- \\left\( e_\{E}\\cdot e_\{B}\\right\) \^\{2} \+ 1\}
35+
replace: {1 - \\left( e_{E}\\cdot e_{B}\\right) ^{2}}
36+
37+
regex: eu\.ev_r = -1/2 \+ 1/2(?=\n)
38+
replace: eu.ev_r = 1/2 - 1/2

0 commit comments

Comments
 (0)