Skip to content

Allow and prefer '-' over '_' in configuration setting names - #3145

Open
abdul-karim-mia wants to merge 4 commits into
beeware:mainfrom
abdul-karim-mia:config/prefer-hyphen-configuration-names
Open

abdul-karim-mia wants to merge 4 commits into
beeware:mainfrom
abdul-karim-mia:config/prefer-hyphen-configuration-names

Conversation

@abdul-karim-mia

Copy link
Copy Markdown

Resolves #3132

Description

Briefcase previously documented multi-word configuration settings using underscores (e.g., test_requires, cleanup_paths, formal_name), while PEP 621 metadata standardizes on hyphens (requires-python, optional-dependencies). This inconsistency required remembering which convention each setting used.

This PR updates configuration parsing to prefer hyphens for multi-word setting names:

  • Hyphenated setting names (e.g. test-requires, cleanup-paths, formal-name) are normalized to internal underscore attribute representation (test_requires, etc.) when reading configuration sections.
  • Legacy underscore setting names continue to be accepted for backwards compatibility, but display a deprecation warning (console.warning).
  • If a section specifies both hyphen and underscore forms of the same setting (e.g., both test-requires and test_requires), a BriefcaseConfigError is raised.
  • PEP 621 settings (such as requires-python / requires_python) use the same normalization mechanism.
  • Added comprehensive unit tests in test_merge_config.py, test_merge_pep621_config.py, and test_parse_config.py.
  • Added documentation note in docs/en/reference/configuration.md and a towncrier newsfragment changes/3132.feature.md.

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Update Briefcase configuration parsing to prefer hyphen-separated setting names (e.g. test-requires, cleanup-paths, formal-name) matching PEP 621 conventions.

- Normalize hyphenated keys to internal underscore attribute representation when merging configurations
- Accept legacy underscore setting names with a deprecation warning
- Raise BriefcaseConfigError if both hyphen and underscore forms of a setting are specified in the same section
- Support hyphenated and underscore forms seamlessly in PEP 621 metadata (e.g. requires-python / requires_python)
- Add comprehensive unit tests and towncrier newsfragment

Closes beeware#3132

Signed-off-by: Abdul karim mia <97598943+abdul-karim-mia@users.noreply.github.com>
Signed-off-by: Abdul karim mia <97598943+abdul-karim-mia@users.noreply.github.com>
…used prefix check

Signed-off-by: Abdul karim mia <97598943+abdul-karim-mia@users.noreply.github.com>
… project-name

Signed-off-by: Abdul karim mia <97598943+abdul-karim-mia@users.noreply.github.com>
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.

Allow/prefer - instead of _ in configuration names

1 participant