-
Notifications
You must be signed in to change notification settings - Fork 0
Notes pr #1
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
base: develop
Are you sure you want to change the base?
Conversation
/** | ||
* AWS Dependencies used in the smithy python generator. | ||
*/ | ||
@SmithyUnstableApi |
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.
This is used to mark the class as subject to breaking change: https://smithy.io/javadoc/1.19.0/software/amazon/smithy/utils/SmithyUnstableApi.html
* AWS Dependencies used in the smithy python generator. | ||
*/ | ||
@SmithyUnstableApi | ||
public class AwsPythonDependency { |
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.
Kind of self-explanatory, but this is a class that is used to hold logic related to aws-specific dependencies in python. This class is expected to grow with more aws-specific dependencies as they are needed. For now, it just has SMITHY_AWS_CORE.
* | ||
* <p>While in development this will use the develop branch. | ||
*/ | ||
public static final PythonDependency SMITHY_AWS_CORE = new PythonDependency( |
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.
SMITHY_AWS_CORE is referenced later - that will end up putting this in the pyproject.toml.
public List<RuntimeClientPlugin> getClientPlugins() { | ||
return List.of( | ||
RuntimeClientPlugin.builder() | ||
.addConfigProperty( |
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.
This addConfigProperty
method is adding a configuration to the client. In this case, it's adding the configuration user_agent_extra
to be added to the client.
End users will be able to pass in user_agent_extra
to the client configuration somehow to be used by the client, similar to how they do in the botocore.config.Config
object today.
.nullable(true) | ||
.build() | ||
) | ||
.pythonPlugin( |
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.
.pythonPlugin
is adding a plugin to the client. This is a smithy interceptor; this is similar to adding an event handler to an event in botocore.
* Adds a runtime plugin to set user agent. | ||
*/ | ||
@SmithyInternalApi | ||
public class AwsUserAgentIntegration implements PythonIntegration { |
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.
A PythonIntegration
is sort of a plugin to the code generator. This uses "service provider interfaces" in Java.
Basically it's referenced later in the META-INF file below and some java magic happens that allows Smithy to pick this up during build time. This is handled by smithy itself, not smithy-python, so we don't have to understand this one on low level just yet.
@Override | ||
public List<RuntimeClientPlugin> getClientPlugins() { | ||
return List.of( | ||
RuntimeClientPlugin.builder() |
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.
A RuntimeClientPlugin
is similarly collected to be used later, but this time the code to do so is inside of smithy-python.
I'll need to do a deeper dive here to understand how this works fully, but the gist is outlined in the comment below.
) | ||
.pythonPlugin( | ||
SymbolReference.builder() | ||
.symbol(Symbol.builder() |
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.
A symbol is just a reference to some form of python code. In this case, it's a reference to this new method.
Anti-review:
This PR is to take some notes on Alex's PR to help me get some understanding of what's going on in the smithy-python repo