Skip to content

(python-codegen): Allow dashes in the package name - #968

Merged
arandito merged 2 commits into
developfrom
python-codegen-project-name
Nov 20, 2026
Merged

arandito merged 2 commits into
developfrom
python-codegen-project-name

Conversation

@arandito

@arandito arandito commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR lets the Python generator accept dashes in --package.

  • The pyproject.toml name uses the package name as given (my-client).
  • Imports, the src/ directory, and the wheel packages entry use the new ArtifactSettings.import_name property. It normalizes the name to underscores (my_client).

Dashed names are the normalized form defined by the PyPA name normalization spec.

Currently, our sdk packages are forced to publish with underscores: (aws_sdk_s3, aws_sdk_ec2, etc). This change allows us to migrate to dashes and allows generic users to choose the naming scheme for their own packages.

Follow-up: When migrating to python codegen, we should change our projections to use dashes. This won't break existing releases since PyPI accepts both.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@arandito
arandito marked this pull request as ready for review November 19, 2026 21:02
@arandito
arandito requested a review from a team as a code owner November 19, 2026 21:02
readme = "README.md"
requires-python = ">=3.12"
keywords = ["smithy", {_toml_string(settings.package)}]
keywords = ["smithy", {_toml_string(settings.import_name)}]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should keywords use settings.package instead? People search PyPI by the distribution name, so my-client seems more useful there than my_client.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep good callout. Updated in 0d38908.

@arandito
arandito merged commit 1fd3a6f into develop Nov 20, 2026
26 of 27 checks passed
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