Skip to content

fix: normalize project names from PEP 621 metadata - #3034

Open
Solaris-star wants to merge 7 commits into
beeware:mainfrom
Solaris-star:fix-project-name-normalization
Open

Solaris-star wants to merge 7 commits into
beeware:mainfrom
Solaris-star:fix-project-name-normalization

Conversation

@Solaris-star

@Solaris-star Solaris-star commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Normalize PEP 621 project.name values before merging them into Briefcase configuration so generated application identifiers remain valid. Legacy Briefcase configuration using an invalid project name now emits a FutureWarning, preserving compatibility while announcing the future validation behavior.

The change includes focused regression tests and a Towncrier change note.

Fixes #3011

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

Assisted-by: Hermes Agent

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As noted on previous PRs you've submitted - there's no need to include a "testing" regimen in the PR description. The required testing regimen is "it passes CI" - which, at time of review, this PR does not.

The contribution guide for details on how to set up a testing environment locally and validate that a PR will pass CI before pushing the PR for review.

@freakboy3742 freakboy3742 added the basic checks failing Pull request does not pass basic quality checks label Sep 3, 2026
@Solaris-star
Solaris-star force-pushed the fix-project-name-normalization branch from 215de29 to d4ad413 Compare September 7, 2026 07:13
Signed-off-by: Solaris-star <820622658@qq.com>
@freakboy3742

Copy link
Copy Markdown
Member
  1. Please don't force push. We don't care about having a "clean" commit history, because we use merge commits when a PR is accepted.
  2. Please configure your local development environment as described in the contribution guide, and run tests locally before pushing updates. The CI failures that are currently being shown are all locally reproducible if you follow the contribution guide.

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is here looks good; one note about the testing in test_parse_config.py.

The one missing detail: The issue description on #3011 mentions an additional problem with the project wizard, which this doesn't seem to address.

Comment thread tests/config/test_parse_config.py Outdated
platform="macOS",
output_format="app",
console=Mock(),
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a basic merge test; it should pass "clean". There is likely a need for an entirely new test verifying the "merge raises warning"; unless the test is actually verifying the merge process, the test data should be modified so that no warnings are raised.

@glasnt glasnt removed the basic checks failing Pull request does not pass basic quality checks label Sep 17, 2026

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's not clear to me that you've addressed either of the comments from my previous review. There are still warning assertions in "clean path" tests; there's no new test for the explicit warning case, and there's no handling of the covert project wizard.

Comment thread src/briefcase/config.py Outdated
stacklevel=2,
)
elif project_name := pep621_config.get("name"):
global_config["project_name"] = canonicalize_name(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This raises an InvalidName exception, but not a clean error. We should catch the InvalidName and re-throw as a BriefcaseConfigException with a clean error message.

@Solaris-star

Copy link
Copy Markdown
Contributor Author

Addressed the latest review feedback in commit 98d6102375ea3bc3e6bc8d4a28793cd2c22c0825:

  • Invalid PEP 621 names now raise a clean BriefcaseConfigError.
  • The new-project wizard now defaults Project Name to the validated app name and validates overrides with the app-name rules.
  • Updated regression expectations and the towncrier note.

Local validation:

  • PYTHONPATH=src python -m pytest tests/config tests/commands/new — 562 passed
  • ruff check and ruff format --check on the changed Python files — passed
  • git diff --check — passed

The new head was pushed without force-pushing; repository CI is currently queued/pending.

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.

Normalize usage of project_name

3 participants