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
18 changes: 15 additions & 3 deletions .github/workflows/any_changes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,28 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install package
run: make install
run: uv pip install .[dev] --system

- name: Test documentation builds
run: make documentation
env:
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}

- name: Check documentation build
run: |
for notebook in $(find docs/_build/jupyter_execute -name "*.ipynb"); do
if grep -q '"output_type": "error"' "$notebook"; then
echo "Error found in $notebook"
cat "$notebook"
exit 1
fi
done
16 changes: 10 additions & 6 deletions .github/workflows/publish_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
uses: actions/checkout@v2
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12
python-version: '3.10'

- name: Install package
run: uv pip install .[dev] --system
- name: Publish a git tag
run: ".github/publish-git-tag.sh || true"
- name: Install package
run: make install
- name: Build package
run: make
- name: Publish a Python distribution to PyPI
Expand Down
14 changes: 11 additions & 3 deletions docs/basic/calculate_economy_comparison.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/basic/calculate_household_comparison.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/basic/calculate_single_economy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.12.9"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/basic/calculate_single_household.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.12.9"
}
},
"nbformat": 4,
Expand Down
14 changes: 7 additions & 7 deletions docs/basic/create_charts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -34,14 +34,14 @@
"from policyengine import Simulation\n",
"from policyengine.outputs.macro.comparison.charts import *\n",
"\n",
"sim = Simulation({\n",
" \"country\": \"uk\",\n",
" \"scope\": \"macro\",\n",
" \"reform\": {\n",
"sim = Simulation(\n",
" country=\"uk\",\n",
" scope=\"macro\",\n",
" reform={\n",
" \"gov.hmrc.income_tax.allowances.personal_allowance.amount\": 10_000,\n",
" },\n",
" \"title\": \"Lowering the personal allowance to £10,000\" # Required for charts\n",
"})\n",
" title=\"Lowering the personal allowance to £10,000\" # Required for charts\n",
")\n",
"\n",
"from policyengine.utils.charts import add_fonts\n",
"\n",
Expand Down
14 changes: 7 additions & 7 deletions docs/concepts/simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -39,12 +39,12 @@
"source": [
"from policyengine import Simulation\n",
"\n",
"sim = Simulation({\n",
" \"country\": \"uk\",\n",
" \"scope\": \"macro\",\n",
" \"reform\": {},\n",
" \"time_period\": 2025,\n",
"})\n",
"sim = Simulation(\n",
" country=\"uk\",\n",
" scope=\"macro\",\n",
" reform={},\n",
" time_period=2025,\n",
")\n",
"\n",
"sim.calculate_economy_comparison()"
]
Expand Down
14 changes: 7 additions & 7 deletions docs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -44,14 +44,14 @@
"source": [
"from policyengine import Simulation\n",
"\n",
"sim = Simulation({\n",
" \"scope\": \"macro\",\n",
" \"country\": \"uk\",\n",
" \"time_period\": 2025,\n",
" \"reform\": {\n",
"sim = Simulation(\n",
" scope=\"macro\",\n",
" country=\"uk\",\n",
" time_period=2025,\n",
" reform={\n",
" \"gov.hmrc.income_tax.allowances.personal_allowance.amount\": 15000\n",
" },\n",
"})\n",
")\n",
"\n",
"sim.calculate_economy_comparison()"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def calculate_single_household(
"""Calculate household statistics for a single household scenario."""
if simulation.is_comparison:
raise ValueError(
"This function is for single economy simulations only."
"This function is for single household simulations only."
)

return SingleHousehold(
Expand Down
Loading