From 38da93e3d36fc85e757e8db9e1ff4c903ce9d523 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 23 Feb 2026 12:55:03 -0500 Subject: [PATCH 1/4] Migrate to pyproject.toml and towncrier fragments Co-Authored-By: Claude Opus 4.6 --- .github/bump_version.py | 81 +++++++++++++++++ .github/workflows/pr.yaml | 27 +++--- .github/workflows/push.yaml | 6 +- Makefile | 7 +- changelog_entry.yaml => changelog.d/.gitkeep | 0 changelog.d/migrate-to-towncrier.changed.md | 1 + pyproject.toml | 84 ++++++++++++++++++ setup.py | 91 -------------------- 8 files changed, 180 insertions(+), 117 deletions(-) create mode 100644 .github/bump_version.py rename changelog_entry.yaml => changelog.d/.gitkeep (100%) create mode 100644 changelog.d/migrate-to-towncrier.changed.md create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/bump_version.py b/.github/bump_version.py new file mode 100644 index 000000000..19aa79079 --- /dev/null +++ b/.github/bump_version.py @@ -0,0 +1,81 @@ +"""Infer semver bump from towncrier fragment types and update version.""" + +import re +import sys +from pathlib import Path + + +def get_current_version(pyproject_path: Path) -> str: + text = pyproject_path.read_text() + match = re.search( + r'^version\s*=\s*"(\d+\.\d+\.\d+)"', text, re.MULTILINE + ) + if not match: + print( + "Could not find version in pyproject.toml", + file=sys.stderr, + ) + sys.exit(1) + return match.group(1) + + +def infer_bump(changelog_dir: Path) -> str: + fragments = [ + f + for f in changelog_dir.iterdir() + if f.is_file() and f.name != ".gitkeep" + ] + if not fragments: + print("No changelog fragments found", file=sys.stderr) + sys.exit(1) + + categories = {f.suffix.lstrip(".") for f in fragments} + for f in fragments: + parts = f.stem.split(".") + if len(parts) >= 2: + categories.add(parts[-1]) + + if "breaking" in categories: + return "major" + if "added" in categories or "removed" in categories: + return "minor" + return "patch" + + +def bump_version(version: str, bump: str) -> str: + major, minor, patch = (int(x) for x in version.split(".")) + if bump == "major": + return f"{major + 1}.0.0" + elif bump == "minor": + return f"{major}.{minor + 1}.0" + else: + return f"{major}.{minor}.{patch + 1}" + + +def update_file(path: Path, old_version: str, new_version: str): + text = path.read_text() + updated = text.replace( + f'version = "{old_version}"', + f'version = "{new_version}"', + ) + if updated != text: + path.write_text(updated) + print(f" Updated {path}") + + +def main(): + root = Path(__file__).resolve().parent.parent + pyproject = root / "pyproject.toml" + changelog_dir = root / "changelog.d" + + current = get_current_version(pyproject) + bump = infer_bump(changelog_dir) + new = bump_version(current, bump) + + print(f"Version: {current} -> {new} ({bump})") + + update_file(pyproject, current, new) + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 92f9fb735..8d153ab13 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -11,25 +11,20 @@ jobs: uses: "lgeiger/black-action@master" with: args: ". -l 79 --check" - check-version: - name: Check version + check-changelog: + name: Check changelog fragment runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Build changelog - run: pip install yaml-changelog>=0.1.7 && make changelog - - name: Preview changelog update - run: ".github/get-changelog-diff.sh" - - name: Check version number has been properly updated - run: .github/is-version-number-acceptable.sh + - name: Check for changelog fragment + run: | + FRAGMENTS=$(find changelog.d -type f ! -name '.gitkeep' | wc -l) + if [ "$FRAGMENTS" -eq 0 ]; then + echo "::error::No changelog fragment found in changelog.d/" + echo "Add one with: echo 'Description.' > changelog.d/\$(git branch --show-current)..md" + echo "Types: added, changed, fixed, removed, breaking" + exit 1 + fi Test: strategy: matrix: diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 8239a1d4e..4815c2bb5 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -23,16 +23,12 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - token: ${{ secrets.POLICYENGINE_GITHUB }} + with: token: ${{ secrets.POLICYENGINE_GITHUB }} - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.13" - name: Build changelog - run: pip install yaml-changelog && make changelog - name: Preview changelog update run: ".github/get-changelog-diff.sh" - name: Update changelog diff --git a/Makefile b/Makefile index 21113623c..eb9be6566 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,5 @@ build: python setup.py sdist bdist_wheel changelog: - build-changelog changelog.yaml --output changelog.yaml --update-last-date --start-from 0.1.0 --append-file changelog_entry.yaml - build-changelog changelog.yaml --org PolicyEngine --repo policyengine-core --output CHANGELOG.md --template .github/changelog_template.md - bump-version changelog.yaml setup.py - rm changelog_entry.yaml || true - touch changelog_entry.yaml \ No newline at end of file + python .github/bump_version.py + towncrier build --yes --version $$(python -c "import re; print(re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1))") \ No newline at end of file diff --git a/changelog_entry.yaml b/changelog.d/.gitkeep similarity index 100% rename from changelog_entry.yaml rename to changelog.d/.gitkeep diff --git a/changelog.d/migrate-to-towncrier.changed.md b/changelog.d/migrate-to-towncrier.changed.md new file mode 100644 index 000000000..865484add --- /dev/null +++ b/changelog.d/migrate-to-towncrier.changed.md @@ -0,0 +1 @@ +Migrated from changelog_entry.yaml to towncrier fragments to eliminate merge conflicts. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..35db6312a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,84 @@ +[project] +name = "policyengine-core" +version = "3.23.6" +description = "Core microsimulation engine enabling country-specific policy models." +readme = "README.md" +authors = [ + { name = "PolicyEngine", email = "hello@policyengine.org" } +] +requires-python = ">=3.10" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: GNU Affero General Public License v3", + "Operating System :: POSIX", + "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Scientific/Engineering :: Information Analysis", +] +dependencies = [ + "dpath<3", + "h5py>=3,<4", + "huggingface_hub>=0.25.1", + "ipython>=8,<9", + "microdf_python>=1.0.0", + "numexpr<3", + "numpy>=2.1.0,<3", + "pandas>=1", + "plotly>=5,<6", + "psutil>=6,<7", + "pytest>=8,<9", + "pyvis>=0.3.2", + "requests>=2,<3", + "sortedcontainers<3", + "standard-imghdr", + "wheel<1", +] + +[project.scripts] +policyengine-core = "policyengine_core.scripts.policyengine_command:main" + +[project.urls] +Homepage = "https://github.com/policyengine/policyengine-core" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = ["policyengine_core"] + +[tool.towncrier] +package = "policyengine_core" +directory = "changelog.d" +filename = "CHANGELOG.md" +title_format = "## [{version}] - {project_date}" +issue_format = "" +underlines = ["", "", ""] + +[[tool.towncrier.type]] +directory = "breaking" +name = "Breaking changes" +showcontent = true + +[[tool.towncrier.type]] +directory = "added" +name = "Added" +showcontent = true + +[[tool.towncrier.type]] +directory = "changed" +name = "Changed" +showcontent = true + +[[tool.towncrier.type]] +directory = "fixed" +name = "Fixed" +showcontent = true + +[[tool.towncrier.type]] +directory = "removed" +name = "Removed" +showcontent = true diff --git a/setup.py b/setup.py deleted file mode 100644 index 10af1d018..000000000 --- a/setup.py +++ /dev/null @@ -1,91 +0,0 @@ -from pathlib import Path - -from setuptools import find_packages, setup - -# Read the contents of our README file for PyPi -this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() - -# Please make sure to cap all dependency versions, in order to avoid unwanted -# functional and integration breaks caused by external code updates. - -general_requirements = [ - "pytest>=8,<9", - # NumPy 2.3+ required for Python 3.14 due to temporary elision bug fix - # See: https://github.com/numpy/numpy/issues/28681 - "numpy>=2.1.0,<3", - "sortedcontainers<3", - "numexpr<3", - "dpath<3", - "psutil>=6,<7", - "wheel<1", - "h5py>=3,<4", - "requests>=2,<3", - "pandas>=1", - "plotly>=5,<6", - "ipython>=8,<9", - "pyvis>=0.3.2", - "microdf_python>=1.0.0", - "huggingface_hub>=0.25.1", - "standard-imghdr", -] - -dev_requirements = [ - "black", - "linecheck<1", - "jupyter-book<1", - "yaml-changelog<1", - "coverage", - "furo<2025", - "markupsafe<3", - "coverage", - "furo", - "mypy<2", - "sphinx==5.0.0", - "sphinx-argparse==0.4.0", - "sphinx-math-dollar==1.2.1", - "types-PyYAML==6.0.12.2", - "types-requests==2.28.11.7", - "types-setuptools==65.6.0.2", - "types-urllib3==1.26.25.4", - "pytest-rerunfailures>=10,<15", -] - -setup( - name="policyengine-core", - version="3.23.6", - author="PolicyEngine", - author_email="hello@policyengine.org", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: GNU Affero General Public License v3", - "Operating System :: POSIX", - "Programming Language :: Python", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Topic :: Scientific/Engineering :: Information Analysis", - ], - description="Core microsimulation engine enabling country-specific policy models.", - keywords="tax benefit microsimulation framework", - license="https://www.fsf.org/licensing/licenses/agpl-3.0.html", - license_files=("LICENSE",), - url="https://github.com/policyengine/policyengine-core", - long_description=long_description, - long_description_content_type="text/markdown", - entry_points={ - "console_scripts": [ - "policyengine-core=policyengine_core.scripts.policyengine_command:main", - ], - }, - python_requires=">=3.10", - extras_require={ - "dev": dev_requirements, - # Note: For Python 3.13, policyengine-us requires special installation - # due to tables==3.9.2 not having Python 3.13 wheels. See CI workflow for workaround. - }, - include_package_data=True, # Will read MANIFEST.in - install_requires=general_requirements, - packages=find_packages(exclude=["tests*"]), -) From cff89b9bf36298bc166334ac1bd6ce86a310ad59 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 23 Feb 2026 12:59:58 -0500 Subject: [PATCH 2/4] Format bump_version.py with black Co-Authored-By: Claude Opus 4.6 --- .github/bump_version.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/bump_version.py b/.github/bump_version.py index 19aa79079..bb0fd6dd3 100644 --- a/.github/bump_version.py +++ b/.github/bump_version.py @@ -7,9 +7,7 @@ def get_current_version(pyproject_path: Path) -> str: text = pyproject_path.read_text() - match = re.search( - r'^version\s*=\s*"(\d+\.\d+\.\d+)"', text, re.MULTILINE - ) + match = re.search(r'^version\s*=\s*"(\d+\.\d+\.\d+)"', text, re.MULTILINE) if not match: print( "Could not find version in pyproject.toml", From f09e58d161129f09c549a81c25721d8200ab0614 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 23 Feb 2026 13:44:42 -0500 Subject: [PATCH 3/4] Fix Makefile and dev dependencies after setup.py removal Co-Authored-By: Claude Opus 4.6 --- Makefile | 2 +- pyproject.toml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index eb9be6566..a17cc83f4 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ test: test-country-template coverage xml -i build: - python setup.py sdist bdist_wheel + python -m build changelog: python .github/bump_version.py diff --git a/pyproject.toml b/pyproject.toml index 35db6312a..58dd172e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,27 @@ dependencies = [ "wheel<1", ] +[project.optional-dependencies] +dev = [ + "build", + "black", + "coverage", + "furo", + "jupyter-book<1", + "markupsafe==2.0.1", + "mypy==0.991", + "pytest-cov", + "pytest-rerunfailures>=10,<15", + "sphinx==5.0.0", + "sphinx-argparse==0.4.0", + "sphinx-math-dollar==1.2.1", + "towncrier>=24.8.0", + "types-PyYAML==6.0.12.2", + "types-requests==2.28.11.7", + "types-setuptools==65.6.0.2", + "types-urllib3==1.26.25.4", +] + [project.scripts] policyengine-core = "policyengine_core.scripts.policyengine_command:main" From 4ed827f3084eb21cdafb60fef9fe8c2437180290 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 24 Feb 2026 05:41:33 -0500 Subject: [PATCH 4/4] Delete old changelog files --- changelog.yaml | 942 ------------------------------------------------- 1 file changed, 942 deletions(-) delete mode 100644 changelog.yaml diff --git a/changelog.yaml b/changelog.yaml deleted file mode 100644 index d1d3dc63c..000000000 --- a/changelog.yaml +++ /dev/null @@ -1,942 +0,0 @@ -- changes: - added: - - OpenFisca-Core forked. - date: 2022-10-02 16:02:00 - version: 0.1.0 -- bump: major - changes: - changed: - - Non-essential (for Python simulations) code removed. - date: 2022-10-02 16:35:17 -- bump: patch - changes: - fixed: - - Version update action. - date: 2022-10-02 16:38:34 -- bump: patch - changes: - fixed: - - Push action doesn't attempt to publish nonexistent documentation. - date: 2022-10-02 16:45:22 -- bump: patch - changes: - fixed: - - Build action always runs. - date: 2022-10-02 16:59:49 -- bump: patch - changes: - added: - - Type hints to most functions and classes. - - Jupyter book documentation for all modules. - date: 2022-10-09 22:33:24 -- bump: patch - changes: - added: - - Test that documentation builds - date: 2022-10-09 22:55:14 -- bump: patch - changes: - fixed: - - Python 3.9 used in all GitHub actions. - date: 2022-10-09 23:00:35 -- bump: minor - changes: - added: - - Microsimulation features - - Documentation for the CLI interface - date: 2022-10-12 15:33:59 -- bump: patch - changes: - added: - - Behaviour to handle default datasets. - date: 2022-10-12 15:58:34 -- bump: patch - changes: - fixed: - - Bug in the country template microsimulation class failing to load data. - date: 2022-10-12 16:25:33 -- bump: patch - changes: - fixed: - - Git blame reassigns OpenFisca-Core authors. - date: 2022-10-12 18:08:43 -- bump: minor - changes: - added: - - Parameter operations from openfisca-tools - - Dataset classes from openfisca-tools - date: 2022-10-14 10:14:40 -- bump: minor - changes: - added: - - Tests and documentation. - date: 2022-10-14 17:18:21 -- bump: minor - changes: - added: - - Performance improvements - - Import sorting and code health improvements - fixed: - - Axes now work in simulations - date: 2022-10-18 15:28:22 -- bump: patch - changes: - added: - - Plotly to dependencies - date: 2022-10-18 18:13:09 -- bump: minor - changes: - added: - - Branched simulations. - date: 2022-10-19 16:01:51 -- bump: minor - changes: - added: - - Derivative calculation in simulations. - date: 2022-10-19 22:44:19 -- bump: minor - changes: - added: - - Metadata dictionary input to Variables. - date: 2022-10-21 12:39:50 -- bump: minor - changes: - changed: - - Parameter scale components now included in `get_descendants()`. - fixed: - - Folder paths in `Dataset`s are parsed as `Path`s. - - Empty `input:` fields are parsed as `{}`. - date: 2022-10-23 13:41:39 -- bump: patch - changes: - removed: - - Python 3.6 stated support. - date: 2022-11-02 01:31:48 -- bump: minor - changes: - fixed: - - Various fixes for PolicyEngine's server app. - date: 2022-11-08 15:00:26 -- bump: minor - changes: - added: - - Variables can now specify an 'uprating' parameter. - - Variables can now specify 'adds' and 'subtracts' variable dependencies. - - Variable folders are now automatically stored in a tree. - fixed: - - Bugs in cloned simulations. - date: 2022-11-24 00:15:28 -- bump: patch - changes: - added: - - Documentation page on reforms. - fixed: - - Moved the uprating logic to after formulas are checked. - date: 2022-11-24 00:33:05 -- bump: patch - changes: - fixed: - - Bug in defined-for causing it to be ignored. - - Branched simulations now cache variables specifically for the branch and time - period, not sharing with the parent simulation. - date: 2022-11-27 14:33:53 -- bump: patch - changes: - fixed: - - Fixed a bug causing Windows tests to fail. - date: 2022-11-27 16:08:33 -- bump: patch - changes: - fixed: - - Removed debug lines. - date: 2022-11-27 16:16:29 -- bump: patch - changes: - added: - - Functionality for getting all known branch-period caches. - date: 2022-11-28 10:37:23 -- bump: patch - changes: - fixed: - - README.md files in parameter trees now inform metadata. - date: 2022-11-30 15:19:56 -- bump: patch - changes: - fixed: - - Various safety checks. - date: 2022-11-30 20:33:21 -- bump: patch - changes: - fixed: - - Singleton files have a shorter moduleName. - date: 2022-12-02 18:11:10 -- bump: patch - changes: - fixed: - - Bug with Enum decoding. - date: 2022-12-03 15:21:15 -- bump: patch - changes: - fixed: - - Removed warning on Enum decoding. - date: 2022-12-05 16:21:04 -- bump: patch - changes: - fixed: - - Include scale brackets in descendants. - date: 2022-12-07 12:51:49 -- bump: patch - changes: - fixed: - - Uprating bug affecting the UK. - date: 2022-12-07 13:41:29 -- bump: patch - changes: - fixed: - - Git config now ignores JetBrains IDE config files - date: 2022-12-11 23:46:33 -- bump: patch - changes: - fixed: - - Added documentation on populating changelog entries. Also created a CONTRIBUTING.md - symlink to make contributing guidelines easier to find. - date: 2022-12-11 23:52:13 -- bump: patch - changes: - added: - - Hidden input field for variables. - date: 2022-12-12 15:28:47 -- bump: patch - changes: - added: - - Added mypy to our test suite to prevent new type regressions - date: 2022-12-13 23:40:47 -- bump: patch - changes: - added: - - Added `basic_inputs`, a metadata field for the basic inputs needed to get a - country model running. - date: 2022-12-14 15:33:46 -- bump: patch - changes: - fixed: - - Bugs with Enum inputs. - date: 2022-12-15 15:27:35 -- bump: patch - changes: - fixed: - - Fixed mypy errors in tests/core/test_entities.py - date: 2022-12-17 09:23:10 -- bump: patch - changes: - fixed: - - Fixed mypy errors in policyengine_core/tracers/tracing_parameter_node_at_instant.py - date: 2022-12-17 16:36:53 -- bump: patch - changes: - changed: - - Removed seemingly unused "N_" function - date: 2022-12-17 21:51:59 -- bump: patch - changes: - added: - - Fixed mypy errors in several files. - date: 2022-12-18 06:07:32 -- bump: patch - changes: - fixed: - - Fix incorrect type annotation in policyengine_core/variables/variable.py - date: 2022-12-18 06:12:52 -- bump: patch - changes: - changed: - - Pin all package versions. - date: 2023-01-02 20:40:49 -- bump: minor - changes: - added: - - Adds/subtracts option for parameter names. - date: 2023-01-03 20:50:02 -- bump: patch - changes: - added: - - A metadata option to specify which policies are modelled and not modelled. - date: 2023-01-04 12:51:00 -- bump: patch - changes: - added: - - Error message for an unknown variable. - date: 2023-01-04 13:05:49 -- bump: patch - changes: - removed: - - aggr function, which is superseded by add. - date: 2023-01-10 17:32:23 -- bump: patch - changes: - fixed: - - Labels and names aren't propagated in parameters. - date: 2023-01-11 23:44:12 -- bump: minor - changes: - added: - - Likely high time savings for simulations making heavy usage of reforms and branches. - date: 2023-01-27 22:28:10 -- bump: patch - changes: - added: - - Abolition parameters for each variable under `gov.abolitions`. - date: 2023-01-28 15:58:38 -- bump: patch - changes: - added: - - Option for loading non-year-specific datasets. - date: 2023-02-09 21:59:16 -- bump: patch - changes: - fixed: - - Branches stay persistent between variables. - date: 2023-03-04 22:58:51 -- bump: patch - changes: - fixed: - - Removed bad dependency fixes. - date: 2023-03-08 21:35:17 -- bump: major - changes: - changed: - - Datasets API simplified and made more consistent. - date: 2023-03-23 02:37:29 -- bump: patch - changes: - fixed: - - A bug where public datasets would fail to download. - date: 2023-03-23 08:55:46 -- bump: patch - changes: - changed: - - Added ability to pull datasets from GitHub releases. - date: 2023-03-31 18:27:52 -- bump: patch - changes: - changed: - - Removed node homogenuity check for speed. - date: 2023-04-14 10:06:10 -- bump: patch - changes: - fixed: - - Bug causing simulations containing multiple group entities and axes to fail - to simulate. - date: 2023-05-23 07:35:11 -- bump: minor - changes: - added: - - Python 3.10 support. - fixed: - - PyTest syntax updated. - date: 2023-05-23 13:22:04 -- bump: patch - changes: - fixed: - - Fixed pytest deprecated usages since version 7, and fixed a bug that prevented - new package from publishing. - date: 2023-05-24 15:11:39 -- bump: minor - changes: - fixed: - - Bug causing unhelpful errors when variables are not found. - date: 2023-05-31 11:11:09 -- bump: patch - changes: - fixed: - - A bug causing variable not found errors to sometimes fail to throw. - date: 2023-06-02 15:22:29 -- bump: minor - changes: - added: - - Optional argument for saving datasets to a specific file path. - - Safety check for Path objects not being strings. - date: 2023-06-30 08:22:27 -- bump: minor - changes: - added: - - Chart formatting utilities. - date: 2023-07-21 14:55:15 -- bump: minor - changes: - added: - - Chart formatting utilities. - date: 2023-08-02 12:54:44 -- bump: minor - changes: - fixed: - - Bump numpy version - - Fix numpy record compatibility issue - date: 2023-10-04 14:51:40 -- bump: minor - changes: - added: - - Automatic period adjustment helper functionality. - changed: - - Default error threshold for tests widened to 1e-3. - date: 2023-10-04 19:05:58 -- bump: patch - changes: - fixed: - - Fix bug affecting microsimulation runs in countries which use automatic period - adjustments. - date: 2023-10-05 11:00:40 -- bump: minor - changes: - added: - - Support for adds/subtracts targeting parameters. - - Support for adds/subtracts targeting year ranges where no parameters exist. - changed: - - Deprecated sum_of_variables. - date: 2023-10-05 11:41:53 -- bump: patch - changes: - fixed: - - Bug causing YAML tests to not populate `Simulation.input_variables`. - date: 2023-10-05 13:24:20 -- bump: patch - changes: - changed: - - Unpinned lower NumPy pin. - date: 2023-10-09 17:52:02 -- bump: minor - changes: - added: - - PolicyEngine API integration for reforms. - date: 2023-11-12 13:23:23 -- bump: minor - changes: - fixed: - - Reforms always apply before parameter utilities. - date: 2023-11-22 15:05:43 -- bump: minor - changes: - fixed: - - Reforms always apply before parameter utilities. - date: 2023-11-22 15:55:52 -- bump: patch - changes: - fixed: - - Bug causing `subtracts` to not accept strings. - date: 2023-11-30 18:45:01 -- bump: patch - changes: - fixed: - - Bug causing random behaviour differences between situations with and without - axes. - date: 2023-12-14 11:38:52 -- bump: patch - changes: - fixed: - - Random seed fixed for each simulation. - date: 2023-12-16 15:34:37 -- bump: patch - changes: - added: - - Tools for branching - date: 2023-12-19 11:12:24 -- bump: patch - changes: - fixed: - - Randomness issue. - date: 2023-12-21 10:55:47 -- bump: minor - changes: - added: - - API ID to reform object functionality. - date: 2023-12-26 18:31:31 -- bump: patch - changes: - fixed: - - API to reform functionality made more editable. - date: 2023-12-27 13:28:08 -- bump: minor - changes: - added: - - Simulation helper to extract individual households from a microsimulation. - date: 2024-01-02 15:26:52 -- bump: patch - changes: - added: - - Improvements to error handling in bad variable declarations. - date: 2024-02-06 11:28:22 -- bump: minor - changes: - changed: - - A variable must have a label. - - If a variable has formulas then it must not have adds/subtracts, and vice versa. - date: 2024-02-06 17:28:06 -- bump: minor - changes: - added: - - Variable inheritance in declarations. - date: 2024-02-08 14:32:38 -- bump: minor - changes: - removed: - - Error raising for adds/subtracts properties plus a formula. - date: 2024-02-14 14:49:15 -- bump: patch - changes: - fixed: - - Fixed a bug in Core monthlyisation. - date: 2024-02-29 16:03:09 -- bump: minor - changes: - changed: - - Add method for propagating units to descendants for ParameterScale objects - date: 2024-03-04 11:27:40 -- bump: patch - changes: - fixed: - - Breakdown-added parameters no longer precede uprating indices. - date: 2024-03-05 13:01:42 -- bump: minor - changes: - added: - - Parameters can now be uprated based upon fixed cadences - date: 2024-03-22 10:42:19 -- bump: minor - changes: - added: - - Baseline parameter node. - date: 2024-04-16 12:51:42 -- bump: patch - changes: - fixed: - - FutureWarning issue with bools and enums. - date: 2024-04-29 15:06:58 -- bump: patch - changes: - added: - - IPython to dependencies - date: 2024-05-06 12:47:34 -- bump: minor - changes: - added: - - Macro impact caching. - - Dictionary-input start-stop date reform handling. - fixed: - - Uprating bugs. - date: 2024-05-06 14:24:08 -- bump: minor - changes: - added: - - Ability to turn off read and write features in the macro cache. - date: 2024-05-07 12:16:05 -- bump: patch - changes: - fixed: - - Bug in macro caching logic. - date: 2024-05-07 15:44:58 -- bump: patch - changes: - fixed: - - Generation of enum-typed variables - date: 2024-05-08 08:44:48 -- bump: patch - changes: - added: - - Dependency upgrade for pytest, from 7 to 8. - date: 2024-05-08 13:36:00 -- bump: patch - changes: - added: - - Added `.vscode` and `venv` to `.gitignore` file. - removed: - - Removed `.vscode` folder from the repository. - date: 2024-05-08 13:39:53 -- bump: patch - changes: - fixed: - - Bug in macro cache logic. - date: 2024-05-08 15:07:51 -- bump: patch - changes: - changed: - - Replaced unsafe numpy-Python comparison with use of numpy dtype to convert byte-string - arrays to Unicode ones within enums - date: 2024-05-13 16:26:53 -- bump: patch - changes: - fixed: - - Remove name metadata tag in docs. - date: 2024-05-14 15:27:27 -- bump: patch - changes: - fixed: - - Uncap coverage. - date: 2024-05-14 15:33:07 -- bump: minor - changes: - fixed: - - Bug causing reforms affecting data to not affect caches. - date: 2024-05-31 11:12:13 -- bump: minor - changes: - added: - - max_value and min_value in Variable class. - date: 2024-06-04 19:43:13 -- bump: patch - changes: - added: Visualization option when running tests - date: 2024-06-06 09:09:41 -- bump: major - changes: - changed: - - Added support for Python 3.12 - date: 2024-06-26 17:08:24 -- bump: minor - changes: - added: - - Flat file dataset option. - - Microdata weighting classes from microdf. - - Eternity dictionary reform options. - date: 2024-07-26 00:28:31 -- bump: minor - changes: - changed: - - Reform syntax to increase flexibility. - date: 2024-07-28 19:28:05 -- bump: minor - changes: - added: - - Simulation loading from dataframes. - - Simulation `start_instant` attribute. - date: 2024-08-02 09:09:51 -- bump: minor - changes: - added: - - Flat file export option to simulations. - date: 2024-08-07 12:42:36 -- bump: minor - changes: - removed: - - Removed nptyping, migrated to numpy.typing - date: 2024-08-08 15:16:12 -- bump: patch - changes: - fixed: - - fixed bug where uprating was causing nan. - date: 2024-08-08 15:17:05 -- bump: patch - changes: - changed: - - change mypy version from 1.11.1 to <2 - date: 2024-08-17 19:28:38 -- bump: patch - changes: - changed: - - Fixed script to initialize a reform within the simulation - date: 2024-08-21 14:34:52 -- bump: minor - changes: - fixed: - - Bugs in typing and Dataset saving. - date: 2024-08-28 16:41:26 -- bump: patch - changes: - added: - - Added class SimulationMacroCache for macro simulation caching purposes. - date: 2024-08-31 16:13:07 -- bump: patch - changes: - added: - - Added class SimulationMacroCache for macro simulation caching purposes. - date: 2024-09-02 13:04:21 -- bump: patch - changes: - fixed: - - Syntax error in Simulation class - date: 2024-09-02 22:01:19 -- bump: patch - changes: - changed: - - Ensure that every instance of 'Simulation' class has 'dataset' attribute, even - if equal to 'None' - - Add better safeguards to 'check_macro_cache' method of 'Simulation' class - date: 2024-09-03 18:42:55 -- bump: patch - changes: - fixed: - - Corrected logic with Simulation.check_macro_cache to prevent undesirable caching - date: 2024-09-04 21:19:20 -- bump: patch - changes: - changed: - - Disable macro cache by default. - date: 2024-09-09 13:52:47 -- bump: minor - changes: - added: - - Simulation subsampling. - date: 2024-09-24 18:10:25 -- bump: patch - changes: - changed: - - Renamed sim_macro_cache.py to simulation_macro_cache.py - date: 2024-09-26 00:13:13 -- bump: minor - changes: - added: - - Randomness based on entity IDs as seeds. - - OpenFisca-Core imports. - date: 2024-09-26 12:00:25 -- bump: patch - changes: - changed: - - Set test runner's default period as underlying simulation's default period - - Prevented crashing when absolutely no date is provided anywhere for tests - date: 2024-09-27 10:43:12 -- bump: patch - changes: - changed: - - Updated README.md - date: 2024-10-01 19:33:10 -- bump: minor - changes: - changed: - - Shallow copy entities between TaxBenefitSystem objects when cloning - date: 2024-10-09 20:29:35 -- bump: minor - changes: - added: - - Two tests related to extensions that were previously removed - changed: - - Shallow copy GroupEntities and PopulationEntity when cloning TaxBenefitSystem - object - date: 2024-10-17 15:59:10 -- bump: minor - changes: - fixed: - - Bug causing subsample to not work in some situations. - date: 2024-10-24 11:04:12 -- bump: patch - changes: - changed: - - Replace custom implementation of microdf with deployed version - date: 2024-10-29 20:04:02 -- bump: minor - changes: - changed: - - update the ipython requirement to version 8 - date: 2024-10-30 18:46:15 -- bump: patch - changes: - fixed: - - Bug causing Enums to fail in some simulations. - date: 2024-11-01 11:36:53 -- bump: patch - changes: - added: - - Compatibility settings for editable installs - date: 2024-11-01 21:39:35 -- bump: patch - changes: - fixed: - - Bug in labour supply responses. - date: 2024-11-04 16:29:34 -- bump: patch - changes: - fixed: - - Datasets writing downloaded data now use an atomic_write to write it to disk. - This prevents other processes attempting to read a partial file or clobbering - each other. - date: 2024-11-11 14:20:12 -- bump: patch - changes: - changed: - - update the psutil requirement to version 6 - - update the furo requirment to <2025 - - update the markupsafe requirement to <3 - date: 2024-11-20 13:13:13 -- bump: minor - changes: - added: - - HuggingFace upload/download functionality. - date: 2024-11-27 13:12:44 -- bump: minor - changes: - added: - - Support for HuggingFace-hosted H5 file inputs. - date: 2024-11-29 16:08:25 -- bump: patch - changes: - changed: - - Replaced coexistent standard/HuggingFace URL with standalone URL parameter - - Fixed bugs in download_from_huggingface() method - - Create utility function for pulling HuggingFace env var - date: 2024-12-02 16:35:14 -- bump: minor - changes: - added: - - Chained reform handling in TaxBenefitSystems. - date: 2024-12-05 14:47:01 -- bump: minor - changes: - changed: - - Refactor all Hugging Face downloads to use the same download function - - Attempt to determine whether a token is necessary before downloading from Hugging - Face - - Add tests for this new functionality - date: 2024-12-18 15:12:25 -- bump: patch - changes: - changed: - - Explicitly set local directory when downloading datasets from Hugging Face - date: 2024-12-20 12:56:31 -- bump: patch - changes: - fixed: - - Bug in parametric reforms. - date: 2025-01-28 07:08:07 -- bump: patch - changes: - fixed: - - Fix file writing on windows. - date: 2025-02-06 15:38:10 -- bump: patch - changes: - fixed: - - Bug causing some reforms to fail. - date: 2025-03-25 15:06:42 -- bump: patch - changes: - fixed: - - Subsampling logic. - date: 2025-04-02 09:54:58 -- bump: patch - changes: - added: - - Error handling for HF downloads. - date: 2025-04-09 09:40:30 -- bump: minor - changes: - added: - - Default input and output periods to Simulation constructor. - date: 2025-06-05 20:14:47 -- bump: patch - changes: - fixed: - - Bug causing to_input_dataframe to include bad time periods. - date: 2025-07-12 14:22:53 -- bump: minor - changes: - changed: - - Update microdf_python dependency to >=1.0.0. - date: 2025-07-22 20:16:08 -- bump: minor - changes: - changed: - - added support for python 3.13.0 - - upgraded dependency to numpy 2.1.0 - date: 2025-07-23 00:48:51 -- bump: patch - changes: - fixed: - - Add test retry mechanism to handle intermittent CI failures - date: 2025-07-24 14:00:15 -- bump: patch - changes: - fixed: - - Fix NumPy 2.1.0 random seed overflow issue by ensuring seeds are always non-negative - date: 2025-07-24 17:03:30 -- bump: patch - changes: - added: - - regression test ensuring base Projector.transform raises - fixed: - - Projector.transform now raises NotImplementedError - date: 2025-07-24 18:10:45 -- bump: patch - changes: - fixed: - - UK microsimulation class handling. - date: 2025-07-28 09:17:29 -- bump: minor - changes: - added: - - Easy way to update parameters with uprating behaviour. - date: 2025-08-12 15:53:31 -- bump: patch - changes: - fixed: - - NumPy 2.x structured array dtype compatibility when using axes with parameters - that have different field subsets (e.g., ACA rating areas) - date: 2025-10-01 17:01:19 -- bump: minor - changes: - added: - - Subdirectory support for hf:// URLs (e.g., hf://owner/repo/path/to/file.h5). - - Google Cloud Storage support with gs:// URL scheme (e.g., gs://bucket/path/to/file.h5). - date: 2025-11-27 16:18:36 -- bump: minor - changes: - changed: - - Optimised enum encoding using searchsorted instead of np.select. - - Optimised empty_clone using object.__new__() instead of dynamic type creation. - - Added lru_cache to period and instant string parsing. - - Vectorised random() function using PCG hash instead of per-entity RNG instantiation. - Note that this changes random value sequences - simulations using random() will - produce different (but still deterministic) values. - - Added warning logging for invalid enum string values during encoding. - date: 2025-12-01 15:19:17 -- bump: patch - changes: - fixed: - - Issue of running on windows because of not having UTF-8 encoding. - date: 2025-12-02 15:43:09 -- bump: patch - changes: - fixed: - - Allow NumPy 2.3+ for Python 3.14 compatibility (fixes temporary elision bug - causing incorrect microsimulation results) - date: 2025-12-03 01:03:13 -- bump: minor - changes: - changed: - - Invalid enum values now raise ValueError instead of logging a warning and returning - index 0. This prevents silent data corruption when incorrect enum strings are - passed to simulations. - date: 2025-12-03 22:11:27 -- bump: patch - changes: - fixed: - - Optimisation improvements for loading tax-benefit systems (caching). - date: 2025-12-14 23:36:30 -- bump: patch - changes: - added: - - Documentation for Reform.from_dict() method with examples covering basic reforms, - multiple parameters, bracket syntax, period formats, and Microsimulation integration. - date: 2026-01-15 22:17:08 -- bump: patch - changes: - fixed: - - Handle empty HUGGING_FACE_TOKEN gracefully in CI environments. Empty strings - are now treated the same as None, and non-interactive environments (like CI) - return None instead of hanging on getpass prompt. - date: 2026-01-17 18:14:48 -- bump: patch - changes: - fixed: - - Fixed pandas 3.0 compatibility issues with StringDtype and StringArray - date: 2026-01-24 15:41:39 -- bump: patch - changes: - fixed: - - Fixed pandas 3.0 compatibility in Enum.encode() by using positional access (.iloc[0]) - for pandas Series instead of label-based access (array[0]), which fails with - KeyError when Series has a non-integer index (fixes - date: 2026-01-25 04:19:17 -- bump: patch - changes: - fixed: - - Fixed pandas 3.0 compatibility in ParameterNodeAtInstant.__getitem__() by converting - pandas StringArray to numpy array before using for fancy indexing (fixes - date: 2026-01-25 14:03:25