Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add suggestions to the TOML error message #1205

Merged
merged 2 commits into from Aug 2, 2022

Conversation

henryiii
Copy link
Contributor

@henryiii henryiii commented Aug 1, 2022

Touches up the config errors, including Python 3.10 style suggestions if a name is close to an existing name. This includes - and _ confusion.

Closes #761.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii
Copy link
Contributor Author

henryiii commented Aug 1, 2022

Example:

Traceback (most recent call last):
  File "/Users/henryschreiner/git/software/cibuildwheel/.venv/bin/cibuildwheel", line 33, in <module>
    sys.exit(load_entry_point('cibuildwheel', 'console_scripts', 'cibuildwheel')())
  File "/Users/henryschreiner/git/software/cibuildwheel/cibuildwheel/__main__.py", line 129, in main
    build_in_directory(args)
  File "/Users/henryschreiner/git/software/cibuildwheel/cibuildwheel/__main__.py", line 189, in build_in_directory
    options = compute_options(platform=platform, command_line_arguments=args)
  File "/Users/henryschreiner/git/software/cibuildwheel/cibuildwheel/options.py", line 592, in compute_options
    options = Options(platform=platform, command_line_arguments=command_line_arguments)
  File "/Users/henryschreiner/git/software/cibuildwheel/cibuildwheel/options.py", line 345, in __init__
    self.reader = OptionsReader(
  File "/Users/henryschreiner/git/software/cibuildwheel/cibuildwheel/options.py", line 192, in __init__
    self._validate_global_option(option_name)
  File "/Users/henryschreiner/git/software/cibuildwheel/cibuildwheel/options.py", line 232, in _validate_global_option
    raise ConfigOptionError(msg)
cibuildwheel.options.ConfigOptionError: "Option 'test_command' not supported in a config file. Perhaps you meant 'test-command'?"

Technically, known mistakes in a command line app should only print messages, not tracebacks. But this is a step in the right direction.

cibuildwheel/options.py Outdated Show resolved Hide resolved
Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com>
Copy link
Contributor

@joerick joerick left a comment

Choose a reason for hiding this comment

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

Brilliant, thanks @henryiii !

@henryiii henryiii merged commit c234ff5 into pypa:main Aug 2, 2022
@henryiii henryiii deleted the henryiii/fix/suggestions branch August 2, 2022 18:43
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.

Consider auto-correcting underscores to dashes in TOML options
3 participants