-
Notifications
You must be signed in to change notification settings - Fork 24
Add Missing Dependencies In Codegen #557
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
Conversation
To document a conversation we had on slack: We decided against the alternate option (requiring the dependencies directly) since it's odd to add a direct dependency requirement on something we will depend on transitively. It would make it much more difficult to reason about why a dependency is needed, and when it's safe to remove. Depending directly on a package because a dependency needs it creates confusion about ownership and purpose - if the transitive dependency changes its requirements or is removed entirely, we'd be left with direct dependencies that serve no clear purpose in our codebase. This approach also makes dependency management more complex, as we'd need to track both our actual needs and the needs of our dependencies, potentially leading to version conflicts or unnecessary bloat. |
"smithy-aws-event-stream" | ||
] | ||
json = [ | ||
"smithy-json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: In this repo, all our dependencies on smithy-*
packages are unbounded. I think this is wrong and we should at least add upper bounds, however, I think that should be done in a separate PR to provide consistency.
Example:
json = [
"smithy-json<=0.1.0"
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a holdover from the previous build tool we were using which handled injecting versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I didn't know that was possible. Do you know that tool that was? I can look into if uv
supports that feature.
Overview
When generating a client for a service that uses REST-JSON or AWS Event Streaming, the client is unusable after install (see "Error Examples" section below) due to nothing taking a dependency on
smithy-json
orsmith-aws-event-stream
.This PR adds the following:
json
optional dependency group that includessmithy-json
.smithy-aws-core[eventstream]
dependency inpyproject.toml
when operations with event streaming are added.smithy-aws-core[json]
dependency inpyproject.toml
when generating services that support REST-JSON.Dependencies Before and After
Dependencies Before Fix
Dependencies After Fix
Error Examples
Error without smithy-json
Error without smithy-aws-event-stream
Alternative Option
Add a direct dependency on
smithy-json
andsmith-aws-event-stream
:By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.