Skip to content

Commit 16c00f3

Browse files
authored
Feat apply ruff (#497)
* chore: add ruff * chore: init ruff config * chore: update ruff pydocstyle config * chore: update ruff rules * chore: update ruff exclude * fix: init format & check(fix) * fix: constraint * fix: domain_reduction(without E501) * fix: update ruff rule(TRY -> TRY002) * fix: target_space(without E501) * fix: init tests * fix: test_notebooks_run.py * fix: test_observer * fix: test_seq_domain_red * fix: test_target_space * fix: E501 * chore: add pre-commit * chore: update ruff * chore: add precommit config * feat: add format & lint action * test * fix: 3.10 -> 3.9(minimum) * chore: update ruff config * chore: update ruff config * revert check docstring(not yet D rule) * chore: revert pydocstyle * fix: add coverage exclude_lines * SIM * S * DTZ * EM * LOG * G * PIE * Q * RET * TID * PTH * F * NPY * PERF * FURB * RUF * D * chore: rm pydocstyle action * chore: rm pydocstyle * fix: render path only once * ISC * fix: pr447 * init * fix: acquisition * fix: bayesian_optimization * fix: util * fix: acquisition * fix: test_bayesian_optimization * fix: test_constraint * fix: test_util * fix: _update_params * feat: scripts * fix: reviews * test: upper_confidence_bound_invalid_kappa_error * chore: update ruff * fix: acquisition * fix: util * fix: relative -> absolute * fix: import error * fix: review * fix: review * fix: rm unused func --------- Co-authored-by: phi-friday <[email protected]>
1 parent bc9af23 commit 16c00f3

27 files changed

+990
-884
lines changed

.github/workflows/check_docstrings.yml

-31
This file was deleted.

.github/workflows/format_and_lint.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Code format and lint
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python 3.9
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: "3.9"
20+
- name: Install Poetry
21+
uses: snok/install-poetry@v1
22+
- name: Install dependencies
23+
run: |
24+
poetry install --with dev
25+
- name: Run pre-commit
26+
run : poetry run pre-commit run --all-files --show-diff-on-failure --color=always

.pre-commit-config.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- hooks:
3+
- id: ruff
4+
name: ruff-lint
5+
repo: https://github.com/astral-sh/ruff-pre-commit
6+
rev: v0.5.2
7+
8+
- hooks:
9+
- id: ruff-format
10+
name: ruff-format
11+
args: [--check]
12+
repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.5.2

bayes_opt/__init__.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
"""Pure Python implementation of bayesian global optimization with gaussian processes."""
2-
from .bayesian_optimization import BayesianOptimization, Events
3-
from .domain_reduction import SequentialDomainReductionTransformer
4-
from .logger import ScreenLogger, JSONLogger
5-
from .constraint import ConstraintModel
6-
from . import acquisition
2+
3+
from __future__ import annotations
74

85
import importlib.metadata
9-
__version__ = importlib.metadata.version('bayesian-optimization')
106

7+
from bayes_opt import acquisition
8+
from bayes_opt.bayesian_optimization import BayesianOptimization, Events
9+
from bayes_opt.constraint import ConstraintModel
10+
from bayes_opt.domain_reduction import SequentialDomainReductionTransformer
11+
from bayes_opt.logger import JSONLogger, ScreenLogger
12+
13+
__version__ = importlib.metadata.version("bayesian-optimization")
1114

1215

1316
__all__ = [
@@ -19,4 +22,3 @@
1922
"JSONLogger",
2023
"SequentialDomainReductionTransformer",
2124
]
22-

0 commit comments

Comments
 (0)