Part of #23740.
Describe the bug
_from_argparse passes every field explicitly, including UNSPECIFIED, which skips a
dataclass field's default_factory. default_factory only runs when the argument is
omitted, not when it's passed explicitly, so env var lookup never ran for any field set
through the CLI.
Steps/Code to reproduce bug
import argparse
import os
from cudf_polars.engine.options import StreamingOptions
os.environ["CUDF_POLARS__EXECUTOR__NUM_PY_EXECUTORS"] = "16"
parser = argparse.ArgumentParser()
StreamingOptions._add_cli_args(parser)
args = parser.parse_args([]) # nothing set on the CLI
opts = StreamingOptions._from_argparse(args)
print(opts.num_py_executors) # UNSPECIFIED, should be 16
Expected behavior
opts.num_py_executors == 16, picked up from the env var.
Part of #23740.
Describe the bug
_from_argparsepasses every field explicitly, includingUNSPECIFIED, which skips adataclass field's
default_factory.default_factoryonly runs when the argument isomitted, not when it's passed explicitly, so env var lookup never ran for any field set
through the CLI.
Steps/Code to reproduce bug
Expected behavior
opts.num_py_executors == 16, picked up from the env var.