diff --git a/clients/aws-sdk-acm/pyproject.toml b/clients/aws-sdk-acm/pyproject.toml index ae59890c..f41f24e2 100644 --- a/clients/aws-sdk-acm/pyproject.toml +++ b/clients/aws-sdk-acm/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_acm" +name = "aws-sdk-acm" version = "0.13.0" description = "Python client for AWS Certificate Manager" readme = "README.md" diff --git a/clients/aws-sdk-api-gateway/pyproject.toml b/clients/aws-sdk-api-gateway/pyproject.toml index c2da4c14..667bb206 100644 --- a/clients/aws-sdk-api-gateway/pyproject.toml +++ b/clients/aws-sdk-api-gateway/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_api_gateway" +name = "aws-sdk-api-gateway" version = "0.13.0" description = "Python client for Amazon API Gateway" readme = "README.md" diff --git a/clients/aws-sdk-appconfigdata/pyproject.toml b/clients/aws-sdk-appconfigdata/pyproject.toml index 0a456545..7339c853 100644 --- a/clients/aws-sdk-appconfigdata/pyproject.toml +++ b/clients/aws-sdk-appconfigdata/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_appconfigdata" +name = "aws-sdk-appconfigdata" version = "0.13.0" description = "Python client for AWS AppConfig Data" readme = "README.md" diff --git a/clients/aws-sdk-bedrock-agent-runtime/pyproject.toml b/clients/aws-sdk-bedrock-agent-runtime/pyproject.toml index e294f8b5..cc0e9759 100644 --- a/clients/aws-sdk-bedrock-agent-runtime/pyproject.toml +++ b/clients/aws-sdk-bedrock-agent-runtime/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_bedrock_agent_runtime" +name = "aws-sdk-bedrock-agent-runtime" version = "0.13.0" description = "Python client for Agents for Amazon Bedrock Runtime" readme = "README.md" diff --git a/clients/aws-sdk-bedrock-agent/pyproject.toml b/clients/aws-sdk-bedrock-agent/pyproject.toml index 34778d28..1dcf3a10 100644 --- a/clients/aws-sdk-bedrock-agent/pyproject.toml +++ b/clients/aws-sdk-bedrock-agent/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_bedrock_agent" +name = "aws-sdk-bedrock-agent" version = "0.13.0" description = "Python client for Agents for Amazon Bedrock" readme = "README.md" diff --git a/clients/aws-sdk-bedrock-agentcore-control/pyproject.toml b/clients/aws-sdk-bedrock-agentcore-control/pyproject.toml index 34dd645a..d514d122 100644 --- a/clients/aws-sdk-bedrock-agentcore-control/pyproject.toml +++ b/clients/aws-sdk-bedrock-agentcore-control/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_bedrock_agentcore_control" +name = "aws-sdk-bedrock-agentcore-control" version = "0.13.0" description = "Python client for Amazon Bedrock AgentCore Control" readme = "README.md" diff --git a/clients/aws-sdk-bedrock-agentcore/pyproject.toml b/clients/aws-sdk-bedrock-agentcore/pyproject.toml index 5003e180..bacf6c3b 100644 --- a/clients/aws-sdk-bedrock-agentcore/pyproject.toml +++ b/clients/aws-sdk-bedrock-agentcore/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_bedrock_agentcore" +name = "aws-sdk-bedrock-agentcore" version = "0.13.0" description = "Python client for Amazon Bedrock AgentCore" readme = "README.md" diff --git a/clients/aws-sdk-bedrock-data-automation-runtime/pyproject.toml b/clients/aws-sdk-bedrock-data-automation-runtime/pyproject.toml index 6d0877f0..5d9db0db 100644 --- a/clients/aws-sdk-bedrock-data-automation-runtime/pyproject.toml +++ b/clients/aws-sdk-bedrock-data-automation-runtime/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_bedrock_data_automation_runtime" +name = "aws-sdk-bedrock-data-automation-runtime" version = "0.13.0" description = "Python client for Runtime for Amazon Bedrock Data Automation" readme = "README.md" diff --git a/clients/aws-sdk-bedrock-data-automation/pyproject.toml b/clients/aws-sdk-bedrock-data-automation/pyproject.toml index 395957c7..5fa590c1 100644 --- a/clients/aws-sdk-bedrock-data-automation/pyproject.toml +++ b/clients/aws-sdk-bedrock-data-automation/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_bedrock_data_automation" +name = "aws-sdk-bedrock-data-automation" version = "0.13.0" description = "Python client for Data Automation for Amazon Bedrock" readme = "README.md" diff --git a/clients/aws-sdk-bedrock-runtime/pyproject.toml b/clients/aws-sdk-bedrock-runtime/pyproject.toml index 009e4d98..231a3ced 100644 --- a/clients/aws-sdk-bedrock-runtime/pyproject.toml +++ b/clients/aws-sdk-bedrock-runtime/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_bedrock_runtime" +name = "aws-sdk-bedrock-runtime" version = "0.13.0" description = "Python client for Amazon Bedrock Runtime" readme = "README.md" diff --git a/clients/aws-sdk-bedrock/pyproject.toml b/clients/aws-sdk-bedrock/pyproject.toml index bf1a50cd..88069c49 100644 --- a/clients/aws-sdk-bedrock/pyproject.toml +++ b/clients/aws-sdk-bedrock/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_bedrock" +name = "aws-sdk-bedrock" version = "0.13.0" description = "Python client for Amazon Bedrock" readme = "README.md" diff --git a/clients/aws-sdk-cloudformation/pyproject.toml b/clients/aws-sdk-cloudformation/pyproject.toml index 5bebfed3..bf4c7e9e 100644 --- a/clients/aws-sdk-cloudformation/pyproject.toml +++ b/clients/aws-sdk-cloudformation/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_cloudformation" +name = "aws-sdk-cloudformation" version = "0.13.0" description = "Python client for AWS CloudFormation" readme = "README.md" diff --git a/clients/aws-sdk-cloudfront-keyvaluestore/pyproject.toml b/clients/aws-sdk-cloudfront-keyvaluestore/pyproject.toml index f5ef905f..26139f35 100644 --- a/clients/aws-sdk-cloudfront-keyvaluestore/pyproject.toml +++ b/clients/aws-sdk-cloudfront-keyvaluestore/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_cloudfront_keyvaluestore" +name = "aws-sdk-cloudfront-keyvaluestore" version = "0.13.0" description = "Python client for Amazon CloudFront KeyValueStore" readme = "README.md" diff --git a/clients/aws-sdk-cloudfront/pyproject.toml b/clients/aws-sdk-cloudfront/pyproject.toml index ed1baffe..b12ccab2 100644 --- a/clients/aws-sdk-cloudfront/pyproject.toml +++ b/clients/aws-sdk-cloudfront/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_cloudfront" +name = "aws-sdk-cloudfront" version = "0.13.0" description = "Python client for Amazon CloudFront" readme = "README.md" diff --git a/clients/aws-sdk-cloudtrail/pyproject.toml b/clients/aws-sdk-cloudtrail/pyproject.toml index 135aab41..c49a710b 100644 --- a/clients/aws-sdk-cloudtrail/pyproject.toml +++ b/clients/aws-sdk-cloudtrail/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_cloudtrail" +name = "aws-sdk-cloudtrail" version = "0.13.0" description = "Python client for AWS CloudTrail" readme = "README.md" diff --git a/clients/aws-sdk-cognito-identity/pyproject.toml b/clients/aws-sdk-cognito-identity/pyproject.toml index cf5a79a9..86d9d62e 100644 --- a/clients/aws-sdk-cognito-identity/pyproject.toml +++ b/clients/aws-sdk-cognito-identity/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_cognito_identity" +name = "aws-sdk-cognito-identity" version = "0.13.0" description = "Python client for Amazon Cognito Identity" readme = "README.md" diff --git a/clients/aws-sdk-connecthealth/pyproject.toml b/clients/aws-sdk-connecthealth/pyproject.toml index 5b124ea4..6e2e5183 100644 --- a/clients/aws-sdk-connecthealth/pyproject.toml +++ b/clients/aws-sdk-connecthealth/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_connecthealth" +name = "aws-sdk-connecthealth" version = "0.13.0" description = "Python client for Connect Health" readme = "README.md" diff --git a/clients/aws-sdk-dynamodb/pyproject.toml b/clients/aws-sdk-dynamodb/pyproject.toml index c7e5c952..c1ab344a 100644 --- a/clients/aws-sdk-dynamodb/pyproject.toml +++ b/clients/aws-sdk-dynamodb/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_dynamodb" +name = "aws-sdk-dynamodb" version = "0.13.0" description = "Python client for Amazon DynamoDB" readme = "README.md" diff --git a/clients/aws-sdk-ec2/pyproject.toml b/clients/aws-sdk-ec2/pyproject.toml index 21ff550f..8d54fb7a 100644 --- a/clients/aws-sdk-ec2/pyproject.toml +++ b/clients/aws-sdk-ec2/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_ec2" +name = "aws-sdk-ec2" version = "0.13.0" description = "Python client for Amazon Elastic Compute Cloud" readme = "README.md" diff --git a/clients/aws-sdk-ecs/pyproject.toml b/clients/aws-sdk-ecs/pyproject.toml index 5309431e..31bd657d 100644 --- a/clients/aws-sdk-ecs/pyproject.toml +++ b/clients/aws-sdk-ecs/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_ecs" +name = "aws-sdk-ecs" version = "0.13.0" description = "Python client for Amazon EC2 Container Service" readme = "README.md" diff --git a/clients/aws-sdk-guardduty/pyproject.toml b/clients/aws-sdk-guardduty/pyproject.toml index 22fae440..09338645 100644 --- a/clients/aws-sdk-guardduty/pyproject.toml +++ b/clients/aws-sdk-guardduty/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_guardduty" +name = "aws-sdk-guardduty" version = "0.13.0" description = "Python client for Amazon GuardDuty" readme = "README.md" diff --git a/clients/aws-sdk-iam/pyproject.toml b/clients/aws-sdk-iam/pyproject.toml index c019c5e3..238b17f0 100644 --- a/clients/aws-sdk-iam/pyproject.toml +++ b/clients/aws-sdk-iam/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_iam" +name = "aws-sdk-iam" version = "0.13.0" description = "Python client for AWS Identity and Access Management" readme = "README.md" diff --git a/clients/aws-sdk-kinesis/pyproject.toml b/clients/aws-sdk-kinesis/pyproject.toml index fbcd9772..4f0cec34 100644 --- a/clients/aws-sdk-kinesis/pyproject.toml +++ b/clients/aws-sdk-kinesis/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_kinesis" +name = "aws-sdk-kinesis" version = "0.13.0" description = "Python client for Amazon Kinesis" readme = "README.md" diff --git a/clients/aws-sdk-kms/pyproject.toml b/clients/aws-sdk-kms/pyproject.toml index 86b899c0..cd9e72e4 100644 --- a/clients/aws-sdk-kms/pyproject.toml +++ b/clients/aws-sdk-kms/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_kms" +name = "aws-sdk-kms" version = "0.13.0" description = "Python client for AWS Key Management Service" readme = "README.md" diff --git a/clients/aws-sdk-lambda/pyproject.toml b/clients/aws-sdk-lambda/pyproject.toml index 4f33df21..bee8c4ca 100644 --- a/clients/aws-sdk-lambda/pyproject.toml +++ b/clients/aws-sdk-lambda/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_lambda" +name = "aws-sdk-lambda" version = "0.13.0" description = "Python client for AWS Lambda" readme = "README.md" diff --git a/clients/aws-sdk-lex-runtime-v2/pyproject.toml b/clients/aws-sdk-lex-runtime-v2/pyproject.toml index e1a4b446..8d10d6d6 100644 --- a/clients/aws-sdk-lex-runtime-v2/pyproject.toml +++ b/clients/aws-sdk-lex-runtime-v2/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_lex_runtime_v2" +name = "aws-sdk-lex-runtime-v2" version = "0.13.0" description = "Python client for Amazon Lex Runtime V2" readme = "README.md" diff --git a/clients/aws-sdk-polly/pyproject.toml b/clients/aws-sdk-polly/pyproject.toml index b628efa8..b70624f6 100644 --- a/clients/aws-sdk-polly/pyproject.toml +++ b/clients/aws-sdk-polly/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_polly" +name = "aws-sdk-polly" version = "0.13.0" description = "Python client for Amazon Polly" readme = "README.md" diff --git a/clients/aws-sdk-qbusiness/pyproject.toml b/clients/aws-sdk-qbusiness/pyproject.toml index 42b66746..00c66372 100644 --- a/clients/aws-sdk-qbusiness/pyproject.toml +++ b/clients/aws-sdk-qbusiness/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_qbusiness" +name = "aws-sdk-qbusiness" version = "0.13.0" description = "Python client for QBusiness" readme = "README.md" diff --git a/clients/aws-sdk-rds/pyproject.toml b/clients/aws-sdk-rds/pyproject.toml index c05f7fc0..410d4f7d 100644 --- a/clients/aws-sdk-rds/pyproject.toml +++ b/clients/aws-sdk-rds/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_rds" +name = "aws-sdk-rds" version = "0.13.0" description = "Python client for Amazon Relational Database Service" readme = "README.md" diff --git a/clients/aws-sdk-s3/pyproject.toml b/clients/aws-sdk-s3/pyproject.toml index e47d0ae0..b4140351 100644 --- a/clients/aws-sdk-s3/pyproject.toml +++ b/clients/aws-sdk-s3/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_s3" +name = "aws-sdk-s3" version = "0.13.0" description = "Python client for Amazon Simple Storage Service" readme = "README.md" diff --git a/clients/aws-sdk-sagemaker-runtime-http2/pyproject.toml b/clients/aws-sdk-sagemaker-runtime-http2/pyproject.toml index f175b6e4..58c8c0c6 100644 --- a/clients/aws-sdk-sagemaker-runtime-http2/pyproject.toml +++ b/clients/aws-sdk-sagemaker-runtime-http2/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_sagemaker_runtime_http2" +name = "aws-sdk-sagemaker-runtime-http2" version = "0.13.0" description = "Python client for Amazon SageMaker Runtime HTTP2" readme = "README.md" diff --git a/clients/aws-sdk-secrets-manager/pyproject.toml b/clients/aws-sdk-secrets-manager/pyproject.toml index 14beddf1..a8a81aab 100644 --- a/clients/aws-sdk-secrets-manager/pyproject.toml +++ b/clients/aws-sdk-secrets-manager/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_secrets_manager" +name = "aws-sdk-secrets-manager" version = "0.13.0" description = "Python client for AWS Secrets Manager" readme = "README.md" diff --git a/clients/aws-sdk-signin/pyproject.toml b/clients/aws-sdk-signin/pyproject.toml index 33e0fd2e..15392243 100644 --- a/clients/aws-sdk-signin/pyproject.toml +++ b/clients/aws-sdk-signin/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_signin" +name = "aws-sdk-signin" version = "0.13.0" description = "Python client for AWS Sign-In Service" readme = "README.md" diff --git a/clients/aws-sdk-sns/pyproject.toml b/clients/aws-sdk-sns/pyproject.toml index 4e894ca3..c5bcfd6f 100644 --- a/clients/aws-sdk-sns/pyproject.toml +++ b/clients/aws-sdk-sns/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_sns" +name = "aws-sdk-sns" version = "0.13.0" description = "Python client for Amazon Simple Notification Service" readme = "README.md" diff --git a/clients/aws-sdk-sqs/pyproject.toml b/clients/aws-sdk-sqs/pyproject.toml index 20cbf486..94d8067e 100644 --- a/clients/aws-sdk-sqs/pyproject.toml +++ b/clients/aws-sdk-sqs/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_sqs" +name = "aws-sdk-sqs" version = "0.13.0" description = "Python client for Amazon Simple Queue Service" readme = "README.md" diff --git a/clients/aws-sdk-sts/pyproject.toml b/clients/aws-sdk-sts/pyproject.toml index 1e13c220..c967bbc6 100644 --- a/clients/aws-sdk-sts/pyproject.toml +++ b/clients/aws-sdk-sts/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_sts" +name = "aws-sdk-sts" version = "0.13.0" description = "Python client for AWS Security Token Service" readme = "README.md" diff --git a/clients/aws-sdk-transcribe-streaming/pyproject.toml b/clients/aws-sdk-transcribe-streaming/pyproject.toml index a8033ee8..e72e1d27 100644 --- a/clients/aws-sdk-transcribe-streaming/pyproject.toml +++ b/clients/aws-sdk-transcribe-streaming/pyproject.toml @@ -1,7 +1,7 @@ # Code generated by smithy-python-codegen DO NOT EDIT. [project] -name = "aws_sdk_transcribe_streaming" +name = "aws-sdk-transcribe-streaming" version = "0.13.0" description = "Python client for Amazon Transcribe Streaming Service" readme = "README.md" diff --git a/codegen/integrations/src/main/java/software/amazon/aws/sdk/python/codegen/AwsSdkPackageFilesIntegration.java b/codegen/integrations/src/main/java/software/amazon/aws/sdk/python/codegen/AwsSdkPackageFilesIntegration.java index c4580e94..274b0e91 100644 --- a/codegen/integrations/src/main/java/software/amazon/aws/sdk/python/codegen/AwsSdkPackageFilesIntegration.java +++ b/codegen/integrations/src/main/java/software/amazon/aws/sdk/python/codegen/AwsSdkPackageFilesIntegration.java @@ -6,16 +6,19 @@ import java.util.List; import software.amazon.smithy.aws.traits.ServiceTrait; +import software.amazon.smithy.codegen.core.CodegenException; import software.amazon.smithy.model.traits.TitleTrait; import software.amazon.smithy.python.codegen.GenerationContext; import software.amazon.smithy.python.codegen.integrations.PythonIntegration; +import software.amazon.smithy.python.codegen.sections.PyprojectSection; import software.amazon.smithy.python.codegen.sections.ReadmeSection; import software.amazon.smithy.python.codegen.writer.PythonWriter; import software.amazon.smithy.utils.CodeInterceptor; import software.amazon.smithy.utils.CodeSection; /** - * Writes the AWS SDK README, LICENSE, and NOTICE into each generated client package. + * Writes the AWS SDK README, LICENSE, and NOTICE into each generated client package, + * and names the package in pyproject.toml with dashes. */ public final class AwsSdkPackageFilesIntegration implements PythonIntegration { @@ -26,7 +29,7 @@ public final class AwsSdkPackageFilesIntegration implements PythonIntegration { public List> interceptors( GenerationContext context ) { - return List.of(new ReadmeInterceptor(context)); + return List.of(new ReadmeInterceptor(context), new PyprojectInterceptor(context)); } @Override @@ -36,6 +39,36 @@ public void customize(GenerationContext context) { } } + private static String packageName(GenerationContext context) { + return context.settings().moduleName().replace('_', '-'); + } + + private static final class PyprojectInterceptor implements CodeInterceptor { + + private final GenerationContext context; + + PyprojectInterceptor(GenerationContext context) { + this.context = context; + } + + @Override + public Class sectionType() { + return PyprojectSection.class; + } + + @Override + public void write(PythonWriter writer, String previousText, PyprojectSection section) { + // smithy-python names the project after the module, so swap in the dashed name. + var generated = "[project]\nname = \"" + context.settings().moduleName() + "\"\n"; + if (!previousText.contains(generated)) { + throw new CodegenException("Expected pyproject.toml to contain: " + generated); + } + writer.writeWithNoFormatting(previousText.replace( + generated, + "[project]\nname = \"" + packageName(context) + "\"\n")); + } + } + private static final class ReadmeInterceptor implements CodeInterceptor { private final GenerationContext context; @@ -54,7 +87,7 @@ public void write(PythonWriter writer, String previousText, ReadmeSection sectio var service = context.settings().service(context.model()); var title = service.expectTrait(TitleTrait.class).getValue(); var sdkId = service.expectTrait(ServiceTrait.class).getSdkId(); - var packageName = context.settings().moduleName().replace('_', '-'); + var packageName = packageName(context); var docsSlug = packageName.substring("aws-sdk-".length()); writer.write(""" # $1L Client diff --git a/codegen/integrations/src/test/java/software/amazon/aws/sdk/python/codegen/AwsSdkPackageFilesIntegrationTest.java b/codegen/integrations/src/test/java/software/amazon/aws/sdk/python/codegen/AwsSdkPackageFilesIntegrationTest.java index bf7d5624..ab0602d6 100644 --- a/codegen/integrations/src/test/java/software/amazon/aws/sdk/python/codegen/AwsSdkPackageFilesIntegrationTest.java +++ b/codegen/integrations/src/test/java/software/amazon/aws/sdk/python/codegen/AwsSdkPackageFilesIntegrationTest.java @@ -5,6 +5,7 @@ package software.amazon.aws.sdk.python.codegen; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.nio.file.Files; @@ -60,6 +61,17 @@ public void readmeUsesTitleSdkIdAndPackageName() { """, manifest.expectFileString("README.md")); } + @Test + public void pyprojectNamesPackageWithDashes() { + var generated = generate(false).expectFileString("pyproject.toml"); + var underscored = "\nname = \"aws_sdk_secrets_manager\"\n"; + + assertTrue(generated.contains(underscored), generated); + assertEquals( + generated.replace(underscored, "\nname = \"aws-sdk-secrets-manager\"\n"), + generate().expectFileString("pyproject.toml")); + } + @Test public void legalFilesMatchRepositoryRoot() throws IOException { var manifest = generate(); @@ -69,8 +81,12 @@ public void legalFilesMatchRepositoryRoot() throws IOException { } } - @SuppressWarnings("unchecked") private static MockManifest generate() { + return generate(true); + } + + @SuppressWarnings("unchecked") + private static MockManifest generate(boolean intercept) { var service = ServiceShape.builder() .id("com.amazonaws.secretsmanager#secretsmanager") .version("2017-10-17") @@ -100,8 +116,10 @@ private static MockManifest generate() { var integration = new AwsSdkPackageFilesIntegration(); var interceptors = new ArrayList>(); - for (var interceptor : integration.interceptors(context)) { - interceptors.add((CodeInterceptor) interceptor); + if (intercept) { + for (var interceptor : integration.interceptors(context)) { + interceptors.add((CodeInterceptor) interceptor); + } } delegator.setInterceptors(interceptors); SetupGenerator.generateSetup(settings, context);