Hardcode version to avoid import of importlib.metadata.#472
Merged
purple4reina merged 2 commits intomainfrom Apr 16, 2024
Merged
Hardcode version to avoid import of importlib.metadata.#472purple4reina merged 2 commits intomainfrom
purple4reina merged 2 commits intomainfrom
Conversation
duncanista
reviewed
Apr 15, 2024
| @@ -0,0 +1 @@ | |||
| __version__ = "5.92.0" | |||
Contributor
There was a problem hiding this comment.
Now we have to update this every time we do a release, could we add this to the internal docs?
duncanista
reviewed
Apr 15, 2024
| echo | ||
|
|
||
| poetry version ${NEW_VERSION} | ||
| echo "__version__ = \"${NEW_VERSION}\"" > datadog_lambda/version.py |
Contributor
There was a problem hiding this comment.
Oh, nvm, well done here!
Thanks for automating it.
duncanista
approved these changes
Apr 15, 2024
duncanista
reviewed
Apr 15, 2024
datadog_lambda/__init__.py
Outdated
| __version__ = importlib_metadata.version(__name__) | ||
|
|
||
|
|
||
| from datadog_lambda.version import __version__ # noqa: E402 |
Contributor
There was a problem hiding this comment.
Also, it looks like the linter is complaining on the GitHub side, since we are not using the variable, why might that be?
Contributor
Author
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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