Skip to content

refactoring of SetConfig#91

Merged
yomichi merged 4 commits intodevelopfrom
config
Mar 16, 2026
Merged

refactoring of SetConfig#91
yomichi merged 4 commits intodevelopfrom
config

Conversation

@yomichi
Copy link
Copy Markdown
Contributor

@yomichi yomichi commented Mar 13, 2026

  • do refactoring SetConfig
  • add documents

yomichi added 2 commits March 13, 2026 14:07
- Harden load(): raise FileNotFoundError when file missing, ValueError for
  missing sections or unknown learning method
- Replace SafeConfigParser with ConfigParser, use has_section/get instead of _sections
- Extend boolean() to accept true/false, 1/0, yes/no, on/off (case-insensitive)
- Unify defaults: Online max_epoch 500, Adam gamma 0.999 (init and load)
- Add optional config arg to Search, Learning, Batch, Online, Adam constructors;
  SetConfig.load() builds via Search(config) and Adam(config)/Batch(config)
- Update example to use SetConfig() instead of deprecated set_config()
- Add unit tests for load() success/failure and boolean(); update docs

Made-with: Cursor
- Added `setconfig.rst` documentation in both English and Japanese, detailing the usage and configurable parameters for `physbo.SetConfig`.
- Updated the index files to include links to the new `setconfig` documentation in both language sections.
@yomichi yomichi marked this pull request as draft March 13, 2026 08:24
@yomichi yomichi requested a review from Copilot March 13, 2026 08:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors PHYSBO’s SetConfig configuration loading to use configparser.ConfigParser, add stricter validation/error handling, and introduces new Sphinx documentation plus unit tests around config parsing.

Changes:

  • Refactor SetConfig/Search/Learning classes to support initialization from a ConfigParser and improve error handling for missing files/sections and unknown learning methods.
  • Add unit tests covering config file loading and boolean parsing behavior.
  • Add English/Japanese Sphinx docs for SetConfig and update docs build script to support selecting languages.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/unit/test_misc.py Adds unit tests for SetConfig.load() scenarios and boolean() parsing.
src/physbo/misc/_set_config.py Refactors config parsing, adds required-section checks, improves boolean parsing, and adds config_file init option.
examples/gaussian_process/simple.py Updates example to instantiate SetConfig directly.
docs/sphinx/manual/ja/source/setconfig.rst Adds Japanese SetConfig documentation page.
docs/sphinx/manual/ja/source/index.rst Adds the new SetConfig page to the manual toctree.
docs/sphinx/manual/en/source/setconfig.rst Adds English SetConfig documentation page.
docs/sphinx/manual/en/source/index.rst Adds the new SetConfig page to the manual toctree.
docs/make_docs.sh Allows selecting which languages to build and validates language args.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…gle defaults

- Rename sections [online], [adam], [batch] to [learning.online], [learning.adam],
  [learning.batch]; support old names with DeprecationWarning
- Make all sections optional: skip missing sections and use defaults
- Use instance attributes as get() defaults in load() so defaults are defined
  only in __init__; set subclass attributes before super().__init__ so load()
  sees them when called from parent

Made-with: Cursor
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors physbo.misc.SetConfig configuration loading to use configparser.ConfigParser, support hierarchical INI sections ([learning.*]), and adds tests + Sphinx documentation describing configuration options.

Changes:

  • Refactor SetConfig/Search/Learning config parsing, including deprecated fallback for legacy section names with DeprecationWarning.
  • Add unit tests covering config loading paths (adam/batch, defaults, deprecated sections, missing file) and a stricter boolean parser.
  • Add EN/JA Sphinx docs page for SetConfig, link it from the manual index, update an example, and enhance the docs build script to accept language args.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/test_misc.py Adds unit tests for SetConfig loading behavior and boolean parsing.
src/physbo/misc/_set_config.py Implements the SetConfig refactor: hierarchical sections, defaults, deprecation warnings, improved boolean parsing.
examples/gaussian_process/simple.py Updates example to instantiate physbo.misc.SetConfig() instead of deprecated helper.
docs/sphinx/manual/ja/source/setconfig.rst Adds Japanese SetConfig documentation (usage + INI parameters).
docs/sphinx/manual/ja/source/index.rst Links the new setconfig page from the JA manual index.
docs/sphinx/manual/en/source/setconfig.rst Adds English SetConfig documentation (usage + INI parameters).
docs/sphinx/manual/en/source/index.rst Links the new setconfig page from the EN manual index.
docs/make_docs.sh Allows building docs for a subset of languages and validates lang args.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yomichi yomichi marked this pull request as ready for review March 16, 2026 07:47
@yomichi yomichi merged commit 489f04b into develop Mar 16, 2026
32 checks passed
@yomichi yomichi deleted the config branch April 8, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants