Skip to content

Commit f26c300

Browse files
authored
Merge pull request #1 from K092203/claude/repository-review-mrm33b
2 parents b6b18d7 + 9cd8984 commit f26c300

36 files changed

Lines changed: 186 additions & 934 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Benchmark / real-world result
2+
description: Share results from using TRust-BO on a real problem (good or bad!)
3+
labels: [benchmark]
4+
body:
5+
- type: textarea
6+
id: problem
7+
attributes:
8+
label: Problem description
9+
description: What did you optimize? Dimensions, budget, constraints.
10+
validations:
11+
required: true
12+
- type: textarea
13+
id: results
14+
attributes:
15+
label: Results
16+
description: Best value found, wall-clock time, comparison with other tools if any.
17+
validations:
18+
required: true
19+
- type: input
20+
id: environment
21+
attributes:
22+
label: Environment
23+
placeholder: "Ubuntu 24.04, Python 3.11, laptop CPU (no GPU)"
24+
validations:
25+
required: false
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Bug report
2+
description: Something doesn't work as expected
3+
labels: [bug]
4+
body:
5+
- type: textarea
6+
id: description
7+
attributes:
8+
label: What happened?
9+
description: A clear description of the bug, and what you expected instead.
10+
validations:
11+
required: true
12+
- type: textarea
13+
id: reproduction
14+
attributes:
15+
label: Minimal reproduction
16+
description: The smallest script that reproduces the problem.
17+
render: python
18+
validations:
19+
required: false
20+
- type: input
21+
id: version
22+
attributes:
23+
label: TRust-BO version / commit
24+
placeholder: "0.1.0 / abc1234"
25+
validations:
26+
required: true
27+
- type: input
28+
id: environment
29+
attributes:
30+
label: Environment
31+
description: OS, Python version, Rust version (if building from source).
32+
placeholder: "Ubuntu 24.04, Python 3.11, rustc 1.85"
33+
validations:
34+
required: true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Feature request
2+
description: Suggest an idea or improvement
3+
labels: [enhancement]
4+
body:
5+
- type: textarea
6+
id: problem
7+
attributes:
8+
label: What problem does this solve?
9+
description: Describe the use case — e.g. the optimization problem you're trying to run.
10+
validations:
11+
required: true
12+
- type: textarea
13+
id: solution
14+
attributes:
15+
label: Proposed solution
16+
description: What you'd like to happen. API sketches welcome.
17+
validations:
18+
required: false

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Summary
2+
3+
<!-- What does this PR change, and why? -->
4+
5+
## Checklist
6+
7+
- [ ] Tests added/updated (`pytest` for Python-facing behavior, `cargo test` for Rust internals)
8+
- [ ] `cargo test --release` passes
9+
- [ ] `maturin develop --release && pytest tests/ -q` passes
10+
- [ ] CHANGELOG.md updated (for user-facing changes)

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [main]
66
pull_request:
77
branches: [main]
8+
workflow_dispatch:
89

910
jobs:
1011
test:
@@ -28,11 +29,15 @@ jobs:
2829
- name: Rust tests
2930
run: cargo test --release
3031

32+
# scipy / scikit-learn are required to import trust_bo while the
33+
# deprecated TandemEngine (legacy-tandem extra) is still bundled
3134
- name: Install Python deps
32-
run: pip install maturin numpy pytest
35+
run: pip install pytest scipy scikit-learn
3336

34-
- name: Build extension
35-
run: maturin develop --release
37+
# `maturin develop` requires a virtualenv; `pip install .` builds the
38+
# same wheel via the maturin build backend and works anywhere
39+
- name: Build and install package
40+
run: pip install .
3641

3742
- name: Python tests
3843
run: pytest tests/ -q

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ __pycache__/
99
dist/
1010
.pytest_cache/
1111

12-
# Artifacts
12+
# Build artifacts (built by `maturin develop`)
13+
*.so
14+
*.pyd
15+
16+
# Generated outputs (benchmarks, CFD runs, reports)
17+
*.csv
1318
*.zip
1419
*.log
1520
results/
21+
final_report.txt
22+
task_log.txt

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
All notable changes to this project will be documented in this file.
44
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
55

6-
## [0.1.0] - 2026-06-11
6+
## [Unreleased]
77

88
### Added
99

@@ -19,7 +19,7 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1919
- **CFD-oriented examples**: NACA airfoil and F1 wing optimization pipelines
2020
with a mock CFD solver, drop-in replaceable with real OpenFOAM runs.
2121
- **Save/resume**: `engine.save("study.zip")` / `TRustBOEngine.load(...)`.
22-
- 71 tests passing (Python + Rust), CPU-only.
22+
- 83 tests passing (71 Python + 12 Rust), CPU-only.
2323

