From 927263a6ec2cc17cdcd3b7b3122e9b568b5b6cad Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 12:59:40 +0200 Subject: [PATCH 01/37] Extract general requirements to file --- requirements/install.in | 70 +++++++++++++++++++++++++++++++++++++++++ setup.py | 66 +++++++++++++++----------------------- 2 files changed, 95 insertions(+), 41 deletions(-) create mode 100644 requirements/install.in diff --git a/requirements/install.in b/requirements/install.in new file mode 100644 index 0000000000..24eeab6f64 --- /dev/null +++ b/requirements/install.in @@ -0,0 +1,70 @@ +# Please make sure to cap all dependency versions, in order to avoid unwanted +# functional and integration breaks caused by external code updates. +# +# These are general dependencies, so: +# +# * the ranges should be broad, and +# * the number of them kept discreet. +# +# If a dependency seems trivial, please propose a pull request to remove it. +# +# General Rule +# ======== +# +# * Cap to latest major. +# +# NumPy Rule +# ======== +# +# * Cap to latest four minors (document why). +# +# Exceptions +# ======== +# +# * Avoiding a version (document why). +# * Pinning a version (document why). + +# For globing over dictionaries as if they were filesystems +# +# We do not support 2 because of a bug introducted to period parsing in +# OpenFisca's Web API. +dpath ~= 1.5 + +# For evaluating numerical expressions +# +# TODO: support for 2 should be extended. +numexpr ~= 2.7 + +# For vectorial support +# +# We support the latest four minors because NumPy is generally a transitive +# dependency that users rely on within the projects where OpenFisca is +# depended on by. +# +# TODO: support for < 1.17 should be dropped. +numpy ~= 1.11, < 1.21 + +# For caching +# +# We support psutil >= 5.4.7 because users have found problems running +# older versions on Windows (specifically 5.4.2). +# TODO: support should be extended to >= 5.4.3. +psutil >= 5.4.7, < 6 + +# For openfisca test +# +# TODO: support for 4 should be dropped. +# TODO: support for 6 requires fixing some tests. +# See: https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent +pytest >= 4.4.1, < 6 + +# For parameters, tests +# +# TODO: support for 3 should be dropped. +# TODO: support for 4 should be dropped. +PyYAML >= 3.10, < 6 + +# For sorting formulas by date +# +# TODO: support for 2 should be extended. +sortedcontainers == 2.2.2 diff --git a/setup.py b/setup.py index 36e30a751e..1d209f0d48 100644 --- a/setup.py +++ b/setup.py @@ -1,43 +1,28 @@ #! /usr/bin/env python +from __future__ import annotations + +from typing import List + +import re from setuptools import setup, find_packages -# Please make sure to cap all dependency versions, in order to avoid unwanted -# functional and integration breaks caused by external code updates. -general_requirements = [ - 'dpath >= 1.5.0, < 2.0.0', - 'nptyping == 1.4.4', - 'numexpr >= 2.7.0, <= 3.0', - 'numpy >= 1.11, < 1.21', - 'psutil >= 5.4.7, < 6.0.0', - 'pytest >= 4.4.1, < 6.0.0', # For openfisca test - 'PyYAML >= 3.10', - 'sortedcontainers == 2.2.2', - 'typing-extensions == 3.10.0.2', - ] +def load_requirements_from_file(filename: str) -> List[str]: + """Allows for composable requirement files with the `-r filename` flag.""" + + reqs = open(f"requirements/{filename}").readlines() + pattern = re.compile(r"^\s*-r\s*(?P.*)$") + + for req in reqs: + match = pattern.match(req) -api_requirements = [ - 'flask == 1.1.2', - 'flask-cors == 3.0.10', - 'gunicorn >= 20.0.0, < 21.0.0', - 'werkzeug >= 1.0.0, < 2.0.0', - ] + if match: + reqs.remove(req) + reqs.extend(load_requirements_from_file(match.group("filename"))) + + return reqs -dev_requirements = [ - 'autopep8 >= 1.4.0, < 1.6.0', - 'coverage == 6.0.2', - 'darglint == 1.8.0', - 'flake8 >= 3.9.0, < 4.0.0', - 'flake8-bugbear >= 19.3.0, < 20.0.0', - 'flake8-docstrings == 1.6.0', - 'flake8-print >= 3.1.0, < 4.0.0', - 'flake8-rst-docstrings == 0.2.3', - 'mypy == 0.910', - 'openfisca-country-template >= 3.10.0, < 4.0.0', - 'openfisca-extension-template >= 1.2.0rc0, < 2.0.0', - 'pylint == 2.10.2', - ] + api_requirements setup( name = 'OpenFisca-Core', @@ -49,7 +34,6 @@ 'License :: OSI Approved :: GNU Affero General Public License v3', 'Operating System :: POSIX', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Topic :: Scientific/Engineering :: Information Analysis', ], @@ -57,7 +41,6 @@ keywords = 'benefit microsimulation social tax', license = 'https://www.fsf.org/licensing/licenses/agpl-3.0.html', url = 'https://github.com/openfisca/openfisca-core', - data_files = [ ( 'share/openfisca/openfisca-core', @@ -70,14 +53,15 @@ 'openfisca-run-test=openfisca_core.scripts.openfisca_command:main', ], }, + python_requires = ">= 3.7", + install_requires = load_requirements_from_file("install"), extras_require = { - 'web-api': api_requirements, - 'dev': dev_requirements, - 'tracker': [ - 'openfisca-tracker == 0.4.0', - ], + "coverage": load_requirements_from_file("coverage"), + "dev": load_requirements_from_file("dev"), + "publication": load_requirements_from_file("publication"), + "tracker": load_requirements_from_file("tracker"), + "web-api": load_requirements_from_file("web-api"), }, include_package_data = True, # Will read MANIFEST.in - install_requires = general_requirements, packages = find_packages(exclude=['tests*']), ) From 027256ab1e9ee42db3e3b5d9cc2725d4ee476c8f Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 13:27:07 +0200 Subject: [PATCH 02/37] Extract api requirements to file --- requirements/web-api.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 requirements/web-api.in diff --git a/requirements/web-api.in b/requirements/web-api.in new file mode 100644 index 0000000000..fc8970d994 --- /dev/null +++ b/requirements/web-api.in @@ -0,0 +1,16 @@ +# Please make sure to pin all dependency versions, in order to avoid unwanted +# functional and integration breaks caused by external code updates. +# +# These are web-api dependencies, so pin them. + +# For OpenFisca's Web API. +# +# TODO: pin. +flask == 1.1.2 +gunicorn >= 20.0.0, < 21.0.0 + +# For OpenFisca's Web API users requiring CORS. +# +# TODO: pin. +flask-cors == 3.0.10 +werkzeug >= 1.0.0, < 2.0.0 From 0076c6fdc9c9d07fd8fd1e0d7a425a30bbc15b2f Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 13:57:57 +0200 Subject: [PATCH 03/37] Extract ci requirements to file --- .circleci/config.yml | 5 +++-- openfisca_tasks/install.mk | 5 +++-- requirements/coverage.in | 5 +++++ requirements/publication.in | 8 ++++++++ requirements/tracking.in | 7 +++++++ 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 requirements/coverage.in create mode 100644 requirements/publication.in create mode 100644 requirements/tracking.in diff --git a/.circleci/config.yml b/.circleci/config.yml index 67c45002e0..416fb281c1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -127,7 +127,7 @@ jobs: name: Submit coverage to Coveralls command: | source /tmp/venv/openfisca_core/bin/activate - pip install coveralls + pip install --editable .[coverage] coveralls - save_cache: @@ -153,9 +153,10 @@ jobs: command: if ! .circleci/has-functional-changes.sh ; then circleci step halt ; fi - run: - name: Upload a Python package to Pypi + name: Upload a Python package to PyPi command: | source /tmp/venv/openfisca_core/bin/activate + pip install --editable .[publication] .circleci/publish-python-package.sh - run: diff --git a/openfisca_tasks/install.mk b/openfisca_tasks/install.mk index f37d17f26f..7918c76b14 100644 --- a/openfisca_tasks/install.mk +++ b/openfisca_tasks/install.mk @@ -1,8 +1,9 @@ ## Install project dependencies. install: @$(call print_help,$@:) - @pip install --upgrade pip twine wheel - @pip install --editable .[dev] --upgrade --use-deprecated=legacy-resolver + @pip install --upgrade pip setuptools + @pip install --requirement requirements/dev --upgrade + @pip install --editable . --upgrade --no-dependencies ## Uninstall project dependencies. uninstall: diff --git a/requirements/coverage.in b/requirements/coverage.in new file mode 100644 index 0000000000..9dcd97d83d --- /dev/null +++ b/requirements/coverage.in @@ -0,0 +1,5 @@ +# These are dependencies to upload test coverage statistics, so we always want +# the latest versions. + +# For sending test statistics to the Coveralls third-party service. +coveralls diff --git a/requirements/publication.in b/requirements/publication.in new file mode 100644 index 0000000000..85d4ccd2ea --- /dev/null +++ b/requirements/publication.in @@ -0,0 +1,8 @@ +# These are dependencies to publish the library, so we always want the latest +# versions. + +# For publishing on PyPI. +twine + +# For building the package. +wheel diff --git a/requirements/tracking.in b/requirements/tracking.in new file mode 100644 index 0000000000..929c660ee4 --- /dev/null +++ b/requirements/tracking.in @@ -0,0 +1,7 @@ +# Please make sure to pin all dependency versions, in order to avoid unwanted +# functional and integration breaks caused by external code updates. +# +# These are web-api tracking dependencies, so pin them. + +# For sending usage statistics to the Matomo third-party service. +openfisca-tracker == 0.4.0 From 98fe43a4d41fb65f67078366c726fd8e6fc51eed Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 14:58:42 +0200 Subject: [PATCH 04/37] Extract dev requirements to file --- requirements/debug.in | 5 +++++ requirements/dev.in | 28 ++++++++++++++++++++++++ requirements/{tracking.in => tracker.in} | 0 3 files changed, 33 insertions(+) create mode 100644 requirements/debug.in create mode 100644 requirements/dev.in rename requirements/{tracking.in => tracker.in} (100%) diff --git a/requirements/debug.in b/requirements/debug.in new file mode 100644 index 0000000000..59cf404cae --- /dev/null +++ b/requirements/debug.in @@ -0,0 +1,5 @@ +# These are dependencies to help with debug and profiling, so we always want +# the latest versions. + +# Interactive console on steroids (even makes your coffee)! +ipython diff --git a/requirements/dev.in b/requirements/dev.in new file mode 100644 index 0000000000..fcced7d54f --- /dev/null +++ b/requirements/dev.in @@ -0,0 +1,28 @@ +# Please make sure to pin all dependency versions, in order to avoid unwanted +# functional and integration breaks caused by external code updates. +# +# These are dev dependencies, so pin them. + +# For automatic style formatting. +# +# TODO: pin +autopep8 >= 1.4.0, < 1.6.0 + +# For style & code checking. +flake8 >= 3.9.0, < 4.0.0 +flake8-bugbear >= 19.3.0, < 20.0.0 +flake8-print >= 3.1.0, < 4.0.0 +flake8-rst-docstrings == 0.2.3 + +# For PyTest test coverage integration. +pytest-cov >= 2.6.1, < 3.0.0 + +# For optional duck & static type checking. +mypy >= 0.701, < 0.800 + +# For testing: parameters, variables, etc. +openfisca-country-template >= 3.10.0, < 4.0.0 +openfisca-extension-template >= 1.2.0rc0, < 2.0.0 + +# Include Web API dependencies for development +-r web-api.in diff --git a/requirements/tracking.in b/requirements/tracker.in similarity index 100% rename from requirements/tracking.in rename to requirements/tracker.in From cc2dccd5f80fef443fecddfd05678bbcc0d745a8 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 15:08:50 +0200 Subject: [PATCH 05/37] Pin dev requirements --- requirements/dev.in | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/requirements/dev.in b/requirements/dev.in index fcced7d54f..ffc8007a23 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -4,25 +4,23 @@ # These are dev dependencies, so pin them. # For automatic style formatting. -# -# TODO: pin -autopep8 >= 1.4.0, < 1.6.0 +autopep8 == 1.5.7 # For style & code checking. -flake8 >= 3.9.0, < 4.0.0 -flake8-bugbear >= 19.3.0, < 20.0.0 -flake8-print >= 3.1.0, < 4.0.0 +flake8 == 3.9.1 +flake8-bugbear == 21.4.3 +flake8-print == 4.0.0 flake8-rst-docstrings == 0.2.3 # For PyTest test coverage integration. -pytest-cov >= 2.6.1, < 3.0.0 +pytest-cov == 2.11.1 # For optional duck & static type checking. -mypy >= 0.701, < 0.800 +mypy == 0.812 # For testing: parameters, variables, etc. -openfisca-country-template >= 3.10.0, < 4.0.0 -openfisca-extension-template >= 1.2.0rc0, < 2.0.0 +openfisca-country-template == 3.12.5 +openfisca-extension-template == 1.3.6 # Include Web API dependencies for development -r web-api.in From 9fbb223a8272840242061e663bf7cbc3212c55d1 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 15:14:10 +0200 Subject: [PATCH 06/37] Pin api requirements --- requirements/web-api.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/requirements/web-api.in b/requirements/web-api.in index fc8970d994..614541cefe 100644 --- a/requirements/web-api.in +++ b/requirements/web-api.in @@ -4,13 +4,9 @@ # These are web-api dependencies, so pin them. # For OpenFisca's Web API. -# -# TODO: pin. flask == 1.1.2 -gunicorn >= 20.0.0, < 21.0.0 +gunicorn == 20.1.0 # For OpenFisca's Web API users requiring CORS. -# -# TODO: pin. flask-cors == 3.0.10 -werkzeug >= 1.0.0, < 2.0.0 +werkzeug == 1.0.1 From 65207fe25970b44dac0a1d41a02862b3c0964228 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 15:53:36 +0200 Subject: [PATCH 07/37] Relax sortedcontainers --- requirements/install.in | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/requirements/install.in b/requirements/install.in index 24eeab6f64..90eb9b65e2 100644 --- a/requirements/install.in +++ b/requirements/install.in @@ -64,7 +64,5 @@ pytest >= 4.4.1, < 6 # TODO: support for 4 should be dropped. PyYAML >= 3.10, < 6 -# For sorting formulas by date -# -# TODO: support for 2 should be extended. -sortedcontainers == 2.2.2 +# For sorting formulas by period. +sortedcontainers >= 2, < 3 From 024400c1552274d5945c41e262fb717d9cbaa7a8 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 16:03:04 +0200 Subject: [PATCH 08/37] Relax psutil --- requirements/install.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/requirements/install.in b/requirements/install.in index 90eb9b65e2..49934634f4 100644 --- a/requirements/install.in +++ b/requirements/install.in @@ -44,11 +44,10 @@ numexpr ~= 2.7 # TODO: support for < 1.17 should be dropped. numpy ~= 1.11, < 1.21 -# For caching +# Memory monitoring for caching. # -# We support psutil >= 5.4.7 because users have found problems running -# older versions on Windows (specifically 5.4.2). -# TODO: support should be extended to >= 5.4.3. +# We support psutil >= 5.4.7 because it is the first version compatible with +# Python 3.7. psutil >= 5.4.7, < 6 # For openfisca test From 83a53be3ad2cc0fd7e1b0dcf5997e1728ad07b32 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 16:21:04 +0200 Subject: [PATCH 09/37] Relax dpath --- requirements/install.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/requirements/install.in b/requirements/install.in index 49934634f4..db4c3634c1 100644 --- a/requirements/install.in +++ b/requirements/install.in @@ -24,11 +24,14 @@ # * Avoiding a version (document why). # * Pinning a version (document why). -# For globing over dictionaries as if they were filesystems +# For globing over dictionaries as if they were filesystems. # -# We do not support 2 because of a bug introducted to period parsing in +# We support from 1.3.2 on because it is the first version published +# following the semantic versioning specification. +# +# We do not support 2 because of a bug introduced to period parsing in # OpenFisca's Web API. -dpath ~= 1.5 +dpath >= 1.3.2, < 2 # For evaluating numerical expressions # From e167093d29712297e80ca0adcec7e8cd3055ce58 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 16:41:06 +0200 Subject: [PATCH 10/37] Drop support for numexpr < 2.7.1 --- requirements/install.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements/install.in b/requirements/install.in index db4c3634c1..e2f4eb5dac 100644 --- a/requirements/install.in +++ b/requirements/install.in @@ -35,8 +35,9 @@ dpath >= 1.3.2, < 2 # For evaluating numerical expressions # -# TODO: support for 2 should be extended. -numexpr ~= 2.7 +# We support numexpr >= 2.7.1 because it is the first version compatible with +# Python 3.7. +numexpr >= 2.7.1, < 3 # For vectorial support # From caf1c8535149f73ec799ac626fa775d1caad439c Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 20:24:20 +0200 Subject: [PATCH 11/37] Drop support for pytest < 5.4.2 --- requirements/install.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/requirements/install.in b/requirements/install.in index e2f4eb5dac..864964d6d6 100644 --- a/requirements/install.in +++ b/requirements/install.in @@ -29,7 +29,7 @@ # We support from 1.3.2 on because it is the first version published # following the semantic versioning specification. # -# We do not support 2 because of a bug introduced to period parsing in +# We do not support 2 yet because of a bug introduced to period parsing in # OpenFisca's Web API. dpath >= 1.3.2, < 2 @@ -56,10 +56,12 @@ psutil >= 5.4.7, < 6 # For openfisca test # -# TODO: support for 4 should be dropped. -# TODO: support for 6 requires fixing some tests. +# We support pytest >= 5.4.2 because `openfisca test` relies on the signature of +# `pytest.Item.from_module()` introduced since this 5.4.2. +# +# We do not support 6 yet because it requires fixing some tests before. # See: https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent -pytest >= 4.4.1, < 6 +pytest >= 5.4.2, < 6 # For parameters, tests # From b31aec295c4186b7a546ab667b089e021c080d5c Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 20:40:14 +0200 Subject: [PATCH 12/37] Drop support for PyYAML < 5.1 --- requirements/install.in | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/requirements/install.in b/requirements/install.in index 864964d6d6..43613a9f4b 100644 --- a/requirements/install.in +++ b/requirements/install.in @@ -63,11 +63,8 @@ psutil >= 5.4.7, < 6 # See: https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent pytest >= 5.4.2, < 6 -# For parameters, tests -# -# TODO: support for 3 should be dropped. -# TODO: support for 4 should be dropped. -PyYAML >= 3.10, < 6 +# For parameters, tests. +PyYAML >= 5.1, < 6 # For sorting formulas by period. sortedcontainers >= 2, < 3 From 7edbe620ad6611f3c49ceb1de8811f65cec60b16 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 20:54:59 +0200 Subject: [PATCH 13/37] Drop support for NumPy < 1.17 --- requirements/install.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/requirements/install.in b/requirements/install.in index 43613a9f4b..fcb8c75047 100644 --- a/requirements/install.in +++ b/requirements/install.in @@ -44,9 +44,7 @@ numexpr >= 2.7.1, < 3 # We support the latest four minors because NumPy is generally a transitive # dependency that users rely on within the projects where OpenFisca is # depended on by. -# -# TODO: support for < 1.17 should be dropped. -numpy ~= 1.11, < 1.21 +numpy >= 1.17, < 1.21 # Memory monitoring for caching. # From a38458be0ad2ff5c8e06d438f33802d76cb59d48 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 22:31:07 +0200 Subject: [PATCH 14/37] Add integrity test for NumPy --- .circleci/config.yml | 128 ++++++++++++++----- .circleci/get-numpy-version.py | 38 ------ README.md | 4 +- requirements/constraints | 6 + requirements/{coverage.in => coverage} | 0 requirements/{debug.in => debug} | 0 requirements/{dev.in => dev} | 2 +- requirements/{install.in => install} | 0 requirements/{publication.in => publication} | 0 requirements/{tracker.in => tracker} | 0 requirements/{web-api.in => web-api} | 0 setup.py | 2 +- 12 files changed, 108 insertions(+), 72 deletions(-) delete mode 100755 .circleci/get-numpy-version.py create mode 100644 requirements/constraints rename requirements/{coverage.in => coverage} (100%) rename requirements/{debug.in => debug} (100%) rename requirements/{dev.in => dev} (97%) rename requirements/{install.in => install} (100%) rename requirements/{publication.in => publication} (100%) rename requirements/{tracker.in => tracker} (100%) rename requirements/{web-api.in => web-api} (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 416fb281c1..50675206dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,19 @@ version: 2 jobs: - run_tests: + check_version: + docker: + - image: python:3.7 + + steps: + - checkout + + - run: + name: Check version number has been properly updated + command: | + git fetch + .circleci/is-version-number-acceptable.sh + + build: docker: - image: python:3.7 environment: @@ -17,13 +30,16 @@ jobs: command: | mkdir -p /tmp/venv/openfisca_core python -m venv /tmp/venv/openfisca_core - echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV + + - run: + name: Activate virtualenv + command: echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV - run: name: Install dependencies command: | - make install - make clean + pip install --upgrade pip + pip install --requirement requirements/dev # pip install --editable git+https://github.com/openfisca/country-template.git@BRANCH_NAME#egg=OpenFisca-Country-Template # use a specific branch of OpenFisca-Country-Template # pip install --editable git+https://github.com/openfisca/extension-template.git@BRANCH_NAME#egg=OpenFisca-Extension-Template # use a specific branch of OpenFisca-Extension-Template @@ -32,6 +48,27 @@ jobs: paths: - /tmp/venv/openfisca_core + test: + docker: + - image: python:3.7 + + environment: + PYTEST_ADDOPTS: --exitfirst + + steps: + - checkout + + - restore_cache: + key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }} + + - run: + name: Activate virtualenv + command: echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV + + - run: + name: Install core + command: pip install --editable . --upgrade --no-dependencies + - run: name: Run linters command: make lint @@ -49,14 +86,41 @@ jobs: command: make test-extension pytest_args="--exitfirst" - run: - name: Check NumPy typing against latest 3 minor versions - command: for i in {1..3}; do VERSION=$(.circleci/get-numpy-version.py prev) && pip install numpy==$VERSION && make check-types; done + name: Run core tests + command: make test - persist_to_workspace: root: . paths: - .coverage + test_compatibility: + docker: + - image: python:3.7 + + environment: + PYTEST_ADDOPTS: --exitfirst + + steps: + - checkout + + - restore_cache: + key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }} + + - run: + name: Activate virtualenv + command: echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV + + - run: + name: Install core with a constrained Numpy version + command: | + pip install --requirement requirements/dev --upgrade --constraint requirements/compatibility + pip install --editable . --upgrade --no-dependencies + + - run: + name: Run core tests + command: make test + test_docs: docker: - image: python:3.7 @@ -96,20 +160,6 @@ jobs: name: Run doc tests command: make test-doc-build - - check_version: - docker: - - image: python:3.7 - - steps: - - checkout - - - run: - name: Check version number has been properly updated - command: | - git fetch - .circleci/is-version-number-acceptable.sh - submit_coverage: docker: - image: python:3.7 @@ -123,11 +173,16 @@ jobs: - restore_cache: key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }} + - run: + name: Activate virtualenv + command: echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV + - run: name: Submit coverage to Coveralls command: | - source /tmp/venv/openfisca_core/bin/activate - pip install --editable .[coverage] + pip install --requirement requirements/coverage --upgrade + pip install --requirement requirements/dev --upgrade + pip install --editable . --upgrade --no-dependencies coveralls - save_cache: @@ -138,6 +193,7 @@ jobs: deploy: docker: - image: python:3.7 + environment: PYPI_USERNAME: openfisca-bot # PYPI_PASSWORD: this value is set in CircleCI's web interface; do not set it here, it is a secret! @@ -152,11 +208,15 @@ jobs: name: Check for functional changes command: if ! .circleci/has-functional-changes.sh ; then circleci step halt ; fi + - run: + name: Activate virtualenv + command: echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV + - run: name: Upload a Python package to PyPi command: | - source /tmp/venv/openfisca_core/bin/activate - pip install --editable .[publication] + pip install --requirement requirements/publication --upgrade + pip install --editable . --upgrade --no-dependencies .circleci/publish-python-package.sh - run: @@ -172,17 +232,27 @@ workflows: version: 2 build_and_deploy: jobs: - - run_tests - - test_docs - check_version + - build + - test: + requires: + - build + - test_compatibility: + requires: + - build + - test_docs: + requires: + - build - submit_coverage: requires: - - run_tests + - test + - test_compatibility - deploy: requires: - - run_tests - - test_docs - check_version + - test + - test_compatibility + - test_docs filters: branches: only: master diff --git a/.circleci/get-numpy-version.py b/.circleci/get-numpy-version.py deleted file mode 100755 index 64cb68532e..0000000000 --- a/.circleci/get-numpy-version.py +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env python - -from __future__ import annotations - -import os -import sys -import typing -from packaging import version -from typing import NoReturn, Union - -import numpy - -if typing.TYPE_CHECKING: - from packaging.version import LegacyVersion, Version - - -def prev() -> NoReturn: - release = _installed().release - - if release is None: - sys.exit(os.EX_DATAERR) - - major, minor, _ = release - - if minor == 0: - sys.exit(os.EX_DATAERR) - - minor -= 1 - print(f"{major}.{minor}.0") # noqa: T001 - sys.exit(os.EX_OK) - - -def _installed() -> Union[LegacyVersion, Version]: - return version.parse(numpy.__version__) - - -if __name__ == "__main__": - globals()[sys.argv[1]]() diff --git a/README.md b/README.md index 7f253c9114..0d1dd703ca 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This package contains the core features of OpenFisca, which are meant to be used OpenFisca runs on Python 3.7. More recent versions should work, but are not tested. -OpenFisca also relies strongly on NumPy. Last four minor versions should work, but only latest/stable is tested. +OpenFisca also relies strongly on NumPy. Last four minor versions should work, but only upper and lower bound versions are tested. ## Installation @@ -58,8 +58,6 @@ pytest tests/core/test_parameters.py -k test_parameter_for_period This repository relies on MyPy for optional dynamic & static type checking. -As NumPy introduced the `typing` module in 1.20.0, to ensure type hints do not break the code at runtime, we run the checker against the last four minor NumPy versions. - Type checking is already run with `make test`. To run the type checker alone: ```sh diff --git a/requirements/constraints b/requirements/constraints new file mode 100644 index 0000000000..4deb711fae --- /dev/null +++ b/requirements/constraints @@ -0,0 +1,6 @@ +# These are constraint versions to ensure the integrity of distributions. +# +# Normally, we want to add here the pinned lower-bound supported versions of +# dependencies critical to OpenFisca's usability. + +numpy == 1.17 diff --git a/requirements/coverage.in b/requirements/coverage similarity index 100% rename from requirements/coverage.in rename to requirements/coverage diff --git a/requirements/debug.in b/requirements/debug similarity index 100% rename from requirements/debug.in rename to requirements/debug diff --git a/requirements/dev.in b/requirements/dev similarity index 97% rename from requirements/dev.in rename to requirements/dev index ffc8007a23..8c45496681 100644 --- a/requirements/dev.in +++ b/requirements/dev @@ -23,4 +23,4 @@ openfisca-country-template == 3.12.5 openfisca-extension-template == 1.3.6 # Include Web API dependencies for development --r web-api.in +-r web-api diff --git a/requirements/install.in b/requirements/install similarity index 100% rename from requirements/install.in rename to requirements/install diff --git a/requirements/publication.in b/requirements/publication similarity index 100% rename from requirements/publication.in rename to requirements/publication diff --git a/requirements/tracker.in b/requirements/tracker similarity index 100% rename from requirements/tracker.in rename to requirements/tracker diff --git a/requirements/web-api.in b/requirements/web-api similarity index 100% rename from requirements/web-api.in rename to requirements/web-api diff --git a/setup.py b/setup.py index 1d209f0d48..786a28d7d1 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def load_requirements_from_file(filename: str) -> List[str]: setup( name = 'OpenFisca-Core', - version = '35.7.1', + version = '36.0.0', author = 'OpenFisca Team', author_email = 'contact@openfisca.org', classifiers = [ From 62c0585f9a38c7d9c6fee895848e931d876e1404 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 7 Sep 2021 23:51:07 +0200 Subject: [PATCH 15/37] Improve phrasing in README.md Co-authored-by: Matti Schneider --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d1dd703ca..8474d72150 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This package contains the core features of OpenFisca, which are meant to be used OpenFisca runs on Python 3.7. More recent versions should work, but are not tested. -OpenFisca also relies strongly on NumPy. Last four minor versions should work, but only upper and lower bound versions are tested. +OpenFisca also relies strongly on NumPy. Only upper and lower bound versions are tested. ## Installation From 7b90b14bad3f055d6ff6fb5ff4947e22fff4f25e Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 7 Sep 2021 23:56:11 +0200 Subject: [PATCH 16/37] Remove debug requirements --- requirements/debug | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 requirements/debug diff --git a/requirements/debug b/requirements/debug deleted file mode 100644 index 59cf404cae..0000000000 --- a/requirements/debug +++ /dev/null @@ -1,5 +0,0 @@ -# These are dependencies to help with debug and profiling, so we always want -# the latest versions. - -# Interactive console on steroids (even makes your coffee)! -ipython From 8b1b84b46287bd681620ff9ee91cdc956c07d641 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 7 Sep 2021 23:59:02 +0200 Subject: [PATCH 17/37] Do not pin deps/tracker --- requirements/tracker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/tracker b/requirements/tracker index 929c660ee4..6ab42528d2 100644 --- a/requirements/tracker +++ b/requirements/tracker @@ -4,4 +4,4 @@ # These are web-api tracking dependencies, so pin them. # For sending usage statistics to the Matomo third-party service. -openfisca-tracker == 0.4.0 +openfisca-tracker <= 0.4.0 From 73eaac86bd097646dd6adc08e85d73532894d79b Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 8 Sep 2021 00:13:33 +0200 Subject: [PATCH 18/37] Clarify requirements/install Co-authored-by: Matti Schneider --- requirements/install | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements/install b/requirements/install index fcb8c75047..fd67bba9cf 100644 --- a/requirements/install +++ b/requirements/install @@ -1,12 +1,12 @@ # Please make sure to cap all dependency versions, in order to avoid unwanted # functional and integration breaks caused by external code updates. # -# These are general dependencies, so: +# These dependencies are always installed, so: # # * the ranges should be broad, and -# * the number of them kept discreet. +# * the number of them kept low. # -# If a dependency seems trivial, please propose a pull request to remove it. +# If a dependency seems redundant, please propose a pull request to remove it. # # General Rule # ======== @@ -24,7 +24,7 @@ # * Avoiding a version (document why). # * Pinning a version (document why). -# For globing over dictionaries as if they were filesystems. +# For globbing over dictionaries as if they were filesystems. # # We support from 1.3.2 on because it is the first version published # following the semantic versioning specification. @@ -61,7 +61,7 @@ psutil >= 5.4.7, < 6 # See: https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent pytest >= 5.4.2, < 6 -# For parameters, tests. +# For parameters and tests parsing. PyYAML >= 5.1, < 6 # For sorting formulas by period. From a2103a6eaa04d28a112c715ba38502c6748cc65d Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 8 Sep 2021 00:25:52 +0200 Subject: [PATCH 19/37] Delete duplicated numpy rule --- requirements/install | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/requirements/install b/requirements/install index fd67bba9cf..e6ebb4e021 100644 --- a/requirements/install +++ b/requirements/install @@ -9,17 +9,12 @@ # If a dependency seems redundant, please propose a pull request to remove it. # # General Rule -# ======== +# ============ # # * Cap to latest major. # -# NumPy Rule -# ======== -# -# * Cap to latest four minors (document why). -# # Exceptions -# ======== +# ========== # # * Avoiding a version (document why). # * Pinning a version (document why). From d865888368d88f394be3a142f3a22fcdd368b8d1 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 8 Sep 2021 00:27:53 +0200 Subject: [PATCH 20/37] Add link to issue in dpath --- requirements/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/install b/requirements/install index e6ebb4e021..ab9a60af9b 100644 --- a/requirements/install +++ b/requirements/install @@ -24,8 +24,8 @@ # We support from 1.3.2 on because it is the first version published # following the semantic versioning specification. # -# We do not support 2 yet because of a bug introduced to period parsing in -# OpenFisca's Web API. +# We do not support 2 yet because of a [bug introduced to period parsing in +# OpenFisca's Web API: https://github.com/openfisca/openfisca-core/pull/948 dpath >= 1.3.2, < 2 # For evaluating numerical expressions From 9bec4dec6fd46c08d08efaef1cb9c94514597ebb Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 8 Sep 2021 00:31:33 +0200 Subject: [PATCH 21/37] Improve message in tracker deps --- requirements/tracker | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/requirements/tracker b/requirements/tracker index 6ab42528d2..7dd90ccee8 100644 --- a/requirements/tracker +++ b/requirements/tracker @@ -1,7 +1,5 @@ -# Please make sure to pin all dependency versions, in order to avoid unwanted -# functional and integration breaks caused by external code updates. -# -# These are web-api tracking dependencies, so pin them. +# Dependencies for tracking are optional, so we always want the latest +# versions. # For sending usage statistics to the Matomo third-party service. openfisca-tracker <= 0.4.0 From 65855e82513e9cadbf7b7c43da44cbb2f5454951 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 8 Sep 2021 00:41:27 +0200 Subject: [PATCH 22/37] Improve wording in web-api deps --- requirements/web-api | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/requirements/web-api b/requirements/web-api index 614541cefe..ce7a2cc431 100644 --- a/requirements/web-api +++ b/requirements/web-api @@ -1,7 +1,10 @@ -# Please make sure to pin all dependency versions, in order to avoid unwanted -# functional and integration breaks caused by external code updates. +# These are dependencies to serve the Web-API, so we always want to support +# the latest versions. # -# These are web-api dependencies, so pin them. +# As a safety measure, compatibility could be smoke-tested automatically: +# https://github.com/openfisca/country-template/pull/113 +# +# In the meantime, we pin these dependencies. # For OpenFisca's Web API. flask == 1.1.2 From 4fbf18a9f2a5bb397291e345b0fc280acd486604 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 8 Sep 2021 22:00:28 +0200 Subject: [PATCH 23/37] Remove legacy resolver --- requirements/dev | 15 ++++++++++++--- requirements/tracker | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/requirements/dev b/requirements/dev index 8c45496681..173777abcc 100644 --- a/requirements/dev +++ b/requirements/dev @@ -1,7 +1,16 @@ # Please make sure to pin all dependency versions, in order to avoid unwanted # functional and integration breaks caused by external code updates. # -# These are dev dependencies, so pin them. +# General Rule +# ============ +# +# * Pin them. +# +# Exceptions +# ========== +# +# * openfisca-country-template should not be constrained (circular dep). +# * openfisca-extension-template should not be constrained (circular dep). # For automatic style formatting. autopep8 == 1.5.7 @@ -19,8 +28,8 @@ pytest-cov == 2.11.1 mypy == 0.812 # For testing: parameters, variables, etc. -openfisca-country-template == 3.12.5 -openfisca-extension-template == 1.3.6 +openfisca-country-template +openfisca-extension-template # Include Web API dependencies for development -r web-api diff --git a/requirements/tracker b/requirements/tracker index 7dd90ccee8..8b9f13a850 100644 --- a/requirements/tracker +++ b/requirements/tracker @@ -2,4 +2,4 @@ # versions. # For sending usage statistics to the Matomo third-party service. -openfisca-tracker <= 0.4.0 +openfisca-tracker From d0bd5110b0e0bef6e7132cb36015f427573b606f Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 8 Sep 2021 22:14:42 +0200 Subject: [PATCH 24/37] Update README.md --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8474d72150..5eb4ce4f40 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,8 @@ cd openfisca-core python3 -m venv .venv source .venv/bin/activate pip install -U pip -pip install --editable .[dev] --use-deprecated=legacy-resolver +pip install --requirement requirements/dev --upgrade +pip install --editable . --upgrade --no-dependencies ``` ## Testing @@ -194,9 +195,16 @@ The OpenFisca Web API comes with an [optional tracker](https://github.com/openfi The tracker is not installed by default. To install it, run: ```sh -pip install openfisca_core[tracker] --use-deprecated=legacy-resolver # Or `pip install --editable ".[tracker]"` for an editable installation +pip install openfisca_core[tracker] ``` +Or for an editable installation: + +``` +pip install --requirement requirements/tracker --upgrade +pip install --requirement requirements/dev --upgrade +pip install --editable . --upgrade --no-dependencies +``` #### Tracker configuration From 0818f5782d39e349dfbc06d873543c2a82f6db16 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Mon, 25 Oct 2021 23:19:30 +0200 Subject: [PATCH 25/37] Apply suggestions from code review Co-authored-by: Matti Schneider --- requirements/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/install b/requirements/install index ab9a60af9b..49aabadba6 100644 --- a/requirements/install +++ b/requirements/install @@ -24,7 +24,7 @@ # We support from 1.3.2 on because it is the first version published # following the semantic versioning specification. # -# We do not support 2 yet because of a [bug introduced to period parsing in +# We do not support 2 yet because of a bug introduced to period parsing in # OpenFisca's Web API: https://github.com/openfisca/openfisca-core/pull/948 dpath >= 1.3.2, < 2 @@ -50,7 +50,7 @@ psutil >= 5.4.7, < 6 # For openfisca test # # We support pytest >= 5.4.2 because `openfisca test` relies on the signature of -# `pytest.Item.from_module()` introduced since this 5.4.2. +# `pytest.Item.from_module()` introduced since 5.4.2. # # We do not support 6 yet because it requires fixing some tests before. # See: https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent From e346c09c85fcacec8a7f7463d2f5372a0e96834e Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 13:56:27 +0200 Subject: [PATCH 26/37] Rename constraints => compatibility --- requirements/{constraints => compatibility} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename requirements/{constraints => compatibility} (64%) diff --git a/requirements/constraints b/requirements/compatibility similarity index 64% rename from requirements/constraints rename to requirements/compatibility index 4deb711fae..3dcf417557 100644 --- a/requirements/constraints +++ b/requirements/compatibility @@ -1,4 +1,4 @@ -# These are constraint versions to ensure the integrity of distributions. +# These are constraint versions to ensure the compatibility of distributions. # # Normally, we want to add here the pinned lower-bound supported versions of # dependencies critical to OpenFisca's usability. From e5b803eabf521b6259bcf1748e6997c0ec500be0 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 14:21:14 +0200 Subject: [PATCH 27/37] Update dependencies --- requirements/dev | 13 ++++++++----- requirements/install | 6 ++++++ requirements/tracker | 4 +++- requirements/web-api | 17 ++++++++--------- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/requirements/dev b/requirements/dev index 173777abcc..5c367e8ae0 100644 --- a/requirements/dev +++ b/requirements/dev @@ -13,19 +13,22 @@ # * openfisca-extension-template should not be constrained (circular dep). # For automatic style formatting. -autopep8 == 1.5.7 +autopep8 == 1.6.0 # For style & code checking. -flake8 == 3.9.1 -flake8-bugbear == 21.4.3 +darglint == 1.8.0 +flake8 == 4.0.1 +flake8-bugbear == 21.9.2 +flake8-docstrings == 1.6.0 flake8-print == 4.0.0 flake8-rst-docstrings == 0.2.3 +pylint == 2.11.1 # For PyTest test coverage integration. -pytest-cov == 2.11.1 +pytest-cov == 3.0.0 # For optional duck & static type checking. -mypy == 0.812 +mypy == 0.910 # For testing: parameters, variables, etc. openfisca-country-template diff --git a/requirements/install b/requirements/install index 49aabadba6..cd4a27a25a 100644 --- a/requirements/install +++ b/requirements/install @@ -28,6 +28,9 @@ # OpenFisca's Web API: https://github.com/openfisca/openfisca-core/pull/948 dpath >= 1.3.2, < 2 +# For Numpy type-hints. +nptyping >= 1, < 2 + # For evaluating numerical expressions # # We support numexpr >= 2.7.1 because it is the first version compatible with @@ -61,3 +64,6 @@ PyYAML >= 5.1, < 6 # For sorting formulas by period. sortedcontainers >= 2, < 3 + +# For typing backports. +typing-extensions >= 3, < 4 diff --git a/requirements/tracker b/requirements/tracker index 8b9f13a850..c0c8ce0599 100644 --- a/requirements/tracker +++ b/requirements/tracker @@ -2,4 +2,6 @@ # versions. # For sending usage statistics to the Matomo third-party service. -openfisca-tracker +# +# We start from the currently supported version forward. +openfisca-tracker >= 0.4.0 diff --git a/requirements/web-api b/requirements/web-api index ce7a2cc431..5034026bcd 100644 --- a/requirements/web-api +++ b/requirements/web-api @@ -1,15 +1,14 @@ # These are dependencies to serve the Web-API, so we always want to support # the latest versions. -# -# As a safety measure, compatibility could be smoke-tested automatically: -# https://github.com/openfisca/country-template/pull/113 -# -# In the meantime, we pin these dependencies. # For OpenFisca's Web API. -flask == 1.1.2 -gunicorn == 20.1.0 +# +# We start from the currently supported versions forward. +flask >= 1.1.2 +gunicorn >= 20.1.0 # For OpenFisca's Web API users requiring CORS. -flask-cors == 3.0.10 -werkzeug == 1.0.1 +# +# We start from the currently supported versions forward. +flask-cors >= 3.0.10 +werkzeug >= 1.0.1 From c0a654e0364b7e1bd3b5ad698398f2012e65b8ff Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 16:24:29 +0200 Subject: [PATCH 28/37] Use make as task-manager --- .circleci/config.yml | 93 ++++++++++++++--------------- .circleci/publish-python-package.sh | 4 -- MANIFEST.in | 3 +- openfisca_tasks/install.mk | 33 +++++++++- openfisca_tasks/publish.mk | 43 ++++++++++++- requirements/common | 8 +++ requirements/publication | 2 +- setup.py | 5 +- 8 files changed, 130 insertions(+), 61 deletions(-) delete mode 100755 .circleci/publish-python-package.sh create mode 100644 requirements/common diff --git a/.circleci/config.yml b/.circleci/config.yml index 50675206dd..e581c5555e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,8 +38,8 @@ jobs: - run: name: Install dependencies command: | - pip install --upgrade pip - pip install --requirement requirements/dev + make install-deps + make install-dev # pip install --editable git+https://github.com/openfisca/country-template.git@BRANCH_NAME#egg=OpenFisca-Country-Template # use a specific branch of OpenFisca-Country-Template # pip install --editable git+https://github.com/openfisca/extension-template.git@BRANCH_NAME#egg=OpenFisca-Extension-Template # use a specific branch of OpenFisca-Extension-Template @@ -51,9 +51,8 @@ jobs: test: docker: - image: python:3.7 - environment: - PYTEST_ADDOPTS: --exitfirst + TERM: xterm-256color # To colorize output of make tasks. steps: - checkout @@ -67,7 +66,7 @@ jobs: - run: name: Install core - command: pip install --editable . --upgrade --no-dependencies + command: make install-core - run: name: Run linters @@ -94,33 +93,6 @@ jobs: paths: - .coverage - test_compatibility: - docker: - - image: python:3.7 - - environment: - PYTEST_ADDOPTS: --exitfirst - - steps: - - checkout - - - restore_cache: - key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }} - - - run: - name: Activate virtualenv - command: echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV - - - run: - name: Install core with a constrained Numpy version - command: | - pip install --requirement requirements/dev --upgrade --constraint requirements/compatibility - pip install --editable . --upgrade --no-dependencies - - - run: - name: Run core tests - command: make test - test_docs: docker: - image: python:3.7 @@ -145,7 +117,10 @@ jobs: command: | mkdir -p /tmp/venv/openfisca_doc python -m venv /tmp/venv/openfisca_doc - echo "source /tmp/venv/openfisca_doc/bin/activate" >> $BASH_ENV + + - run: + name: Activate virtualenv + command: echo "source /tmp/venv/openfisca_doc/bin/activate" >> $BASH_ENV - run: name: Install dependencies @@ -160,6 +135,34 @@ jobs: name: Run doc tests command: make test-doc-build + + test_compatibility: + docker: + - image: python:3.7 + + environment: + PYTEST_ADDOPTS: --exitfirst + + steps: + - checkout + + - restore_cache: + key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }} + + - run: + name: Activate virtualenv + command: echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV + + - run: + name: Install core with a constrained Numpy version + command: | + make install-core + make install-compat + + - run: + name: Run core tests + command: make test + submit_coverage: docker: - image: python:3.7 @@ -180,16 +183,10 @@ jobs: - run: name: Submit coverage to Coveralls command: | - pip install --requirement requirements/coverage --upgrade - pip install --requirement requirements/dev --upgrade - pip install --editable . --upgrade --no-dependencies + make install-core + make install-cov coveralls - - save_cache: - key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }} - paths: - - /tmp/venv/openfisca_core - deploy: docker: - image: python:3.7 @@ -215,9 +212,8 @@ jobs: - run: name: Upload a Python package to PyPi command: | - pip install --requirement requirements/publication --upgrade - pip install --editable . --upgrade --no-dependencies - .circleci/publish-python-package.sh + make build + make publish - run: name: Publish a git tag @@ -237,22 +233,23 @@ workflows: - test: requires: - build - - test_compatibility: - requires: - - build - test_docs: requires: - build + - test_compatibility: + requires: + - test_docs - submit_coverage: requires: - test + - test_docs - test_compatibility - deploy: requires: - check_version - test - - test_compatibility - test_docs + - test_compatibility filters: branches: only: master diff --git a/.circleci/publish-python-package.sh b/.circleci/publish-python-package.sh deleted file mode 100755 index 8d331bd946..0000000000 --- a/.circleci/publish-python-package.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash - -python setup.py bdist_wheel # build this package in the dist directory -twine upload dist/* --username $PYPI_USERNAME --password $PYPI_PASSWORD # publish diff --git a/MANIFEST.in b/MANIFEST.in index 166788d7fa..507d218461 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ -recursive-include openfisca_core/scripts * +graft requirements include openfisca_web_api/openAPI.yml +recursive-include openfisca_core/scripts * diff --git a/openfisca_tasks/install.mk b/openfisca_tasks/install.mk index 7918c76b14..f7d1f8074b 100644 --- a/openfisca_tasks/install.mk +++ b/openfisca_tasks/install.mk @@ -1,9 +1,36 @@ ## Install project dependencies. install: + @${MAKE} install-deps + @${MAKE} install-dev + @${MAKE} install-core + @$(call print_pass,$@:) + +## Install common dependencies. +install-deps: + @$(call print_help,$@:) + @pip install --quiet --upgrade --constraint requirements/common pip setuptools + +## Install development dependencies. +install-dev: + @$(call print_help,$@:) + @pip install --quiet --upgrade --requirement requirements/install + @pip install --quiet --upgrade --requirement requirements/dev + +## Install package. +install-core: + @$(call print_help,$@:) + @pip uninstall --quiet --yes openfisca-core + @pip install --quiet --no-dependencies --editable . + +## Install lower-bound dependencies for compatibility check. +install-compat: + @$(call print_help,$@:) + @pip install --quiet --upgrade --constraint requirements/compatibility numpy + +## Install coverage dependencies. +install-cov: @$(call print_help,$@:) - @pip install --upgrade pip setuptools - @pip install --requirement requirements/dev --upgrade - @pip install --editable . --upgrade --no-dependencies + @pip install --quiet --upgrade --constraint requirements/coverage coveralls ## Uninstall project dependencies. uninstall: diff --git a/openfisca_tasks/publish.mk b/openfisca_tasks/publish.mk index 2bcd2c0ba7..09686a6274 100644 --- a/openfisca_tasks/publish.mk +++ b/openfisca_tasks/publish.mk @@ -1,8 +1,45 @@ -## Install openfisca-core for deployment and publishing. +.PHONY: build + +## Build openfisca-core for deployment and publishing. build: @## This allows us to be sure tests are run against the packaged version @## of openfisca-core, the same we put in the hands of users and reusers. @$(call print_help,$@:) - @python setup.py bdist_wheel - @find dist -name "*.whl" -exec pip install --force-reinstall {}[dev] \; + @${MAKE} install-deps + @${MAKE} build-deps + @${MAKE} build-build + @${MAKE} build-install @$(call print_pass,$@:) + +## Install building dependencies. +build-deps: + @$(call print_help,$@:) + @pip install --quiet --upgrade --constraint requirements/publication build + +## Build the package. +build-build: + @$(call print_help,$@:) + @python -m build + +## Install the built package. +build-install: + @$(call print_help,$@:) + @pip uninstall --quiet --yes openfisca-core + @find dist -name "*.whl" -exec pip install --quiet --no-dependencies {} \; + +## Publish package. +publish: + @$(call print_help,$@:) + @${MAKE} publish-deps + @${MAKE} publish-upload + @$(call print_pass,$@:) + +## Install required publishing dependencies. +publish-deps: + @$(call print_help,$@:) + @pip install --quiet --upgrade --constraint requirements/publication twine + +## Upload package to PyPi. +publish-upload: + @$(call print_help,$@:) + twine upload dist/* --username $${PYPI_USERNAME} --password $${PYPI_PASSWORD} diff --git a/requirements/common b/requirements/common new file mode 100644 index 0000000000..5599db953a --- /dev/null +++ b/requirements/common @@ -0,0 +1,8 @@ +# These are dependencies to build the library, so we always want the latest +# versions. + +# For managing dependencies. +pip + +# For packaging the package. +setuptools diff --git a/requirements/publication b/requirements/publication index 85d4ccd2ea..1711493b6d 100644 --- a/requirements/publication +++ b/requirements/publication @@ -5,4 +5,4 @@ twine # For building the package. -wheel +build diff --git a/setup.py b/setup.py index 786a28d7d1..5975877b72 100644 --- a/setup.py +++ b/setup.py @@ -5,13 +5,15 @@ from typing import List import re +from pathlib import Path from setuptools import setup, find_packages def load_requirements_from_file(filename: str) -> List[str]: """Allows for composable requirement files with the `-r filename` flag.""" - reqs = open(f"requirements/{filename}").readlines() + file = Path(f"./requirements/{filename}").resolve() + reqs = open(file).readlines() pattern = re.compile(r"^\s*-r\s*(?P.*)$") for req in reqs: @@ -56,6 +58,7 @@ def load_requirements_from_file(filename: str) -> List[str]: python_requires = ">= 3.7", install_requires = load_requirements_from_file("install"), extras_require = { + "common": load_requirements_from_file("common"), "coverage": load_requirements_from_file("coverage"), "dev": load_requirements_from_file("dev"), "publication": load_requirements_from_file("publication"), From 5801347244af2ade872b11974a508c9406bc6cca Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 16:27:50 +0200 Subject: [PATCH 29/37] Update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5eb4ce4f40..5f060caf23 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,7 @@ git clone https://github.com/openfisca/openfisca-core.git cd openfisca-core python3 -m venv .venv source .venv/bin/activate -pip install -U pip -pip install --requirement requirements/dev --upgrade -pip install --editable . --upgrade --no-dependencies +make install ``` ## Testing @@ -46,10 +44,10 @@ make test To run all the tests defined on a test file: ```sh -pytest tests/core/test_parameters.py +openfisca test tests/core/test_parameters.py ``` -To run a single test: +You can also use `pytest`, for example to run a single test: ```sh pytest tests/core/test_parameters.py -k test_parameter_for_period From 65c46213783c8d2531d2dee1274ff89a41dd742b Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 16:34:51 +0200 Subject: [PATCH 30/37] Expire deprecations --- openfisca_core/commons/__init__.py | 13 ++----------- openfisca_core/errors/__init__.py | 6 +++--- openfisca_core/formula_helpers.py | 9 --------- openfisca_core/memory_config.py | 9 --------- openfisca_core/parameters/__init__.py | 7 ++----- openfisca_core/rates.py | 9 --------- openfisca_core/simulation_builder.py | 16 ---------------- openfisca_core/simulations/__init__.py | 2 -- openfisca_core/taxbenefitsystems/__init__.py | 2 -- openfisca_core/taxscales/__init__.py | 2 -- openfisca_core/variables/__init__.py | 1 - openfisca_core/variables/variable.py | 2 +- 12 files changed, 8 insertions(+), 70 deletions(-) delete mode 100644 openfisca_core/formula_helpers.py delete mode 100644 openfisca_core/memory_config.py delete mode 100644 openfisca_core/rates.py delete mode 100644 openfisca_core/simulation_builder.py diff --git a/openfisca_core/commons/__init__.py b/openfisca_core/commons/__init__.py index b3b5d8cbb2..c2927dea22 100644 --- a/openfisca_core/commons/__init__.py +++ b/openfisca_core/commons/__init__.py @@ -12,12 +12,9 @@ * :func:`.stringify_array` * :func:`.switch` -Deprecated: - * :class:`.Dummy` - Note: - The ``deprecated`` imports are transitional, in order to ensure non-breaking - changes, and could be removed from the codebase in the next + The ``deprecated`` imports are transitional, in order to ensure + non-breaking changes, and could be removed from the codebase in the next major release. Note: @@ -59,9 +56,3 @@ __all__ = ["apply_thresholds", "concat", "switch"] __all__ = ["empty_clone", "stringify_array", *__all__] __all__ = ["average_rate", "marginal_rate", *__all__] - -# Deprecated - -from .dummy import Dummy # noqa: F401 - -__all__ = ["Dummy", *__all__] diff --git a/openfisca_core/errors/__init__.py b/openfisca_core/errors/__init__.py index ccd19af9b2..e5b9abbc78 100644 --- a/openfisca_core/errors/__init__.py +++ b/openfisca_core/errors/__init__.py @@ -24,10 +24,10 @@ from .cycle_error import CycleError # noqa: F401 from .empty_argument_error import EmptyArgumentError # noqa: F401 from .nan_creation_error import NaNCreationError # noqa: F401 -from .parameter_not_found_error import ParameterNotFoundError, ParameterNotFoundError as ParameterNotFound # noqa: F401 +from .parameter_not_found_error import ParameterNotFoundError # noqa: F401 from .parameter_parsing_error import ParameterParsingError # noqa: F401 from .period_mismatch_error import PeriodMismatchError # noqa: F401 from .situation_parsing_error import SituationParsingError # noqa: F401 from .spiral_error import SpiralError # noqa: F401 -from .variable_name_config_error import VariableNameConflictError, VariableNameConflictError as VariableNameConflict # noqa: F401 -from .variable_not_found_error import VariableNotFoundError, VariableNotFoundError as VariableNotFound # noqa: F401 +from .variable_name_config_error import VariableNameConflictError # noqa: F401 +from .variable_not_found_error import VariableNotFoundError # noqa: F401 diff --git a/openfisca_core/formula_helpers.py b/openfisca_core/formula_helpers.py deleted file mode 100644 index e0c755348e..0000000000 --- a/openfisca_core/formula_helpers.py +++ /dev/null @@ -1,9 +0,0 @@ -# The formula_helpers module has been deprecated since X.X.X, -# and will be removed in the future. -# -# The helpers have been moved to the commons module. -# -# The following are transitional imports to ensure non-breaking changes. -# Could be deprecated in the next major release. - -from openfisca_core.commons import apply_thresholds, concat, switch # noqa: F401 diff --git a/openfisca_core/memory_config.py b/openfisca_core/memory_config.py deleted file mode 100644 index 18c4cebcdc..0000000000 --- a/openfisca_core/memory_config.py +++ /dev/null @@ -1,9 +0,0 @@ -# The memory config module has been deprecated since X.X.X, -# and will be removed in the future. -# -# Module's contents have been moved to the experimental module. -# -# The following are transitional imports to ensure non-breaking changes. -# Could be deprecated in the next major release. - -from openfisca_core.experimental import MemoryConfig # noqa: F401 diff --git a/openfisca_core/parameters/__init__.py b/openfisca_core/parameters/__init__.py index 040ae47056..bbf5a0595f 100644 --- a/openfisca_core/parameters/__init__.py +++ b/openfisca_core/parameters/__init__.py @@ -21,9 +21,6 @@ # # See: https://www.python.org/dev/peps/pep-0008/#imports -from openfisca_core.errors import ParameterNotFound, ParameterParsingError # noqa: F401 - - from .config import ( # noqa: F401 ALLOWED_PARAM_TYPES, COMMON_KEYS, @@ -39,6 +36,6 @@ from .vectorial_parameter_node_at_instant import VectorialParameterNodeAtInstant # noqa: F401 from .parameter import Parameter # noqa: F401 from .parameter_node import ParameterNode # noqa: F401 -from .parameter_scale import ParameterScale, ParameterScale as Scale # noqa: F401 -from .parameter_scale_bracket import ParameterScaleBracket, ParameterScaleBracket as Bracket # noqa: F401 +from .parameter_scale import ParameterScale # noqa: F401 +from .parameter_scale_bracket import ParameterScaleBracket # noqa: F401 from .values_history import ValuesHistory # noqa: F401 diff --git a/openfisca_core/rates.py b/openfisca_core/rates.py deleted file mode 100644 index 9dfbbefcf0..0000000000 --- a/openfisca_core/rates.py +++ /dev/null @@ -1,9 +0,0 @@ -# The formula_helpers module has been deprecated since X.X.X, -# and will be removed in the future. -# -# The helpers have been moved to the commons module. -# -# The following are transitional imports to ensure non-breaking changes. -# Could be deprecated in the next major release. - -from openfisca_core.commons import average_rate, marginal_rate # noqa: F401 diff --git a/openfisca_core/simulation_builder.py b/openfisca_core/simulation_builder.py deleted file mode 100644 index 57c7765ebe..0000000000 --- a/openfisca_core/simulation_builder.py +++ /dev/null @@ -1,16 +0,0 @@ -# The simulation builder module has been deprecated since X.X.X, -# and will be removed in the future. -# -# Module's contents have been moved to the simulation module. -# -# The following are transitional imports to ensure non-breaking changes. -# Could be deprecated in the next major release. - -from openfisca_core.simulations import ( # noqa: F401 - Simulation, - SimulationBuilder, - calculate_output_add, - calculate_output_divide, - check_type, - transform_to_strict_syntax, - ) diff --git a/openfisca_core/simulations/__init__.py b/openfisca_core/simulations/__init__.py index 5b02dc1a22..2f7a9c6d51 100644 --- a/openfisca_core/simulations/__init__.py +++ b/openfisca_core/simulations/__init__.py @@ -21,8 +21,6 @@ # # See: https://www.python.org/dev/peps/pep-0008/#imports -from openfisca_core.errors import CycleError, NaNCreationError, SpiralError # noqa: F401 - from .helpers import calculate_output_add, calculate_output_divide, check_type, transform_to_strict_syntax # noqa: F401 from .simulation import Simulation # noqa: F401 from .simulation_builder import SimulationBuilder # noqa: F401 diff --git a/openfisca_core/taxbenefitsystems/__init__.py b/openfisca_core/taxbenefitsystems/__init__.py index bf5f224c2c..05a2deb36b 100644 --- a/openfisca_core/taxbenefitsystems/__init__.py +++ b/openfisca_core/taxbenefitsystems/__init__.py @@ -21,6 +21,4 @@ # # See: https://www.python.org/dev/peps/pep-0008/#imports -from openfisca_core.errors import VariableNameConflict, VariableNotFound # noqa: F401 - from .tax_benefit_system import TaxBenefitSystem # noqa: F401 diff --git a/openfisca_core/taxscales/__init__.py b/openfisca_core/taxscales/__init__.py index 0364101d71..0e074b2e6e 100644 --- a/openfisca_core/taxscales/__init__.py +++ b/openfisca_core/taxscales/__init__.py @@ -21,8 +21,6 @@ # # See: https://www.python.org/dev/peps/pep-0008/#imports -from openfisca_core.errors import EmptyArgumentError # noqa: F401 - from .helpers import combine_tax_scales # noqa: F401 from .tax_scale_like import TaxScaleLike # noqa: F401 from .rate_tax_scale_like import RateTaxScaleLike # noqa: F401 diff --git a/openfisca_core/variables/__init__.py b/openfisca_core/variables/__init__.py index fb36963f7d..3decaf8f42 100644 --- a/openfisca_core/variables/__init__.py +++ b/openfisca_core/variables/__init__.py @@ -24,4 +24,3 @@ from .config import VALUE_TYPES, FORMULA_NAME_PREFIX # noqa: F401 from .helpers import get_annualized_variable, get_neutralized_variable # noqa: F401 from .variable import Variable # noqa: F401 -from .typing import Formula # noqa: F401 diff --git a/openfisca_core/variables/variable.py b/openfisca_core/variables/variable.py index 61a5d9274f..acfeb9fe70 100644 --- a/openfisca_core/variables/variable.py +++ b/openfisca_core/variables/variable.py @@ -309,7 +309,7 @@ def get_formula(self, period = None): If no period is given and the variable has several formula, return the oldest formula. :returns: Formula used to compute the variable - :rtype: .Formula + :rtype: callable """ From 6872ae788b54b4ce2d231718c2d71b54f956a865 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 16:54:26 +0200 Subject: [PATCH 31/37] Fix failing tests after expire --- openfisca_core/model_api.py | 8 ++++---- openfisca_core/tools/test_runner.py | 10 +++++----- openfisca_web_api/handlers.py | 2 +- openfisca_web_api/loader/parameters.py | 4 ++-- .../parameter_validation/test_parameter_validation.py | 5 ++++- .../parameters_fancy_indexing/test_fancy_indexing.py | 7 ++++--- .../tax_scales/test_linear_average_rate_tax_scale.py | 5 +++-- .../core/tax_scales/test_marginal_amount_tax_scale.py | 2 +- tests/core/tax_scales/test_marginal_rate_tax_scale.py | 5 +++-- tests/core/tax_scales/test_single_amount_tax_scale.py | 6 +++--- tests/core/test_holders.py | 2 +- tests/core/test_parameters.py | 7 ++++--- tests/core/test_tracers.py | 3 ++- tests/core/tools/test_runner/test_yaml_runner.py | 4 ++-- tests/core/variables/test_variables.py | 2 +- tests/web_api/loader/test_parameters.py | 10 +++++----- 16 files changed, 45 insertions(+), 37 deletions(-) diff --git a/openfisca_core/model_api.py b/openfisca_core/model_api.py index 8ccf5c2763..3140c04d69 100644 --- a/openfisca_core/model_api.py +++ b/openfisca_core/model_api.py @@ -19,12 +19,12 @@ from openfisca_core.indexed_enums import Enum # noqa: F401 from openfisca_core.parameters import ( # noqa: F401 - load_parameter_file, - ParameterNode, - Scale, - Bracket, Parameter, + ParameterNode, + ParameterScale, + ParameterScaleBracket, ValuesHistory, + load_parameter_file, ) from openfisca_core.periods import DAY, MONTH, YEAR, ETERNITY, period # noqa: F401 diff --git a/openfisca_core/tools/test_runner.py b/openfisca_core/tools/test_runner.py index 1c37ea1469..286ff06991 100644 --- a/openfisca_core/tools/test_runner.py +++ b/openfisca_core/tools/test_runner.py @@ -10,8 +10,8 @@ import pytest from openfisca_core.tools import assert_near -from openfisca_core.simulation_builder import SimulationBuilder -from openfisca_core.errors import SituationParsingError, VariableNotFound +from openfisca_core.simulations import SimulationBuilder +from openfisca_core.errors import SituationParsingError, VariableNotFoundError from openfisca_core.warnings import LibYAMLWarning @@ -150,7 +150,7 @@ def runtest(self): try: builder.set_default_period(period) self.simulation = builder.build_from_dict(self.tax_benefit_system, input) - except (VariableNotFound, SituationParsingError): + except (VariableNotFoundError, SituationParsingError): raise except Exception as e: error_message = os.linesep.join([str(e), '', f"Unexpected error raised while parsing '{self.fspath}'"]) @@ -200,7 +200,7 @@ def check_output(self): entity_index = population.get_index(instance_id) self.check_variable(variable_name, value, self.test.get('period'), entity_index) else: - raise VariableNotFound(key, self.tax_benefit_system) + raise VariableNotFoundError(key, self.tax_benefit_system) def check_variable(self, variable_name, expected_value, period, entity_index = None): if self.should_ignore_variable(variable_name): @@ -231,7 +231,7 @@ def should_ignore_variable(self, variable_name): return variable_ignored or variable_not_tested def repr_failure(self, excinfo): - if not isinstance(excinfo.value, (AssertionError, VariableNotFound, SituationParsingError)): + if not isinstance(excinfo.value, (AssertionError, VariableNotFoundError, SituationParsingError)): return super(YamlItem, self).repr_failure(excinfo) message = excinfo.value.args[0] diff --git a/openfisca_web_api/handlers.py b/openfisca_web_api/handlers.py index 9c8826772c..1a6ace07db 100644 --- a/openfisca_web_api/handlers.py +++ b/openfisca_web_api/handlers.py @@ -2,7 +2,7 @@ import dpath -from openfisca_core.simulation_builder import SimulationBuilder +from openfisca_core.simulations import SimulationBuilder from openfisca_core.indexed_enums import Enum diff --git a/openfisca_web_api/loader/parameters.py b/openfisca_web_api/loader/parameters.py index 23a5f738b5..39534f972e 100644 --- a/openfisca_web_api/loader/parameters.py +++ b/openfisca_web_api/loader/parameters.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openfisca_core.parameters import Parameter, ParameterNode, Scale +from openfisca_core.parameters import Parameter, ParameterNode, ParameterScale def build_api_values_history(values_history): @@ -77,7 +77,7 @@ def build_api_parameter(parameter, country_package_metadata): if parameter.documentation: api_parameter['documentation'] = parameter.documentation.strip() api_parameter['values'] = build_api_values_history(parameter) - elif isinstance(parameter, Scale): + elif isinstance(parameter, ParameterScale): if 'rate' in parameter.brackets[0].children: api_parameter['brackets'] = build_api_scale(parameter, 'rate') elif 'amount' in parameter.brackets[0].children: diff --git a/tests/core/parameter_validation/test_parameter_validation.py b/tests/core/parameter_validation/test_parameter_validation.py index 62b2b0c132..561fb28cb1 100644 --- a/tests/core/parameter_validation/test_parameter_validation.py +++ b/tests/core/parameter_validation/test_parameter_validation.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- import os + import pytest -from openfisca_core.parameters import load_parameter_file, ParameterNode, ParameterParsingError + +from openfisca_core.errors import ParameterParsingError +from openfisca_core.parameters import load_parameter_file, ParameterNode BASE_DIR = os.path.dirname(os.path.abspath(__file__)) year = 2016 diff --git a/tests/core/parameters_fancy_indexing/test_fancy_indexing.py b/tests/core/parameters_fancy_indexing/test_fancy_indexing.py index d34eb00773..41f42fad88 100644 --- a/tests/core/parameters_fancy_indexing/test_fancy_indexing.py +++ b/tests/core/parameters_fancy_indexing/test_fancy_indexing.py @@ -7,9 +7,10 @@ import pytest -from openfisca_core.tools import assert_near -from openfisca_core.parameters import ParameterNode, Parameter, ParameterNotFound +from openfisca_core.errors import ParameterNotFoundError from openfisca_core.model_api import * # noqa +from openfisca_core.parameters import ParameterNode, Parameter +from openfisca_core.tools import assert_near LOCAL_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -59,7 +60,7 @@ def test_triple_fancy_indexing(): def test_wrong_key(): zone = np.asarray(['z1', 'z2', 'z2', 'toto']) - with pytest.raises(ParameterNotFound) as e: + with pytest.raises(ParameterNotFoundError) as e: P.single.owner[zone] assert "'rate.single.owner.toto' was not found" in get_message(e.value) diff --git a/tests/core/tax_scales/test_linear_average_rate_tax_scale.py b/tests/core/tax_scales/test_linear_average_rate_tax_scale.py index 83153024c7..74b2762963 100644 --- a/tests/core/tax_scales/test_linear_average_rate_tax_scale.py +++ b/tests/core/tax_scales/test_linear_average_rate_tax_scale.py @@ -2,6 +2,7 @@ from openfisca_core import taxscales from openfisca_core import tools +from openfisca_core.errors import EmptyArgumentError import pytest @@ -49,7 +50,7 @@ def test_bracket_indices_without_tax_base(): tax_scale.add_bracket(2, 0) tax_scale.add_bracket(4, 0) - with pytest.raises(taxscales.EmptyArgumentError): + with pytest.raises(EmptyArgumentError): tax_scale.bracket_indices(tax_base) @@ -57,7 +58,7 @@ def test_bracket_indices_without_brackets(): tax_base = numpy.array([0, 1, 2, 3, 4, 5]) tax_scale = taxscales.LinearAverageRateTaxScale() - with pytest.raises(taxscales.EmptyArgumentError): + with pytest.raises(EmptyArgumentError): tax_scale.bracket_indices(tax_base) diff --git a/tests/core/tax_scales/test_marginal_amount_tax_scale.py b/tests/core/tax_scales/test_marginal_amount_tax_scale.py index 7582d725b4..cdd7cc4f27 100644 --- a/tests/core/tax_scales/test_marginal_amount_tax_scale.py +++ b/tests/core/tax_scales/test_marginal_amount_tax_scale.py @@ -35,7 +35,7 @@ def test_calc(): # TODO: move, as we're testing Scale, not MarginalAmountTaxScale def test_dispatch_scale_type_on_creation(data): - scale = parameters.Scale("amount_scale", data, "") + scale = parameters.ParameterScale("amount_scale", data, "") first_jan = periods.Instant((2017, 11, 1)) result = scale.get_at_instant(first_jan) diff --git a/tests/core/tax_scales/test_marginal_rate_tax_scale.py b/tests/core/tax_scales/test_marginal_rate_tax_scale.py index 1688e7e3cc..505d103348 100644 --- a/tests/core/tax_scales/test_marginal_rate_tax_scale.py +++ b/tests/core/tax_scales/test_marginal_rate_tax_scale.py @@ -2,6 +2,7 @@ from openfisca_core import taxscales from openfisca_core import tools +from openfisca_core.errors import EmptyArgumentError import pytest @@ -49,7 +50,7 @@ def test_bracket_indices_without_tax_base(): tax_scale.add_bracket(2, 0) tax_scale.add_bracket(4, 0) - with pytest.raises(taxscales.EmptyArgumentError): + with pytest.raises(EmptyArgumentError): tax_scale.bracket_indices(tax_base) @@ -57,7 +58,7 @@ def test_bracket_indices_without_brackets(): tax_base = numpy.array([0, 1, 2, 3, 4, 5]) tax_scale = taxscales.LinearAverageRateTaxScale() - with pytest.raises(taxscales.EmptyArgumentError): + with pytest.raises(EmptyArgumentError): tax_scale.bracket_indices(tax_base) diff --git a/tests/core/tax_scales/test_single_amount_tax_scale.py b/tests/core/tax_scales/test_single_amount_tax_scale.py index c5e6483a7d..0eb63c1f26 100644 --- a/tests/core/tax_scales/test_single_amount_tax_scale.py +++ b/tests/core/tax_scales/test_single_amount_tax_scale.py @@ -49,7 +49,7 @@ def test_to_dict(): # TODO: move, as we're testing Scale, not SingleAmountTaxScale def test_assign_thresholds_on_creation(data): - scale = parameters.Scale("amount_scale", data, "") + scale = parameters.ParameterScale("amount_scale", data, "") first_jan = periods.Instant((2017, 11, 1)) scale_at_instant = scale.get_at_instant(first_jan) @@ -60,7 +60,7 @@ def test_assign_thresholds_on_creation(data): # TODO: move, as we're testing Scale, not SingleAmountTaxScale def test_assign_amounts_on_creation(data): - scale = parameters.Scale("amount_scale", data, "") + scale = parameters.ParameterScale("amount_scale", data, "") first_jan = periods.Instant((2017, 11, 1)) scale_at_instant = scale.get_at_instant(first_jan) @@ -71,7 +71,7 @@ def test_assign_amounts_on_creation(data): # TODO: move, as we're testing Scale, not SingleAmountTaxScale def test_dispatch_scale_type_on_creation(data): - scale = parameters.Scale("amount_scale", data, "") + scale = parameters.ParameterScale("amount_scale", data, "") first_jan = periods.Instant((2017, 11, 1)) result = scale.get_at_instant(first_jan) diff --git a/tests/core/test_holders.py b/tests/core/test_holders.py index cd26231037..d06ce34f04 100644 --- a/tests/core/test_holders.py +++ b/tests/core/test_holders.py @@ -7,7 +7,7 @@ from openfisca_core import holders, periods, tools from openfisca_core.errors import PeriodMismatchError -from openfisca_core.memory_config import MemoryConfig +from openfisca_core.experimental import MemoryConfig from openfisca_core.simulations import SimulationBuilder from openfisca_core.holders import Holder diff --git a/tests/core/test_parameters.py b/tests/core/test_parameters.py index 40d8bb3fc9..4f74f9d907 100644 --- a/tests/core/test_parameters.py +++ b/tests/core/test_parameters.py @@ -2,7 +2,8 @@ import pytest -from openfisca_core.parameters import ParameterNotFound, ParameterNode, ParameterNodeAtInstant, load_parameter_file +from openfisca_core.errors import ParameterNotFoundError +from openfisca_core.parameters import ParameterNode, ParameterNodeAtInstant, load_parameter_file def test_get_at_instant(tax_benefit_system): @@ -27,7 +28,7 @@ def test_param_values(tax_benefit_system): def test_param_before_it_is_defined(tax_benefit_system): - with pytest.raises(ParameterNotFound): + with pytest.raises(ParameterNotFoundError): tax_benefit_system.get_parameters_at_instant('1997-12-31').taxes.income_tax_rate @@ -41,7 +42,7 @@ def test_stopped_parameter_before_end_value(tax_benefit_system): def test_stopped_parameter_after_end_value(tax_benefit_system): - with pytest.raises(ParameterNotFound): + with pytest.raises(ParameterNotFoundError): tax_benefit_system.get_parameters_at_instant('2016-12-01').benefits.housing_allowance diff --git a/tests/core/test_tracers.py b/tests/core/test_tracers.py index 2e3d8dbb56..383723d20b 100644 --- a/tests/core/test_tracers.py +++ b/tests/core/test_tracers.py @@ -6,7 +6,8 @@ import numpy as np from pytest import fixture, mark, raises, approx -from openfisca_core.simulations import Simulation, CycleError, SpiralError +from openfisca_core.errors import CycleError, SpiralError +from openfisca_core.simulations import Simulation from openfisca_core.tracers import SimpleTracer, FullTracer, TracingParameterNodeAtInstant, TraceNode from openfisca_country_template.variables.housing import HousingOccupancyStatus from .parameters_fancy_indexing.test_fancy_indexing import parameters diff --git a/tests/core/tools/test_runner/test_yaml_runner.py b/tests/core/tools/test_runner/test_yaml_runner.py index bd7aaccad7..a8cd55c154 100644 --- a/tests/core/tools/test_runner/test_yaml_runner.py +++ b/tests/core/tools/test_runner/test_yaml_runner.py @@ -5,7 +5,7 @@ import numpy as np from openfisca_core.tools.test_runner import _get_tax_benefit_system, YamlItem, YamlFile -from openfisca_core.errors import VariableNotFound +from openfisca_core.errors import VariableNotFoundError from openfisca_core.variables import Variable from openfisca_core.populations import Population from openfisca_core.entities import Entity @@ -86,7 +86,7 @@ def __init__(self): def test_variable_not_found(): test = {"output": {"unknown_variable": 0}} - with pytest.raises(VariableNotFound) as excinfo: + with pytest.raises(VariableNotFoundError) as excinfo: test_item = TestItem(test) test_item.check_output() assert excinfo.value.variable_name == "unknown_variable" diff --git a/tests/core/variables/test_variables.py b/tests/core/variables/test_variables.py index 876145bde1..f01ce7c480 100644 --- a/tests/core/variables/test_variables.py +++ b/tests/core/variables/test_variables.py @@ -4,7 +4,7 @@ from openfisca_core.model_api import Variable from openfisca_core.periods import MONTH, ETERNITY -from openfisca_core.simulation_builder import SimulationBuilder +from openfisca_core.simulations import SimulationBuilder from openfisca_core.tools import assert_near import openfisca_country_template as country_template diff --git a/tests/web_api/loader/test_parameters.py b/tests/web_api/loader/test_parameters.py index e17472a9d6..232bd24c26 100644 --- a/tests/web_api/loader/test_parameters.py +++ b/tests/web_api/loader/test_parameters.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openfisca_core.parameters import Scale +from openfisca_core.parameters import ParameterScale from openfisca_web_api.loader.parameters import build_api_scale, build_api_parameter @@ -8,21 +8,21 @@ def test_build_rate_scale(): '''Extracts a 'rate' children from a bracket collection''' data = {'brackets': [{'rate': {'2014-01-01': {'value': 0.5}}, 'threshold': {'2014-01-01': {'value': 1}}}]} - rate = Scale('this rate', data, None) + rate = ParameterScale('this rate', data, None) assert build_api_scale(rate, 'rate') == {'2014-01-01': {1: 0.5}} def test_build_amount_scale(): '''Extracts an 'amount' children from a bracket collection''' data = {'brackets': [{'amount': {'2014-01-01': {'value': 0}}, 'threshold': {'2014-01-01': {'value': 1}}}]} - rate = Scale('that amount', data, None) + rate = ParameterScale('that amount', data, None) assert build_api_scale(rate, 'amount') == {'2014-01-01': {1: 0}} def test_full_rate_scale(): '''Serializes a 'rate' scale parameter''' data = {'brackets': [{'rate': {'2014-01-01': {'value': 0.5}}, 'threshold': {'2014-01-01': {'value': 1}}}]} - scale = Scale('rate', data, None) + scale = ParameterScale('rate', data, None) api_scale = build_api_parameter(scale, {}) assert api_scale == {'description': None, 'id': 'rate', 'metadata': {}, 'brackets': {'2014-01-01': {1: 0.5}}} @@ -30,6 +30,6 @@ def test_full_rate_scale(): def test_walk_node_amount_scale(): '''Serializes an 'amount' scale parameter ''' data = {'brackets': [{'amount': {'2014-01-01': {'value': 0}}, 'threshold': {'2014-01-01': {'value': 1}}}]} - scale = Scale('amount', data, None) + scale = ParameterScale('amount', data, None) api_scale = build_api_parameter(scale, {}) assert api_scale == {'description': None, 'id': 'amount', 'metadata': {}, 'brackets': {'2014-01-01': {1: 0}}} From 64007a237a125943c2d77328f097bd3ae7e8bab2 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 16:54:51 +0200 Subject: [PATCH 32/37] Remove outdated instruction from circle --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e581c5555e..f1ff914272 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,8 +40,6 @@ jobs: command: | make install-deps make install-dev - # pip install --editable git+https://github.com/openfisca/country-template.git@BRANCH_NAME#egg=OpenFisca-Country-Template # use a specific branch of OpenFisca-Country-Template - # pip install --editable git+https://github.com/openfisca/extension-template.git@BRANCH_NAME#egg=OpenFisca-Extension-Template # use a specific branch of OpenFisca-Extension-Template - save_cache: key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }} From 6d2c415bb3ae7e3a01404bc002a7fdec7d1bf9fe Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 23:08:16 +0200 Subject: [PATCH 33/37] Update to major version 36.0.0 --- CHANGELOG.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27d95ddaa3..6d20703016 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,59 @@ # Changelog +# 36.0.0 [#1015](https://github.com/openfisca/openfisca-core/pull/1015) + +#### Technical changes + +- Extract requirements to separate files for easier contract enforcement. +- Add explicit contract regarding supported dependencies. +- Add constraint file to test against lower-bound NumPy. +- Add extra dependencies. + - Add coveralls (latest) to extra requirements. + - Add twine (latest) to extra requirements. + - Add wheel (latest) to extra requirements. +- Pin non-distribution dependencies. + - Pin autopep8 at latest. + - Pin flake8 at latest. + - Pin flake8-bugbear at latest. + - Pin flake8-print at latest. + - Pin pytest-cov at latest. + - Pin mypy at latest. + - Pin flask at 1.1.2. + - Pin gunicorn at 20.1.0. + - Pin flask-cors at 3.0.10. + - Pin werkzeug at 1.0.1. +- Relax distrubution dependencies. + - Set dpath at >= 1.3.2, < 2. + - Set psutil at >= 5.4.7, < 6. + - Set sortedcontainers at >= 2, < 3. +- Relax circular dependencies. + - Relax openfisca-country-template. + - Relax openfisca-extension-template. + +#### Breaking changes + +- Drop support for Python < 3.7. + - Python 3.7 [introduces backwards incompatible syntax changes](https://docs.python.org/3/whatsnew/3.7.html) that might be used in your country models. +- Drop support for numexpr < 2.7.1. + - numexpr 2.7.1 [introduces no breaking changes](https://numexpr.readthedocs.io/projects/NumExpr3/en/latest/release_notes.html#changes-from-2-7-0-to-2-7-1). +- Drop support for NumPy < 1.17 + - NumPy 1.12 [expires a list of old deprecations](https://numpy.org/devdocs/release/1.12.0-notes.html#compatibility-notes) that might be used in your country models. + - NumPy 1.13 [expires a list of old deprecations](https://numpy.org/devdocs/release/1.13.0-notes.html#compatibility-notes) that might be used in your country models. + - NumPy 1.14 [expires a list of old deprecations](https://numpy.org/devdocs/release/1.14.0-notes.html#compatibility-notes) that might be used in your country models. + - NumPy 1.15 [expires a list of old deprecations](https://numpy.org/devdocs/release/1.15.0-notes.html#compatibility-notes) that might be used in your country models. + - NumPy 1.16 [expires a list of old deprecations](https://numpy.org/devdocs/release/1.16.0-notes.html#expired-deprecations) that might be used in your country models. + - NumPy 1.17 [expires a list of old deprecations](https://numpy.org/devdocs/release/1.17.0-notes.html#compatibility-notes) that might be used in your country models. +- Drop support for pytest < 5.4.2. + - pytest 5 [introduces a list of removals and deprecations](https://docs.pytest.org/en/stable/changelog.html#pytest-5-0-0-2019-06-28) that might be used in your country models. + - pytest 5.1 [introduces a list of removals](https://docs.pytest.org/en/stable/changelog.html#pytest-5-1-0-2019-08-15) that might be used in your country models. + - pytest 5.2 [introduces a list of deprecations](https://docs.pytest.org/en/stable/changelog.html#pytest-5-2-0-2019-09-28) that might be used in your country models. + - pytest 5.3 [introduces a list of deprecations](https://docs.pytest.org/en/stable/changelog.html#pytest-5-3-0-2019-11-19) that might be used in your country models. + - pytest 5.4 [introduces a list of breaking changes and deprecations](https://docs.pytest.org/en/stable/changelog.html#pytest-5-3-0-2019-11-19) that might be used in your country models. + - pytest 5.4.1 [introduces no breaking changes](https://docs.pytest.org/en/stable/changelog.html#pytest-5-4-1-2020-03-13). + - pytest 5.4.2 [introduces no breaking changes](https://docs.pytest.org/en/stable/changelog.html#pytest-5-4-2-2020-05-08). +- Drop support for PyYAML < 5.1. + - PyYAML 5.1 [introduces some breaking changes](https://github.com/yaml/pyyaml/blob/ee37f4653c08fc07aecff69cfd92848e6b1a540e/CHANGES#L66-L97) that might be used in your country models. + ### 35.7.1 [#1075](https://github.com/openfisca/openfisca-core/pull/1075) #### Bug fix From 6f73e98a9958cb05a7d81e5c8f28291f3c929c07 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 17:17:14 +0200 Subject: [PATCH 34/37] Fix circleci config --- .circleci/config.yml | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f1ff914272..b107a97b1b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,7 @@ jobs: - image: python:3.7 environment: TERM: xterm-256color # To colorize output of make tasks. + PYTEST_ADDOPTS: --exitfirst steps: - checkout @@ -72,19 +73,15 @@ jobs: - run: name: Run openfisca-core tests - command: make test-core pytest_args="--exitfirst" + command: make test-core - run: name: Run country-template tests - command: make test-country pytest_args="--exitfirst" + command: make test-country - run: name: Run extension-template tests - command: make test-extension pytest_args="--exitfirst" - - - run: - name: Run core tests - command: make test + command: make test-extension - persist_to_workspace: root: . @@ -137,8 +134,8 @@ jobs: test_compatibility: docker: - image: python:3.7 - environment: + TERM: xterm-256color # To colorize output of make tasks. PYTEST_ADDOPTS: --exitfirst steps: @@ -158,8 +155,20 @@ jobs: make install-compat - run: - name: Run core tests - command: make test + name: Run linters + command: make lint + + - run: + name: Run openfisca-core tests + command: make test-core + + - run: + name: Run country-template tests + command: make test-country + + - run: + name: Run extension-template tests + command: make test-extension submit_coverage: docker: From 23f4aff36c27f848288003aacf20af6ee52f0611 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 17:32:46 +0200 Subject: [PATCH 35/37] Remove deprecation leftovers --- openfisca_core/commons/dummy.py | 23 ---------------------- openfisca_core/commons/tests/test_dummy.py | 10 ---------- openfisca_core/variables/typing.py | 16 --------------- 3 files changed, 49 deletions(-) delete mode 100644 openfisca_core/commons/dummy.py delete mode 100644 openfisca_core/commons/tests/test_dummy.py delete mode 100644 openfisca_core/variables/typing.py diff --git a/openfisca_core/commons/dummy.py b/openfisca_core/commons/dummy.py deleted file mode 100644 index 5f1b0be330..0000000000 --- a/openfisca_core/commons/dummy.py +++ /dev/null @@ -1,23 +0,0 @@ -import warnings - - -class Dummy: - """A class that did nothing. - - Examples: - >>> Dummy() - None: - message = [ - "The 'Dummy' class has been deprecated since version 34.7.0,", - "and will be removed in the future.", - ] - warnings.warn(" ".join(message), DeprecationWarning) - pass diff --git a/openfisca_core/commons/tests/test_dummy.py b/openfisca_core/commons/tests/test_dummy.py deleted file mode 100644 index d4ecec3842..0000000000 --- a/openfisca_core/commons/tests/test_dummy.py +++ /dev/null @@ -1,10 +0,0 @@ -import pytest - -from openfisca_core.commons import Dummy - - -def test_dummy_deprecation(): - """Dummy throws a deprecation warning when instantiated.""" - - with pytest.warns(DeprecationWarning): - assert Dummy() diff --git a/openfisca_core/variables/typing.py b/openfisca_core/variables/typing.py deleted file mode 100644 index 892ec0bf9f..0000000000 --- a/openfisca_core/variables/typing.py +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Callable, Union - -import numpy - -from openfisca_core.parameters import ParameterNodeAtInstant -from openfisca_core.periods import Instant, Period -from openfisca_core.populations import Population, GroupPopulation - -#: A collection of :obj:`.Entity` or :obj:`.GroupEntity`. -People = Union[Population, GroupPopulation] - -#: A callable to get the parameters for the given instant. -Params = Callable[[Instant], ParameterNodeAtInstant] - -#: A callable defining a calculation, or a rule, on a system. -Formula = Callable[[People, Period, Params], numpy.ndarray] From 2b322a38d6e56d0d7b0f522338c1a2f4ba7ea9d0 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 26 Oct 2021 17:55:25 +0200 Subject: [PATCH 36/37] Update tracker installation instructions --- README.md | 5 ++--- openfisca_tasks/install.mk | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5f060caf23..c38a614754 100644 --- a/README.md +++ b/README.md @@ -199,9 +199,8 @@ pip install openfisca_core[tracker] Or for an editable installation: ``` -pip install --requirement requirements/tracker --upgrade -pip install --requirement requirements/dev --upgrade -pip install --editable . --upgrade --no-dependencies +make install +make install-tracker ``` #### Tracker configuration diff --git a/openfisca_tasks/install.mk b/openfisca_tasks/install.mk index f7d1f8074b..ac6bf1b34a 100644 --- a/openfisca_tasks/install.mk +++ b/openfisca_tasks/install.mk @@ -22,6 +22,11 @@ install-core: @pip uninstall --quiet --yes openfisca-core @pip install --quiet --no-dependencies --editable . +## Install the WebAPI tracker. +install-tracker: + @$(call print_help,$@:) + @pip install --quiet --upgrade --constraint requirements/tracker openfisca-tracker + ## Install lower-bound dependencies for compatibility check. install-compat: @$(call print_help,$@:) From 24522416fdc1c6eaba2fbe5390e58555ecdbdbe9 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 1 May 2021 23:08:16 +0200 Subject: [PATCH 37/37] Update to major version 36.0.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d20703016..502ca99d51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,27 @@ - Drop support for PyYAML < 5.1. - PyYAML 5.1 [introduces some breaking changes](https://github.com/yaml/pyyaml/blob/ee37f4653c08fc07aecff69cfd92848e6b1a540e/CHANGES#L66-L97) that might be used in your country models. +#### Expired deprecations + +- `openfisca_core.commons.Dummy` => `openfisca_core.commons.empty_clone` +- `openfisca_core.errors.ParameterNotFound` => `openfisca_core.errors.ParameterNotFoundError` +- `openfisca_core.errors.VariableNameConflict` => `openfisca_core.errors.VariableNameConflictError` +- `openfisca_core.errors.VariableNotFound` => `openfisca_core.errors.VariableNotFoundError` +- `openfisca_core.formula_helpers.py` => `openfisca_core.commons` +- `openfisca_core.memory_config.py` => `openfisca_core.experimental` +- `openfisca_core.parameters.Bracket` => `openfisca_core.errors.ParameterScaleBracket` +- `openfisca_core.parameters.ParameterNotFound` => `openfisca_core.errors.ParameterNotFoundError` +- `openfisca_core.parameters.ParameterParsingError` => `openfisca_core.errors.ParameterParsingError` +- `openfisca_core.parameters.Scale` => `openfisca_core.errors.ParameterScale` +- `openfisca_core.rates` => `openfisca_core.commons` +- `openfisca_core.simulation_builder` => `openfisca_core.simulations` +- `openfisca_core.simulations.CycleError` => `openfisca_core.errors.CycleError` +- `openfisca_core.simulations.NaNCreationError` => `openfisca_core.errors.NaNCreationError` +- `openfisca_core.simulations.SpiralError` => `openfisca_core.errors.SpiralError` +- `openfisca_core.taxbenefitsystems.VariableNameConflict` => `openfisca_core.errors.VariableNameConflictError` +- `openfisca_core.taxbenefitsystems.VariableNotFound` => `openfisca_core.errors.VariableNotFoundError` +- `openfisca_core.taxscales.EmptyArgumentError` => `openfisca_core.errors.EmptyArgumentError` + ### 35.7.1 [#1075](https://github.com/openfisca/openfisca-core/pull/1075) #### Bug fix