Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Improve dependency management #1015

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
927263a
Extract general requirements to file
May 1, 2021
027256a
Extract api requirements to file
May 1, 2021
0076c6f
Extract ci requirements to file
May 1, 2021
98fe43a
Extract dev requirements to file
May 1, 2021
cc2dccd
Pin dev requirements
May 1, 2021
9fbb223
Pin api requirements
May 1, 2021
65207fe
Relax sortedcontainers
May 1, 2021
024400c
Relax psutil
May 1, 2021
83a53be
Relax dpath
May 1, 2021
e167093
Drop support for numexpr < 2.7.1
May 1, 2021
caf1c85
Drop support for pytest < 5.4.2
May 1, 2021
b31aec2
Drop support for PyYAML < 5.1
May 1, 2021
7edbe62
Drop support for NumPy < 1.17
May 1, 2021
a38458b
Add integrity test for NumPy
May 1, 2021
62c0585
Improve phrasing in README.md
Sep 7, 2021
7b90b14
Remove debug requirements
Sep 7, 2021
8b1b84b
Do not pin deps/tracker
Sep 7, 2021
73eaac8
Clarify requirements/install
Sep 7, 2021
a2103a6
Delete duplicated numpy rule
Sep 7, 2021
d865888
Add link to issue in dpath
Sep 7, 2021
9bec4de
Improve message in tracker deps
Sep 7, 2021
65855e8
Improve wording in web-api deps
Sep 7, 2021
4fbf18a
Remove legacy resolver
Sep 8, 2021
d0bd511
Update README.md
Sep 8, 2021
0818f57
Apply suggestions from code review
Oct 25, 2021
e346c09
Rename constraints => compatibility
Oct 26, 2021
e5b803e
Update dependencies
Oct 26, 2021
c0a654e
Use make as task-manager
Oct 26, 2021
5801347
Update README.md
Oct 26, 2021
65c4621
Expire deprecations
Oct 26, 2021
6872ae7
Fix failing tests after expire
Oct 26, 2021
64007a2
Remove outdated instruction from circle
Oct 26, 2021
6d2c415
Update to major version 36.0.0
May 1, 2021
6f73e98
Fix circleci config
Oct 26, 2021
23f4aff
Remove deprecation leftovers
Oct 26, 2021
2b322a3
Update tracker installation instructions
Oct 26, 2021
2452241
Update to major version 36.0.0
May 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 108 additions & 33 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -17,40 +30,58 @@ 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 --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
make install-deps
make install-dev

- save_cache:
key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }}
paths:
- /tmp/venv/openfisca_core

test:
docker:
- image: python:3.7
environment:
TERM: xterm-256color # To colorize output of make tasks.
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: make install-core

- run:
name: Run linters
command: make lint

- 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: 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
command: make test-extension

- persist_to_workspace:
root: .
Expand Down Expand Up @@ -81,7 +112,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
Expand All @@ -97,18 +131,44 @@ jobs:
command: make test-doc-build


check_version:
test_compatibility:
docker:
- image: python:3.7
environment:
TERM: xterm-256color # To colorize output of make tasks.
PYTEST_ADDOPTS: --exitfirst

steps:
- checkout

- restore_cache:
key: v1-py3-{{ .Branch }}-{{ checksum "setup.py" }}

- run:
name: Check version number has been properly updated
name: Activate virtualenv
command: echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV

- run:
name: Install core with a constrained Numpy version
command: |
git fetch
.circleci/is-version-number-acceptable.sh
make install-core
make install-compat

- run:
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:
Expand All @@ -123,21 +183,21 @@ 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 coveralls
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

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!
Expand All @@ -153,10 +213,14 @@ jobs:
command: if ! .circleci/has-functional-changes.sh ; then circleci step halt ; fi

- run:
name: Upload a Python package to Pypi
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
.circleci/publish-python-package.sh
make build
make publish

- run:
name: Publish a git tag
Expand All @@ -171,17 +235,28 @@ workflows:
version: 2
build_and_deploy:
jobs:
- run_tests
- test_docs
- check_version
- build
- test:
requires:
- build
- test_docs:
requires:
- build
- test_compatibility:
requires:
- test_docs
- submit_coverage:
requires:
- run_tests
- test
- test_docs
- test_compatibility
- deploy:
requires:
- run_tests
- test_docs
- check_version
- test
- test_docs
- test_compatibility
filters:
branches:
only: master
38 changes: 0 additions & 38 deletions .circleci/get-numpy-version.py

This file was deleted.

4 changes: 0 additions & 4 deletions .circleci/publish-python-package.sh

This file was deleted.

75 changes: 75 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,80 @@
# 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.

#### 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
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
recursive-include openfisca_core/scripts *
graft requirements
include openfisca_web_api/openAPI.yml
recursive-include openfisca_core/scripts *
Loading