From aba5008f32e0b0c31468f197c9e5d01758393868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Gonz=C3=A1lez=20Duque?= Date: Wed, 6 Nov 2024 12:00:02 +0100 Subject: [PATCH] Installs and runs pre-commit hooks --- environment.yml | 2 +- envs/environment.bounce.yml | 2 +- pyproject.toml | 3 +++ run.py | 20 +++++++++---------- setup.cfg | 2 +- .../bayesian_optimization_in_2d.py | 1 - src/hdbo_benchmark/utils/ax/interface.py | 6 +----- .../visualization/plot_optima_comparison.py | 1 - test_main_entry_point.py | 6 ++---- workflows/website.yml | 4 ++-- 10 files changed, 20 insertions(+), 27 deletions(-) diff --git a/environment.yml b/environment.yml index 6f49da4..7b22402 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: hdbo_benchmark +name: hdbo_benchmark channels: - defaults dependencies: diff --git a/envs/environment.bounce.yml b/envs/environment.bounce.yml index bedfce8..e773028 100644 --- a/envs/environment.bounce.yml +++ b/envs/environment.bounce.yml @@ -1,4 +1,4 @@ -name: hdbo_bounce +name: hdbo_bounce channels: - defaults dependencies: diff --git a/pyproject.toml b/pyproject.toml index cf607ca..f1e8f48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,9 @@ warn_return_any = true warn_unused_configs = true ignore_missing_imports = true +[tool.isort] +profile = "black" + [tool.pytest.ini_options] markers = [ "hdbo_base: base tests for HDBO", diff --git a/run.py b/run.py index 2f1a498..beefdcf 100644 --- a/run.py +++ b/run.py @@ -10,26 +10,24 @@ import click import numpy as np - -from poli.core.util.seeding import seed_python_numpy_and_torch from poli.core.exceptions import BudgetExhaustedException +from poli.core.util.seeding import seed_python_numpy_and_torch -from hdbo_benchmark.utils.experiments.load_solvers import ( - load_solver_from_problem, - SOLVER_NAMES, - CONTINUOUS_SPACE_SOLVERS, -) -from hdbo_benchmark.utils.experiments.load_problems import load_problem from hdbo_benchmark.utils.experiments.load_generative_models import ( load_generative_model_and_bounds, ) -from hdbo_benchmark.utils.experiments.verify_status_pre_experiment import ( - verify_repos_are_clean, +from hdbo_benchmark.utils.experiments.load_problems import load_problem +from hdbo_benchmark.utils.experiments.load_solvers import ( + CONTINUOUS_SPACE_SOLVERS, + SOLVER_NAMES, + load_solver_from_problem, ) from hdbo_benchmark.utils.experiments.problem_transformations import ( transform_problem_from_discrete_to_continuous, ) - +from hdbo_benchmark.utils.experiments.verify_status_pre_experiment import ( + verify_repos_are_clean, +) from hdbo_benchmark.utils.logging.idempotence_of_experiments import ( experiment_has_already_run, ) diff --git a/setup.cfg b/setup.cfg index e3416e3..8ec68f1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,4 +21,4 @@ include_package_data = True where=src [options.package_data] -* = *.sht, *.yml, *.jar, *.pt, *.json, *.pdb, *.npz +* = *.sht, *.yml, *.jar, *.pt, *.json, *.pdb, *.npz diff --git a/src/hdbo_benchmark/sanity_checks/bayesian_optimization_in_2d.py b/src/hdbo_benchmark/sanity_checks/bayesian_optimization_in_2d.py index da18f5d..baf3625 100644 --- a/src/hdbo_benchmark/sanity_checks/bayesian_optimization_in_2d.py +++ b/src/hdbo_benchmark/sanity_checks/bayesian_optimization_in_2d.py @@ -5,7 +5,6 @@ import warnings - import matplotlib.pyplot as plt import numpy as np from poli import objective_factory # type: ignore diff --git a/src/hdbo_benchmark/utils/ax/interface.py b/src/hdbo_benchmark/utils/ax/interface.py index 452b41d..41136ee 100644 --- a/src/hdbo_benchmark/utils/ax/interface.py +++ b/src/hdbo_benchmark/utils/ax/interface.py @@ -1,9 +1,5 @@ import numpy as np -from ax import ( # type: ignore[import] - ParameterType, - RangeParameter, - SearchSpace, -) +from ax import ParameterType, RangeParameter, SearchSpace # type: ignore[import] from ax.core.generator_run import GeneratorRun # type: ignore[import] from ax.core.metric import Metric # type: ignore[import] from ax.metrics.noisy_function import NoisyFunctionMetric # type: ignore[import] diff --git a/src/hdbo_benchmark/utils/visualization/plot_optima_comparison.py b/src/hdbo_benchmark/utils/visualization/plot_optima_comparison.py index 6a7f070..a841bad 100644 --- a/src/hdbo_benchmark/utils/visualization/plot_optima_comparison.py +++ b/src/hdbo_benchmark/utils/visualization/plot_optima_comparison.py @@ -2,7 +2,6 @@ import pandas as pd import seaborn as sns # type: ignore[import] - from hdbo_benchmark.utils.data.experiments import load_results_as_dataframe from .colors import COLORS diff --git a/test_main_entry_point.py b/test_main_entry_point.py index 071abb6..df8880a 100644 --- a/test_main_entry_point.py +++ b/test_main_entry_point.py @@ -1,15 +1,13 @@ import os import pytest - -from run import _main - from poli.benchmarks import PMOBenchmark from hdbo_benchmark.utils.experiments.load_solvers import ( - SOLVER_NAMES, SOLVER_NAME_TO_ENV, + SOLVER_NAMES, ) +from run import _main SOLVERS_THAT_RUN_IN_BASE_ENV = [ solver_name diff --git a/workflows/website.yml b/workflows/website.yml index d044313..53a0dbc 100644 --- a/workflows/website.yml +++ b/workflows/website.yml @@ -36,7 +36,7 @@ jobs: - name: Install Hugo CLI run: | wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ - && sudo dpkg -i ${{ runner.temp }}/hugo.deb + && sudo dpkg -i ${{ runner.temp }}/hugo.deb - name: Install Dart Sass run: sudo snap install dart-sass - name: Checkout @@ -59,7 +59,7 @@ jobs: hugo \ --gc \ --minify \ - --baseURL "${{ steps.pages.outputs.base_url }}/" + --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: