Skip to content

Commit

Permalink
Merge branch 'main' into performance-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
segsell authored Apr 26, 2024
2 parents 9dab4fb + 5574283 commit 20562e2
Show file tree
Hide file tree
Showing 203 changed files with 2,738 additions and 13,244 deletions.
3 changes: 2 additions & 1 deletion .envs/testenv-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ dependencies:
- click # run, tests
- cloudpickle # run, tests
- joblib # run, tests
- numba # run, tests
- numpy>=1.17.0 # run, tests
- pandas # run, tests
- plotly # run, tests
- pybaum >= 0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
- tranquilo>=0.0.4 # dev, tests
- seaborn # dev, tests
- pip: # dev, tests, docs
- DFO-LS # dev, tests
- Py-BOBYQA # dev, tests
Expand Down
5 changes: 3 additions & 2 deletions .envs/testenv-others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- cyipopt
- cyipopt<=1.2.0
- nlopt # dev, tests
- pip # dev, tests, docs
- pytest # dev, tests
Expand All @@ -15,13 +15,14 @@ dependencies:
- click # run, tests
- cloudpickle # run, tests
- joblib # run, tests
- numba # run, tests
- numpy>=1.17.0 # run, tests
- pandas # run, tests
- plotly # run, tests
- pybaum >= 0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
- tranquilo>=0.0.4 # dev, tests
- seaborn # dev, tests
- pip: # dev, tests, docs
- DFO-LS # dev, tests
- Py-BOBYQA # dev, tests
Expand Down
31 changes: 31 additions & 0 deletions .envs/testenv-pandas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: estimagic
channels:
- conda-forge
- nodefaults
dependencies:
- pandas<2.0.0
- nlopt # dev, tests
- pip # dev, tests, docs
- pytest # dev, tests
- pytest-cov # tests
- pytest-xdist # dev, tests
- statsmodels # dev, tests
- bokeh<=2.4.3 # run, tests
- click # run, tests
- cloudpickle # run, tests
- joblib # run, tests
- numpy>=1.17.0 # run, tests
- plotly # run, tests
- pybaum >= 0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
- tranquilo>=0.0.4 # dev, tests
- seaborn # dev, tests
- pip: # dev, tests, docs
- DFO-LS # dev, tests
- Py-BOBYQA # dev, tests
- fides==0.7.4 # dev, tests
- kaleido # dev, tests
- simoptlib==1.0.1 # dev, tests
- -e ../
18 changes: 15 additions & 3 deletions .envs/update_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,28 @@ def main():

## test environment others
test_env_others = deepcopy(test_env)
test_env_others.insert(_insert_idx, " - cyipopt")
test_env_others.insert(_insert_idx, " - cyipopt<=1.2.0")

## test environment for pandas version 1
test_env_pandas = deepcopy(test_env)
test_env_pandas = [line for line in test_env_pandas if "pandas" not in line]
test_env_pandas.insert(_insert_idx, " - pandas<2.0.0")

# create docs testing environment

docs_env = [line for line in lines if _keep_line(line, "docs")]
docs_env.append(" - -e ../") # add local installation

# write environments
for name, env in zip(["linux", "others"], [test_env_linux, test_env_others]):
Path(f".envs/testenv-{name}.yml").write_text("\n".join(env) + "\n")
for name, env in zip(
["linux", "others", "pandas"],
[test_env_linux, test_env_others, test_env_pandas],
):
# Specify newline to avoid wrong line endings on Windows.
# See: https://stackoverflow.com/a/69869641
Path(f".envs/testenv-{name}.yml").write_text(
"\n".join(env) + "\n", newline="\n"
)


if __name__ == "__main__":
Expand Down
35 changes: 33 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ jobs:
os:
- ubuntu-latest
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
steps:
- uses: actions/checkout@v3
- name: create build environment
Expand Down Expand Up @@ -54,9 +55,9 @@ jobs:
- macos-latest
- windows-latest
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
steps:
- uses: actions/checkout@v3
- name: create build environment
Expand All @@ -72,6 +73,36 @@ jobs:
run: |
micromamba activate estimagic
pytest -m "not slow and not jax"
run-tests-with-old-pandas:
# This job is only for testing if estimagic works with older pandas versions, as
# many pandas functions we use will be deprecated in pandas 3. estimagic's behavior
# for older verions is handled in src/estimagic/compat.py.
name: Run tests for ${{ matrix.os}} on ${{ matrix.python-version }} with pandas 1
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version:
- '3.11'
steps:
- uses: actions/checkout@v3
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./.envs/testenv-pandas.yml
environment-name: estimagic
cache-env: true
extra-specs: |
python=${{ matrix.python-version }}
- name: run pytest
shell: bash -l {0}
run: |
micromamba activate estimagic
pytest tests/visualization
pytest tests/parameters
pytest tests/inference
code-in-docs:
name: Run code snippets in documentation
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ instance/
docs/_build/
docs/build/
docs/source/_build/
docs/source/getting_started/*.db
docs/source/**/*.db
docs/source/**/*.db-shm
docs/source/**/*.db-wal
docs/source/refs.bib.bak

