Skip to content

Commit 70ba63b

Browse files
Merge pull request #96 from PolicyEngine/docs-fix
Add extra check in docs build artifacts for errors
2 parents 574ff58 + 0c8b63f commit 70ba63b

File tree

10 files changed

+65
-41
lines changed

10 files changed

+65
-41
lines changed

.github/workflows/any_changes.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,28 @@ jobs:
1313
steps:
1414
- name: Checkout repo
1515
uses: actions/checkout@v2
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v5
1618

1719
- name: Set up Python
1820
uses: actions/setup-python@v2
1921
with:
2022
python-version: '3.10'
21-
23+
2224
- name: Install package
23-
run: make install
25+
run: uv pip install .[dev] --system
2426

2527
- name: Test documentation builds
2628
run: make documentation
2729
env:
28-
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
30+
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
31+
32+
- name: Check documentation build
33+
run: |
34+
for notebook in $(find docs/_build/jupyter_execute -name "*.ipynb"); do
35+
if grep -q '"output_type": "error"' "$notebook"; then
36+
echo "Error found in $notebook"
37+
cat "$notebook"
38+
exit 1
39+
fi
40+
done

.github/workflows/publish_package.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout repo
13-
uses: actions/checkout@v4
14-
- name: Setup Python
15-
uses: actions/setup-python@v5
13+
uses: actions/checkout@v2
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v5
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
1619
with:
17-
python-version: 3.12
20+
python-version: '3.10'
21+
22+
- name: Install package
23+
run: uv pip install .[dev] --system
1824
- name: Publish a git tag
1925
run: ".github/publish-git-tag.sh || true"
20-
- name: Install package
21-
run: make install
2226
- name: Build package
2327
run: make
2428
- name: Publish a Python distribution to PyPI

docs/basic/calculate_economy_comparison.ipynb

Lines changed: 11 additions & 3 deletions
Large diffs are not rendered by default.

docs/basic/calculate_household_comparison.ipynb

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

docs/basic/calculate_single_economy.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"name": "python",
150150
"nbconvert_exporter": "python",
151151
"pygments_lexer": "ipython3",
152-
"version": "3.10.14"
152+
"version": "3.12.9"
153153
}
154154
},
155155
"nbformat": 4,

docs/basic/calculate_single_household.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"name": "python",
115115
"nbconvert_exporter": "python",
116116
"pygments_lexer": "ipython3",
117-
"version": "3.10.14"
117+
"version": "3.12.9"
118118
}
119119
},
120120
"nbformat": 4,

docs/basic/create_charts.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": 1,
14+
"execution_count": null,
1515
"metadata": {},
1616
"outputs": [
1717
{
@@ -34,14 +34,14 @@
3434
"from policyengine import Simulation\n",
3535
"from policyengine.outputs.macro.comparison.charts import *\n",
3636
"\n",
37-
"sim = Simulation({\n",
38-
" \"country\": \"uk\",\n",
39-
" \"scope\": \"macro\",\n",
40-
" \"reform\": {\n",
37+
"sim = Simulation(\n",
38+
" country=\"uk\",\n",
39+
" scope=\"macro\",\n",
40+
" reform={\n",
4141
" \"gov.hmrc.income_tax.allowances.personal_allowance.amount\": 10_000,\n",
4242
" },\n",
43-
" \"title\": \"Lowering the personal allowance to £10,000\" # Required for charts\n",
44-
"})\n",
43+
" title=\"Lowering the personal allowance to £10,000\" # Required for charts\n",
44+
")\n",
4545
"\n",
4646
"from policyengine.utils.charts import add_fonts\n",
4747
"\n",

docs/concepts/simulation.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 1,
25+
"execution_count": null,
2626
"metadata": {},
2727
"outputs": [
2828
{
@@ -39,12 +39,12 @@
3939
"source": [
4040
"from policyengine import Simulation\n",
4141
"\n",
42-
"sim = Simulation({\n",
43-
" \"country\": \"uk\",\n",
44-
" \"scope\": \"macro\",\n",
45-
" \"reform\": {},\n",
46-
" \"time_period\": 2025,\n",
47-
"})\n",
42+
"sim = Simulation(\n",
43+
" country=\"uk\",\n",
44+
" scope=\"macro\",\n",
45+
" reform={},\n",
46+
" time_period=2025,\n",
47+
")\n",
4848
"\n",
4949
"sim.calculate_economy_comparison()"
5050
]

docs/index.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
{
2929
"cell_type": "code",
30-
"execution_count": 1,
30+
"execution_count": null,
3131
"metadata": {},
3232
"outputs": [
3333
{
@@ -44,14 +44,14 @@
4444
"source": [
4545
"from policyengine import Simulation\n",
4646
"\n",
47-
"sim = Simulation({\n",
48-
" \"scope\": \"macro\",\n",
49-
" \"country\": \"uk\",\n",
50-
" \"time_period\": 2025,\n",
51-
" \"reform\": {\n",
47+
"sim = Simulation(\n",
48+
" scope=\"macro\",\n",
49+
" country=\"uk\",\n",
50+
" time_period=2025,\n",
51+
" reform={\n",
5252
" \"gov.hmrc.income_tax.allowances.personal_allowance.amount\": 15000\n",
5353
" },\n",
54-
"})\n",
54+
")\n",
5555
"\n",
5656
"sim.calculate_economy_comparison()"
5757
]

policyengine/outputs/household/single/calculate_single_household.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def calculate_single_household(
3838
"""Calculate household statistics for a single household scenario."""
3939
if simulation.is_comparison:
4040
raise ValueError(
41-
"This function is for single economy simulations only."
41+
"This function is for single household simulations only."
4242
)
4343

4444
return SingleHousehold(

0 commit comments

Comments
 (0)