Skip to content

Commit

Permalink
Merge branch 'main' into bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens authored Dec 29, 2023
2 parents c8c6032 + 5deb5a2 commit 6f19b20
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .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 Down
2 changes: 1 addition & 1 deletion .envs/update_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ 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")

# create docs testing environment

Expand Down
20 changes: 10 additions & 10 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.13.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,17 +52,17 @@ repos:
- id: check-docstring-first
exclude: src/estimagic/optimization/algo_options.py
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
rev: v1.33.0
hooks:
- id: yamllint
exclude: tests/optimization/fixtures
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.11.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/asottile/blacken-docs
rev: 1.15.0
rev: 1.16.0
hooks:
- id: blacken-docs
exclude: docs/source/how_to_guides/optimization/how_to_specify_constraints.md
Expand All @@ -79,16 +79,16 @@ repos:
- --blank
exclude: src/estimagic/optimization/algo_options.py
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.282
rev: v0.1.6
hooks:
- id: ruff
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
rev: 1.7.1
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 @@ -99,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 @@ -110,7 +110,7 @@ repos:
- '88'
files: (docs/.)
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.4.0
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/mgedmin/check-manifest
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
- nodefaults
dependencies:
- python=3.10 # dev
- cyipopt # dev
- cyipopt<=1.2.0 # dev
- jupyterlab # dev, docs
- nb_black # dev, docs
- nlopt # dev, tests
Expand Down
10 changes: 6 additions & 4 deletions src/estimagic/visualization/estimation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,11 +1237,12 @@ def _generate_notes_latex(
amp_n = "&" * n_levels
if isinstance(custom_notes, list):
if not all(isinstance(n, str) for n in custom_notes):
not_str_notes = [n for n in custom_notes if not isinstance(n, str)]
not_str_notes_types = [type(n) for n in not_str_notes]
raise ValueError(
f"""Each custom note can only be of string type.
The following notes:
{[n for n in custom_notes if type(n) != str]} are of types
{[type(n) for n in custom_notes if type(n) != str]}
{not_str_notes} are of types {not_str_notes_types}
respectively."""
)
for n in custom_notes:
Expand Down Expand Up @@ -1297,11 +1298,12 @@ def _generate_notes_html(
if custom_notes:
if isinstance(custom_notes, list):
if not all(isinstance(n, str) for n in custom_notes):
not_str_notes = [n for n in custom_notes if not isinstance(n, str)]
not_str_notes_types = [type(n) for n in not_str_notes]
raise ValueError(
f"""Each custom note can only be of string type.
The following notes:
{[n for n in custom_notes if type(n) != str]} are of types
{[type(n) for n in custom_notes if type(n) != str]}
{not_str_notes} are of types {not_str_notes_types}
respectively."""
)
notes_text += """
Expand Down
3 changes: 2 additions & 1 deletion tests/optimization/test_many_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def test_algorithm_on_sum_of_squares_with_binding_bounds(algorithm):
skip_checks=True,
)
assert res.success in [True, None]
aaae(res.params, np.array([1, 0, -1]), decimal=3)
decimal = 2 if algorithm == "simopt_astrodf" else 3
aaae(res.params, np.array([1, 0, -1]), decimal=decimal)


skip_msg = (
Expand Down
5 changes: 4 additions & 1 deletion tests/optimization/test_pounders_integration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Test suite for the internal pounders interface."""
import sys

from functools import partial
from itertools import product

Expand Down Expand Up @@ -78,7 +80,7 @@ def trustregion_subproblem_options():
return out


start_vec = [np.array([0.15, 0.008, 0.01])]
start_vec = [np.array([0.15, 0.008, 0.01], dtype=np.float64)]
cg_routine = ["cg", "steihaug_toint", "trsbox"]
universal_tests = list(product(start_vec, cg_routine))
specific_tests = [
Expand All @@ -88,6 +90,7 @@ def trustregion_subproblem_options():
TEST_CASES = universal_tests + specific_tests


@pytest.mark.skipif(sys.platform == "win32", reason="Not accurate on Windows.")
@pytest.mark.parametrize("start_vec, conjugate_gradient_method_sub", TEST_CASES)
def test_bntr(
start_vec,
Expand Down

0 comments on commit 6f19b20

Please sign in to comment.