Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve repo style, interface and add UK local authority breakdowns #62

Merged
merged 40 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ef8df18
Pin core
nikhilwoodruff Dec 4, 2024
0c5ba55
Add changes
nikhilwoodruff Dec 4, 2024
4491ebd
Add charts and fix bugs
nikhilwoodruff Dec 6, 2024
422c248
Enable custom distribution charts
nikhilwoodruff Dec 6, 2024
859a50e
Merge branch 'main' of https://github.com/PolicyEngine/policyengine.p…
nikhilwoodruff Dec 6, 2024
a067b3e
Versioning
nikhilwoodruff Dec 6, 2024
9c9d042
Refactor to improve (but not entirely fix) type hints.
Dec 6, 2024
7bd4d32
Fix bug in breakdown function
nikhilwoodruff Dec 10, 2024
07d0911
Rename file
nikhilwoodruff Dec 10, 2024
accc7fa
Add total earnings and total workers as outputs
nikhilwoodruff Dec 10, 2024
7ad6615
Merge branch '55_fix_type_hints' of https://github.com/PolicyEngine/p…
nikhilwoodruff Dec 10, 2024
e1bede0
Fix typo
nikhilwoodruff Dec 10, 2024
3c9b54a
Fix index error
nikhilwoodruff Dec 10, 2024
d1bd2cc
Fix documentation error
nikhilwoodruff Dec 10, 2024
74a40dd
Add documentation of endpoints
nikhilwoodruff Dec 10, 2024
79da485
Add documentation of each endpoint
nikhilwoodruff Dec 10, 2024
53424ac
Use _parsed_reform
nikhilwoodruff Dec 10, 2024
fd565e0
Add notebooks in repo base to gitignore
nikhilwoodruff Dec 10, 2024
298d29b
Remove WIP
nikhilwoodruff Dec 10, 2024
8198ee3
Add local authority breakdowns
nikhilwoodruff Dec 10, 2024
dc94648
Add adjustments
nikhilwoodruff Dec 10, 2024
db91bb1
Reduce code duplication
nikhilwoodruff Dec 12, 2024
662ee6b
Add package install to CI
nikhilwoodruff Dec 12, 2024
fd67fc2
Disallow errors
nikhilwoodruff Dec 12, 2024
7ccd1d5
Add link to docs
nikhilwoodruff Dec 12, 2024
30c58b7
Remove warnings catch
nikhilwoodruff Dec 17, 2024
fee3ce1
Rename variable as per suggestion
nikhilwoodruff Dec 17, 2024
dc43832
Add nullable type hint
nikhilwoodruff Dec 17, 2024
f69dd72
Remove strongref
nikhilwoodruff Dec 17, 2024
a43ac8c
Remove strongref again
nikhilwoodruff Dec 17, 2024
597574a
Move print to verbose flag
nikhilwoodruff Dec 17, 2024
17a7550
Remove error-prone statement
nikhilwoodruff Dec 17, 2024
6ddf5ca
Use shorter variable
nikhilwoodruff Dec 17, 2024
16d0a20
Add type hint
nikhilwoodruff Dec 17, 2024
65d8f41
Change core dep to minimum
nikhilwoodruff Dec 17, 2024
579ae96
Rename light-light gray to fog gray
nikhilwoodruff Dec 17, 2024
741ce3c
Introduce spelling mistakes
nikhilwoodruff Dec 17, 2024
b5a7e75
Format
nikhilwoodruff Dec 17, 2024
ebb1037
Move python to 3.10
nikhilwoodruff Dec 17, 2024
2d50767
Use string
nikhilwoodruff Dec 17, 2024
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
8 changes: 6 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Install package
run: make install

- name: install dependencies
- name: Install dependencies
run: |
pip install jupyter-book
pip install furo
pip install sphinx-argparse

- name: Generate documentation
run: make documentation
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Install package
run: make install

- name: install dependencies
- name: Install dependencies
run: |
pip install jupyter-book
pip install furo
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

old/
*.ipynb
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.3.0] - 2024-12-06 14:07:31

### Added

- Household variation charts.
- Region filtering improvements.

## [2.2.2] - 2024-12-06 14:02:41

### Fixed
Expand Down Expand Up @@ -51,6 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



[2.3.0]: https://github.com/PolicyEngine/policyengine.py/compare/2.2.2...2.3.0
[2.2.2]: https://github.com/PolicyEngine/policyengine.py/compare/2.2.1...2.2.2
[2.2.1]: https://github.com/PolicyEngine/policyengine.py/compare/2.2.0...2.2.1
[2.2.0]: https://github.com/PolicyEngine/policyengine.py/compare/2.1.0...2.2.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# policyengine.py

[WIP] PolicyEngine's main user-facing Python package, incorporating country packages and integrating data visualization and analytics.
PolicyEngine's main user-facing Python package, incorporating country packages and integrating data visualization and analytics. Read the documentation [here](https://policyengine.github.io/policyengine/policyengine.py).
6 changes: 6 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@
fixed:
- Household simulation example broken due to a type error.
date: 2024-12-06 14:02:41
- bump: minor
changes:
added:
- Household variation charts.
- Region filtering improvements.
date: 2024-12-06 14:07:31
7 changes: 5 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ copyright: "2025"
logo: logo.png

execute:
execute_notebooks: off
execute_notebooks: cache
nikhilwoodruff marked this conversation as resolved.
Show resolved Hide resolved
allow_errors: false

repository:
url: https://github.com/policyengine/policyengine.py
Expand All @@ -19,4 +20,6 @@ sphinx:
html_theme: furo
pygments_style: default
html_css_files:
- style.css
- style.css
extra_extensions:
- "sphinx.ext.autodoc"
5 changes: 3 additions & 2 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ parts:
- caption: Maintenance
chapters:
- file: maintaining
- caption: Schema
- caption: Reference
chapters:
- file: schema
- file: reference/simulation
- file: reference/calculate
19 changes: 12 additions & 7 deletions docs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@
"Generally, PolicyEngine's models' usage falls into a 2x2 of categories:\n",
"\n",
"1. Simulating over a specific household\n",
"\n",
" a. Simulating a particular policy (scenario) over a household (e.g. what benefits am I entitled to now?)\n",
"\n",
" b. Comparing two policies over a household (how would this tax reform affect my net income?)\n",
"2. Simulating over the entire population\n",
"\n",
" a. Simulating a particular policy over the population (what's the poverty rate right now?)\n",
"\n",
" b. Comparing two policies over the population (how would this tax reform affect the poverty rate?)\n",
"\n",
"\n",
"Here's an example of how to use it to calculate how abolishing the Personal Allowance in the UK (US- standard deduction) would affect an earner on £30,000."
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand All @@ -31,7 +36,7 @@
"-2514.0"
]
},
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -66,16 +71,16 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"137.95680800660614"
"130.71499538568372"
]
},
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -84,15 +89,15 @@
"sim = Simulation(\n",
" country=\"uk\",\n",
" scope=\"macro\",\n",
" data=\"enhanced_frs_2022_23\",\n",
" data=\"enhanced_frs\",\n",
" time_period=2025,\n",
" reform={\n",
" \"gov.hmrc.income_tax.allowances.personal_allowance.amount\": {\n",
" \"2025\": 0,\n",
" }\n",
" }\n",
")\n",
"sim.calculate(\"macro/comparison/revenue_impact\")"
"sim.calculate(\"macro/comparison/budget/general/tax_revenue_impact\")/1e9"
]
}
],
Expand Down
Loading
Loading