Add ini configuration parsing#560
Merged
Merged
Conversation
- highlight_pin1 is a string choice, not a bool; migrate legacy 0/1 values same as load_from_ini - blacklist_empty_val is a bool in the ini file - board_rotation is stored as int in 5-degree units; convert the CLI fallback value the same way set_from_args does - read offset_back_rotation and mark_when_checked, which are written to the ini file but were not read back - exit with ERROR_FILE_NOT_FOUND instead of 0 when no ini file exists Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Explicitly-provided command line options now take precedence over values loaded from the ini file.
Replace the repeated per-option ini lookups with a single declarative table of (section, key, attribute, kind, cli_dest) tuples processed by a common loop. Behaviour is unchanged; special cases (highlight_pin1 migration and show_fields/group_fields with --extra-fields) are kept explicit.
qu1ck
reviewed
Jul 9, 2026
| # from their argparse default). Used so that CLI options take precedence | ||
| # over values loaded from the ini file. | ||
| cli_provided = frozenset( | ||
| k for k in vars(args) if getattr(args, k) != parser.get_default(k)) |
Member
There was a problem hiding this comment.
How would you override non-default value in ini with default in cli arg?
Contributor
Author
There was a problem hiding this comment.
So, this definitely is a problem. I ended up changing to a "ini file becomes argparse defaults" style configuration which eliminates this problem. (see 125ac03)
The parse now works like this
parse_known_args()checks the pcb file and--use-ini- If requested,
config.get_ini_defaults()installs the ini file as parser defaults - Parse args runs with the defaults (ini or otherwise) and reduces
config.set_from_args().
Member
|
Thanks for your contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for loading configuration options from an ini file via a new
--use-inicommand-line argument.New ini-based configuration loading:
use_iniattribute to theConfigclass and a corresponding--use-inicommand-line argument to enable reading options from an ini file. [1] [2]set_from_args_with_inimethod inConfigto load configuration values from either a local or global ini file, with fallback to command-line arguments when options are missing.generate_interactive_bom.py) to callset_from_args_with_iniwhen--use-iniis specified.Supersedes #432
Maybe handles #368