policyengine 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. policyengine-1.0.1/.github/CONTRIBUTING.md +3 -0
  2. policyengine-1.0.1/.github/changelog_template.md +8 -0
  3. policyengine-1.0.1/.github/fetch_version.py +13 -0
  4. policyengine-1.0.1/.github/get-changelog-diff.sh +2 -0
  5. policyengine-1.0.1/.github/has-functional-changes.sh +12 -0
  6. policyengine-1.0.1/.github/is-version-number-acceptable.sh +33 -0
  7. policyengine-1.0.1/.github/publish-git-tag.sh +4 -0
  8. policyengine-1.0.1/.github/workflows/pr.yml +41 -0
  9. policyengine-1.0.1/.github/workflows/push.yml +64 -0
  10. policyengine-1.0.1/.gitignore +162 -0
  11. policyengine-1.0.1/CHANGELOG.md +22 -0
  12. policyengine-1.0.1/LICENSE +661 -0
  13. policyengine-1.0.1/Makefile +21 -0
  14. policyengine-1.0.1/PKG-INFO +686 -0
  15. policyengine-1.0.1/README.md +3 -0
  16. policyengine-1.0.1/changelog.yaml +10 -0
  17. policyengine-1.0.1/changelog_entry.yaml +0 -0
  18. policyengine-1.0.1/docs/_config.yml +29 -0
  19. policyengine-1.0.1/docs/_static/style.css +9 -0
  20. policyengine-1.0.1/docs/_toc.yml +9 -0
  21. policyengine-1.0.1/docs/index.ipynb +120 -0
  22. policyengine-1.0.1/docs/logo.png +0 -0
  23. policyengine-1.0.1/docs/maintaining.ipynb +94 -0
  24. policyengine-1.0.1/docs/schema.ipynb +449 -0
  25. policyengine-1.0.1/policyengine/__init__.py +1 -0
  26. policyengine-1.0.1/policyengine/constants.py +20 -0
  27. policyengine-1.0.1/policyengine/outputs/household/comparison/net_income_change.py +4 -0
  28. policyengine-1.0.1/policyengine/outputs/household/single/net_income.py +2 -0
  29. policyengine-1.0.1/policyengine/outputs/macro/comparison/budget.py +44 -0
  30. policyengine-1.0.1/policyengine/outputs/macro/comparison/decile/income.py +51 -0
  31. policyengine-1.0.1/policyengine/outputs/macro/comparison/decile/wealth.py +52 -0
  32. policyengine-1.0.1/policyengine/outputs/macro/comparison/detailed_budget.py +28 -0
  33. policyengine-1.0.1/policyengine/outputs/macro/comparison/inequality.py +34 -0
  34. policyengine-1.0.1/policyengine/outputs/macro/comparison/labor_supply_response.py +109 -0
  35. policyengine-1.0.1/policyengine/outputs/macro/comparison/local_areas/parliamentary_constituencies/data.py +27 -0
  36. policyengine-1.0.1/policyengine/outputs/macro/comparison/local_areas/parliamentary_constituencies/heatmap.py +136 -0
  37. policyengine-1.0.1/policyengine/outputs/macro/comparison/poverty/age.py +81 -0
  38. policyengine-1.0.1/policyengine/outputs/macro/comparison/poverty/gender.py +65 -0
  39. policyengine-1.0.1/policyengine/outputs/macro/comparison/poverty/race.py +55 -0
  40. policyengine-1.0.1/policyengine/outputs/macro/comparison/winners/income_decile.py +71 -0
  41. policyengine-1.0.1/policyengine/outputs/macro/comparison/winners/wealth_decile.py +71 -0
  42. policyengine-1.0.1/policyengine/outputs/macro/single/gov/balance.py +18 -0
  43. policyengine-1.0.1/policyengine/outputs/macro/single/gov/local_areas/parliamentary_constituencies.py +47 -0
  44. policyengine-1.0.1/policyengine/outputs/macro/single/gov/programs.py +35 -0
  45. policyengine-1.0.1/policyengine/outputs/macro/single/household/demographics.py +24 -0
  46. policyengine-1.0.1/policyengine/outputs/macro/single/household/finance.py +65 -0
  47. policyengine-1.0.1/policyengine/outputs/macro/single/household/inequality.py +32 -0
  48. policyengine-1.0.1/policyengine/outputs/macro/single/household/labor_supply.py +62 -0
  49. policyengine-1.0.1/policyengine/simulation.py +256 -0
  50. policyengine-1.0.1/policyengine/utils/charts.py +125 -0
  51. policyengine-1.0.1/policyengine/utils/huggingface.py +18 -0
  52. policyengine-1.0.1/policyengine.egg-info/PKG-INFO +686 -0
  53. policyengine-1.0.1/policyengine.egg-info/SOURCES.txt +56 -0
  54. policyengine-1.0.1/policyengine.egg-info/dependency_links.txt +1 -0
  55. policyengine-1.0.1/policyengine.egg-info/requires.txt +13 -0
  56. policyengine-1.0.1/policyengine.egg-info/top_level.txt +1 -0
  57. policyengine-1.0.1/pyproject.toml +62 -0
  58. policyengine-1.0.1/setup.cfg +4 -0
@@ -0,0 +1,3 @@
1
+ ## Updating the versioning
2
+
3
+ Please add to `changelog.yaml` and then run `make changelog` before committing the results ONCE in this PR.
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ {{changelog}}
@@ -0,0 +1,13 @@
1
+ def fetch_version():
2
+ try:
3
+ import pkg_resources
4
+
5
+ version = pkg_resources.get_distribution("policyengine").version
6
+ return version
7
+ except Exception as e:
8
+ print(f"Error fetching version: {e}")
9
+ return None
10
+
11
+
12
+ if __name__ == "__main__":
13
+ print(fetch_version())
@@ -0,0 +1,2 @@
1
+ last_tagged_commit=`git describe --tags --abbrev=0 --first-parent`
2
+ git --no-pager diff $last_tagged_commit -- CHANGELOG.md
@@ -0,0 +1,12 @@
1
+ #! /usr/bin/env bash
2
+
3
+ IGNORE_DIFF_ON="README.md CONTRIBUTING.md Makefile docs/* .gitignore LICENSE* .github/* data/*"
4
+
5
+ last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in master through an unlikely intermediary merge commit
6
+
7
+ if git diff-index --name-only --exit-code $last_tagged_commit -- . `echo " $IGNORE_DIFF_ON" | sed 's/ / :(exclude)/g'` # Check if any file that has not be listed in IGNORE_DIFF_ON has changed since the last tag was published.
8
+ then
9
+ echo "No functional changes detected."
10
+ exit 1
11
+ else echo "The functional files above were changed."
12
+ fi
@@ -0,0 +1,33 @@
1
+ #! /usr/bin/env bash
2
+
3
+ if [[ ${GITHUB_REF#refs/heads/} == master ]]
4
+ then
5
+ echo "No need for a version check on master."
6
+ exit 0
7
+ fi
8
+
9
+ if ! $(dirname "$BASH_SOURCE")/has-functional-changes.sh
10
+ then
11
+ echo "No need for a version update."
12
+ exit 0
13
+ fi
14
+
15
+ current_version=`python .github/fetch_version.py`
16
+
17
+ if git rev-parse --verify --quiet $current_version
18
+ then
19
+ echo "Version $current_version already exists in commit:"
20
+ git --no-pager log -1 $current_version
21
+ echo
22
+ echo "Update the version number in setup.py before merging this branch into master."
23
+ echo "Look at the CONTRIBUTING.md file to learn how the version number should be updated."
24
+ exit 1
25
+ fi
26
+
27
+ if ! $(dirname "$BASH_SOURCE")/has-functional-changes.sh | grep --quiet CHANGELOG.md
28
+ then
29
+ echo "CHANGELOG.md has not been modified, while functional changes were made."
30
+ echo "Explain what you changed before merging this branch into master."
31
+ echo "Look at the CONTRIBUTING.md file to learn how to write the changelog."
32
+ exit 2
33
+ fi
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env bash
2
+
3
+ git tag `python .github/fetch_version.py` # create a new tag
4
+ git push --tags || true # update the repository version
@@ -0,0 +1,41 @@
1
+ name: Pull request
2
+ on:
3
+ pull_request:
4
+ branches: [ main ]
5
+
6
+ jobs:
7
+ Lint:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - name: Check formatting
12
+ uses: "lgeiger/black-action@master"
13
+ with:
14
+ args: ". -l 79 --check"
15
+ Test:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Checkout repo
19
+ uses: actions/checkout@v2
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v2
23
+ with:
24
+ python-version: 3.9
25
+
26
+ - name: install dependencies
27
+ run: |
28
+ pip install jupyter-book
29
+ pip install furo
30
+
31
+ - name: Generate documentation
32
+ run: make documentation
33
+
34
+ - name: Check documentation build
35
+ run: |
36
+ if [ -d "docs/_build/html" ]; then
37
+ echo "Documentation built successfully"
38
+ else
39
+ echo "Documentation build failed"
40
+ exit 1
41
+ fi
@@ -0,0 +1,64 @@
1
+ name: Push
2
+ on:
3
+ push:
4
+ branches: [ main ]
5
+
6
+ jobs:
7
+ Lint:
8
+ runs-on: ubuntu-latest
9
+ if: |
10
+ (github.repository == 'PolicyEngine/policyengine-us')
11
+ && (github.event.head_commit.message == 'Update PolicyEngine US')
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Check formatting
15
+ uses: "lgeiger/black-action@master"
16
+ with:
17
+ args: ". -l 79 --check"
18
+ Publish:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout repo
22
+ uses: actions/checkout@v4
23
+ - name: Setup Python
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: 3.12
27
+ - name: Publish a git tag
28
+ run: ".github/publish-git-tag.sh || true"
29
+ - name: Install package
30
+ run: make install
31
+ - name: Build package
32
+ run: make
33
+ - name: Publish a Python distribution to PyPI
34
+ uses: pypa/gh-action-pypi-publish@release/v1
35
+ with:
36
+ user: __token__
37
+ password: ${{ secrets.PYPI }}
38
+ skip-existing: true
39
+ Deploy:
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - name: Checkout repo
43
+ uses: actions/checkout@v2
44
+
45
+ - name: Setup Python
46
+ uses: actions/setup-python@v2
47
+ with:
48
+ python-version: 3.9
49
+
50
+ - name: install dependencies
51
+ run: |
52
+ pip install jupyter-book
53
+ pip install furo
54
+ pip install sphinx-argparse
55
+
56
+ - name: Generate documentation
57
+ run: make documentation
58
+
59
+ - name: Deploy documentation
60
+ uses: JamesIves/github-pages-deploy-action@releases/v3
61
+ with:
62
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63
+ BRANCH: gh-pages
64
+ FOLDER: docs/_build/html
@@ -0,0 +1,162 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
161
+
162
+ old/
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.1] - 2024-11-30 17:01:37
9
+
10
+ ### Added
11
+
12
+ - Changelog entries.
13
+
14
+ ## [1.0.0] - 2024-11-30 00:00:00
15
+
16
+ ### Added
17
+
18
+ - Initial version of package.
19
+
20
+
21
+
22
+ [1.0.1]: https://github.com/PolicyEngine/policyengine.py/compare/1.0.0...1.0.1