Skip to content

Make GConfiguration constructor args effective (factory/variation/runno)#12

Merged
maureeungaro merged 2 commits into
gemc:mainfrom
zhaozhiwen:fix/122-gconfiguration-args
Jun 23, 2026
Merged

Make GConfiguration constructor args effective (factory/variation/runno)#12
maureeungaro merged 2 commits into
gemc:mainfrom
zhaozhiwen:fix/122-gconfiguration-args

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

The argparse defaults for --factory/--variation/--run were truthy ("sqlite"/"default"/1), and __init__ resolved each as self.args.X if self.args.X else <ctor_arg>. Because the CLI value was always truthy (its default), the constructor fallback never fired: GConfiguration(exp, sys, factory="ascii", variation="run2", runno=5) silently produced sqlite/default/1 — programmatic configuration was impossible.

Set the argparse defaults to None so "not provided" is detectable, move the effective defaults onto the constructor parameters, and fall back with is not None. This keeps the documented CLI-over-constructor precedence while making constructor arguments actually work.

Validation: constructor args take effect with no CLI flags, bare defaults resolve to sqlite/default/1, and CLI flags still override the constructor (Python 3.12).

Fixes #6

Zhiwen Zhao and others added 2 commits June 13, 2026 00:40
The argparse defaults for --factory/--variation/--run were truthy
("sqlite"/"default"/1), and __init__ resolved each as
`self.args.X if self.args.X else <ctor_arg>`. Because the CLI value was
always truthy (its default), the constructor fallback never fired:
GConfiguration(exp, sys, factory="ascii", variation="run2", runno=5)
silently produced sqlite/default/1 — programmatic configuration was
impossible.

Set the argparse defaults to None so "not provided" is detectable, move
the effective defaults onto the constructor parameters (sqlite/default/1),
and fall back with `is not None`. This keeps the documented CLI-over-
constructor precedence while making constructor arguments actually work.

Verified: constructor args take effect with no CLI flags, bare defaults
resolve to sqlite/default/1, and CLI flags still override the constructor
(Python 3.12).

Fixes gemc#6
@maureeungaro maureeungaro merged commit 63c89f7 into gemc:main Jun 23, 2026
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.

[Medium] GConfiguration ignores constructor args; argparse defaults clobber factory/variation/runno

2 participants