-
Notifications
You must be signed in to change notification settings - Fork 45
Hardcode version to avoid import of importlib.metadata. #472
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
@@ -0,0 +1 @@ | |||
__version__ = "5.92.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.
Now we have to update this every time we do a release, could we add this to the internal docs?
echo | ||
|
||
poetry version ${NEW_VERSION} | ||
echo "__version__ = \"${NEW_VERSION}\"" > datadog_lambda/version.py |
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.
Oh, nvm, well done here!
Thanks for automating it.
datadog_lambda/__init__.py
Outdated
__version__ = importlib_metadata.version(__name__) | ||
|
||
|
||
from datadog_lambda.version import __version__ # noqa: E402 |
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.
Also, it looks like the linter is complaining on the GitHub side, since we are not using the variable, why might that be?
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 added the noqa: F401
comment to this line as well, should fix the linting issue.
b97c885
to
af4eb41
Compare
af4eb41
to
98ca851
Compare
a2576a4
to
03dd2cb
Compare
What does this PR do?
Hardcodes the
__version__
value to avoid import ofimportlib.metadata
.Motivation
This speeds up cold start time.
Testing Guidelines
Additional Notes
Before

After

Note that the reduction in cold start time is slight, I would expect a speed up of only 4ms.

Types of Changes
Check all that apply