# PyBuilder
Expand Down
34 changes: 13 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: check-useless-excludes
# - id: identity # Prints all files passed to pre-commits. Debugging.
- repo: https://github.com/lyz-code/yamlfix
rev: 1.9.0
rev: 1.16.0
hooks:
- id: yamlfix
exclude: tests/optimization/fixtures
Expand All @@ -19,7 +19,7 @@ repos:
always_run: true
require_serial: true
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
args:
Expand Down Expand Up @@ -52,22 +52,22 @@ repos:
- id: check-docstring-first
exclude: src/estimagic/optimization/algo_options.py
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.29.0
rev: v1.35.1
hooks:
- id: yamllint
exclude: tests/optimization/fixtures
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.3.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
rev: 1.16.0
hooks:
- id: blacken-docs
exclude: docs/source/how_to_guides/optimization/how_to_specify_constraints.md
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.1
rev: v1.7.5
hooks:
- id: docformatter
args:
Expand All @@ -77,26 +77,18 @@ repos:
- --wrap-descriptions
- '88'
- --blank
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
exclude: src/estimagic/optimization/algo_options.py
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
# args:
# - --verbose
# - repo: https://github.com/kynan/nbstripout
# rev: 0.6.1
# hooks:
# - id: nbstripout
# args:
# - --extra-keys
# - metadata.kernelspec metadata.language_info.version metadata.vscode
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.6.3
rev: 1.8.5
hooks:
- id: nbqa-black
- id: nbqa-ruff
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
Expand All @@ -107,7 +99,7 @@ repos:
- '88'
files: (README\.md)
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
Expand All @@ -118,7 +110,7 @@ repos:
- '88'
files: (docs/.)
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.2.0
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/mgedmin/check-manifest
Expand Down
30 changes: 30 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ This is a record of all past estimagic releases and what went into them in rever
chronological order. We follow [semantic versioning](https://semver.org/) and all
releases are available on [Anaconda.org](https://anaconda.org/OpenSourceEconomics/estimagic).

Following the [scientific python guidelines](https://scientific-python.org/specs/spec-0000/)
we drop the official support for Python 3.8.


## 0.4.6

This release drastically improves the optimizer benchmarking capabilities, especially
with noisy functions and parallel optimizers. It makes tranquilo and numba optional
dependencies and is the first version of estimagic to be compatible with Python
3.11.


- {gh}`464` Makes tranquilo and numba optional dependencies ({ghuser}`janosg`)
- {gh}`461` Updates docstrings for procss_benchmark_results ({ghuser}`segsell`)
- {gh}`460` Fixes several bugs in the processing of benchmark results with noisy
functions ({ghuser}`janosg`)
- {gh}`459` Prepares benchmarking functionality for parallel optimizers
({ghuser}`mpetrosian` and {ghuser}`janosg`)
- {gh}`457` Removes some unused files ({ghuser}`segsell`)
- {gh}`455` Improves a local pre-commit hook ({ghuser}`ChristianZimpelmann`)


## 0.4.5

- {gh}`379` Improves the estimation table ({ghuser}`ChristianZimpelmann`)
- {gh}`445` fixes line endings in local pre-commit hook ({ghuser}`ChristianZimpelmann`)
- {gh}`443`, {gh}`444`, {gh}`445`, {gh}`446`, {gh}`448` and {gh}`449` are a major
refactoring of tranquilo ({ghuser}`timmens` and {ghuser}`janosg`)
- {gh}`441` Adds an aggregated convergence plot for benchmarks ({ghuser}`mpetrosian`)
- {gh}`435` Completes the cartis-roberts benchmark set ({ghuser}`segsell`)

## 0.4.4

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ provides functionality to perform statistical inference on estimated parameters.

- estimagic wraps algorithms from *scipy.optimize*, *nlopt*, *pygmo* and more.
- estimagic implements constraints efficiently via reparametrization, so you can solve
constrained problems with any optimzer that supports bounds.
constrained problems with any optimizer that supports bounds.
- The parameters of an optimization problem can be arbitrary pytrees
- The complete history of parameters and function evaluations can be saved in a database
for maximum reproducibility.
Expand Down
3 changes: 2 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ coverage:
status:
patch:
default:
target: 70%
target: 30%
project:
default:
target: 90%
Expand All @@ -25,3 +25,4 @@ ignore:
- src/estimagic/optimization/subsolvers/_steihaug_toint_fast.py
- src/estimagic/optimization/subsolvers/gqtpar_fast.py
- src/estimagic/optimization/tranquilo/clustering.py
- tests/optimization/test_tao_optimizers.py
5 changes: 2 additions & 3 deletions docs/rtd_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python=3.9
- python=3.10
- pip
- setuptools_scm
- toml
Expand All @@ -16,8 +16,7 @@ dependencies:
- ipython
- ipython_genutils
- myst-nb
- pydata-sphinx-theme<=0.12.0
- numba
- pydata-sphinx-theme
- pybaum
- matplotlib
- seaborn
Expand Down
Loading

0 comments on commit 20562e2

Please sign in to comment.