2424
### Deprecated
2525

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ PRs are welcome. Start small — a typo fix or a single bug fix is a great first
1515
3. **Add tests**`pytest` for Python-facing behavior, `cargo test` for Rust internals
1616
4. Make sure everything passes:
1717
```bash
18+
pip install maturin numpy pytest scipy scikit-learn
1819
cargo test --release
1920
maturin develop --release
2021
pytest tests/ -q
2122
```
23+
(`scipy` / `scikit-learn` are only needed while the deprecated
24+
`TandemEngine` is still bundled — it will be removed in v0.2.)
2225

2326
## Code style
2427

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
name = "trust-bo"
33
version = "0.1.0"
44
edition = "2021"
5+
description = "Trust Region Bayesian Optimization engine (TuRBO-style) with a CPU-only Rust core, exposed to Python via PyO3"
6+
license = "MIT"
7+
repository = "https://github.com/K092203/TRust-BO"
8+
authors = ["Kotaro Ozawa"]
59

610
[lib]
711
name = "trust_bo"
812
crate-type = ["cdylib"]
913

1014
[dependencies]
11-
pyo3 = { version = "0.22", features = ["extension-module", "abi3-py39"] }
15+
# pyo3/extension-module is enabled by maturin (see [tool.maturin] in
16+
# pyproject.toml), not here — having it on by default breaks `cargo test`
17+
# linking: https://pyo3.rs/latest/faq#i-cant-run-cargo-test
18+
pyo3 = { version = "0.22", features = ["abi3-py39"] }
1219
serde = { version = "1", features = ["derive"] }
1320
serde_json = "1"
1421
rand = { version = "0.8", features = ["std_rng"] }

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
**Bayesian optimization that runs on the hardware you already have.**
44

5+
[![CI](https://github.com/K092203/TRust-BO/actions/workflows/ci.yml/badge.svg)](https://github.com/K092203/TRust-BO/actions/workflows/ci.yml)
56
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6-
[![Tests](https://img.shields.io/badge/tests-83%20passed-brightgreen)]()
77
[![Python](https://img.shields.io/badge/python-%3E%3D3.9-blue)]()
88
[![Rust](https://img.shields.io/badge/built%20with-Rust-orange)]()
99

@@ -38,17 +38,16 @@ No GPU required. No cloud required. Just `pip install` and go.
3838

3939
## Installation
4040

41+
TRust-BO is not on PyPI yet (it's on the roadmap). Build from source — all you need is a [Rust toolchain](https://rustup.rs/) and `pip`:
42+
4143
```bash
42-
pip install trust-bo
44+
git clone https://github.com/K092203/TRust-BO
45+
cd TRust-BO
46+
python -m venv .venv && source .venv/bin/activate
47+
pip install .
4348
```
4449

45-
> **Note:** The package is currently in active development. For the latest version, build from source:
46-
> ```bash
47-
> git clone https://github.com/K092203/TRust-BO
48-
> cd TRust-BO
49-
> pip install maturin
50-
> maturin develop --release
51-
> ```
50+
For development, use [maturin](https://github.com/PyO3/maturin) for fast rebuilds: `pip install maturin && maturin develop --release`.
5251

5352
---
5453

@@ -93,6 +92,18 @@ engine.save("study.zip")
9392
engine = TRustBOEngine.load("study.zip")
9493
```
9594

95+
### Optuna integration
96+
97+
Use TRust-BO as a drop-in [Optuna](https://optuna.org/) sampler:
98+
99+
```python
100+
import optuna
101+
from trust_bo.integrations.optuna import TrustBoOptunaSampler
102+
103+
study = optuna.create_study(sampler=TrustBoOptunaSampler(seed=42))
104+
study.optimize(objective, n_trials=100)
105+
```
106+
96107
---
97108

98109
## Benchmark
@@ -163,7 +174,7 @@ Key design choices:
163174
- [x] Single Trust Region (exploitation-focused)
164175
- [x] MLP Bootstrap Ensemble surrogate with warm start
165176
- [x] Constraint handling (feasibility surrogate)
166-
- [x] 47-test suite, CPU-only, PyO3 Python bindings
177+
- [x] 83-test suite (71 Python + 12 Rust), CPU-only, PyO3 Python bindings
167178
- [x] Benchmark vs BoTorch / HEBO / Random (Setting A/B complete)
168179
- [x] OSS release prep — MIT license, class name unified, known limitations documented
169180
- [x] Native Phase 2 (Rust Tandem Residual-GP): +32% at 50D, +55% at 10D, zero extra deps
@@ -187,6 +198,12 @@ Key design choices:
187198

188199
---
189200

201+
## Development log
202+
203+
The full development history — design decisions, phase-by-phase experiments, and benchmark notes — is kept in [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) (Japanese).
204+
205+
---
206+
190207
## Contributing
191208

192209
Contributions are welcome. This is a one-person project so far, and any help — bug reports, benchmark results on real problems, documentation, or code — is genuinely appreciated.

0 commit comments

Comments
 (0)