Skip to content

StreamingOptions._from_argparse silently drops env vars #23741

Description

@Matt711

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions