Skip to content

--help output embeds randomly generated default, making docs non-reproducible #2942

@paravoid

Description

@paravoid

Issue

The tox legacy --help output changes on every invocation because of the --hashseed default:

parser.add_argument(
    "--hashseed",
    metavar="SEED",
    help="set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range "
    "[1, 4294967295] ([1, 1024] on Windows). Passing 'noset' suppresses this behavior.",    
    action=SeedAction,
    of_type=Optional[int],
    default=random.randint(1, 1024 if sys.platform == "win32" else 4294967295),
    dest="hash_seed",
)

Besides the lack of usefulness (or lie, depending on your viewpoint ;) on what the default for this parameter is, the real-world impact of this is that this gets included in the generated Sphinx documentation (by the way of argparse-cli), which makes the build non-reproducible: multiple runs of documentation building generate slightly different output.

Environment

This is with tox 4.4.6, but I've verified the same applies to current master. This is on a Debian sid system, with (my) Debian packages of tox, but I don't think that makes a difference here.

Minimal example

$ tox legacy --help | sed -nr 's/(.+--hashseed SEED).+\. (.+)/\1 ... \2/p'
  --hashseed SEED ... (default: 499015295)
$ tox legacy --help | sed -nr 's/(.+--hashseed SEED).+\. (.+)/\1 ... \2/p'
  --hashseed SEED ... (default: 1099173378)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help:wantedIssues that have been acknowledged, a solution determined and a PR might likely be accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions