Skip to content

Use Click to parse command-line arguments in randomstart.py#12

Open
nataliemes wants to merge 3 commits into
gambitproject:mainfrom
nataliemes:refactor/click-cli-randomstart
Open

Use Click to parse command-line arguments in randomstart.py#12
nataliemes wants to merge 3 commits into
gambitproject:mainfrom
nataliemes:refactor/click-cli-randomstart

Conversation

@nataliemes
Copy link
Copy Markdown
Collaborator

This PR replaces manual command-line argument parsing with Click in randomstart.py.

Changes in detail

  • Added randomstart as a console script entry point, so it can be called directly from the terminal after installing the package (instead of calling python randomstart.py).
  • Arguments are now named flags, so order no longer matters.
    For example, both randomstart --numpoints 500 --accuracy 10 and randomstart --accuracy 10 --numpoints 500 are valid and mean the same thing.
  • An automatic error is shown if higherdim is outside the range [3, 10], instead of silently defaulting to 3.

@nataliemes nataliemes requested review from rahulsavani and stengel June 4, 2026 13:25
@stengel
Copy link
Copy Markdown
Member

stengel commented Jun 4, 2026

Looks very nice.
One more request: Please check that accuracy is an integer between 1 and MAXACCURACY
where I would set MAXACCURACY to 10 million at the top of the file, 10000000.

@stengel stengel closed this Jun 4, 2026
@stengel stengel reopened this Jun 4, 2026
Comment thread src/lemke/randomstart.py
"--higherdim",
default=3,
show_default=True,
help="Number of components in the probability vector being sampled",
Copy link
Copy Markdown
Member

@stengel stengel Jun 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change lines 90-91 to:
help="dimension [in 3..10] from which the middle 3 components will be sampled",
type=click.IntRange(3, 10),
metavar="INTEGER",

Copy link
Copy Markdown
Member

@stengel stengel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the most recent file -
line 84 does not show MAX_ACCURACY and should have the following small amendments - see my email

help=f"Denominator N [in 1..{MAX_ACCURACY}]: each coordinate is rounded to the nearest multiple of 1/N",
type=click.IntRange(1, MAX_ACCURACY),
metavar="INTEGER",

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.

2 participants