Skip to content
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

[AWSX-537] Support python version 3.10 #719

Merged
merged 11 commits into from
Dec 14, 2023
Merged

Conversation

ge0Aja
Copy link
Contributor

@ge0Aja ge0Aja commented Dec 7, 2023

What does this PR do?

Support python version 3.10

Motivation

Support request

Testing Guidelines

Additional Notes

This PR adds support for python version 3.10 which requires a higher version for datadog-lambda package.
The usage of the higher version for that package adds a new field DD-API-KEY in the header section of the of the events response forwarded by the function. It also removes the API key string from the path parameter.

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)
  • This PR passes the unit tests
  • This PR passes the installation tests (ask a Datadog member to run the tests)

@github-actions github-actions bot added the aws label Dec 7, 2023
@ge0Aja ge0Aja force-pushed the georgi.ajaeiya/py310311 branch from 8102d49 to d11a039 Compare December 7, 2023 17:10
@ge0Aja
Copy link
Contributor Author

ge0Aja commented Dec 7, 2023

had to use python versions as strings for triggering GH actions
actions/runner#1989

@ge0Aja ge0Aja marked this pull request as ready for review December 7, 2023 22:00
@ge0Aja ge0Aja requested a review from a team December 8, 2023 13:08
@ge0Aja ge0Aja changed the title Support python versions 3.10, 3.11 [AWSX-537] Support python versions 3.10, 3.11 Dec 8, 2023
@@ -1,7 +1,7 @@
service: forwarder-tests-external-lambda
provider:
name: aws
runtime: python2.7
runtime: python3.11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file really used ? I'm surprised in was on 2.X

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

caught that when I was doing the version changes, not sure if it is used.

@@ -138,6 +138,10 @@ If you can't install the Forwarder using the provided CloudFormation template, y

If you encounter issues upgrading to the latest version, check the Troubleshooting section.

### Upgrade an older version to +3.97.0

Since version 3.97.0 the Lambda function has been updated to require **Python 3.11**. If upgrading an older forwarder installation to 3.97.0 or above, ensure the AWS Lambda function is configured to use Python 3.11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems from most other files that we actually support 3.10 and 3.11 which is not really clear in this doc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can update the readme to include both versions, I followed the convention in the readme file

@@ -19,4 +19,3 @@ RUN rm -rf ./botocore*
# like `os.execl`, which cause security scans to fail for certain customers.
# These files are not directly used by the Forwarder.
RUN rm ./ddtrace/commands/ddtrace_run.py
RUN rm ./decorator.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file not found error was thrown during ITests, it seems it was added during a dependency version bump which created this file.
Now, it is not created, so rm is failing

@@ -12,7 +12,7 @@ set -e

OLD_REGION='us-east-1'

PYTHON_VERSIONS_FOR_AWS_CLI=("python3.9")
PYTHON_VERSIONS_FOR_AWS_CLI=("python3.11")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we support only one version here ? why an array then ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems we support only the highest version, not sure why

@ge0Aja ge0Aja changed the title [AWSX-537] Support python versions 3.10, 3.11 [AWSX-537] Support python versions 3.10 Dec 8, 2023
@ge0Aja ge0Aja changed the title [AWSX-537] Support python versions 3.10 [AWSX-537] Support python version 3.10 Dec 8, 2023
@@ -11,7 +11,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: 3.9
python-version: '3.10'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we add quotes here?

@@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.8, 3.9]
python-version: ['3.9', '3.10']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question, why do we use quotes now ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see actions/runner#1989, same for the above

@@ -138,6 +138,10 @@ If you can't install the Forwarder using the provided CloudFormation template, y

If you encounter issues upgrading to the latest version, check the Troubleshooting section.

### Upgrade an older version to +3.97.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to update the cloudformation template we use to deploy the forwarder to ensure we use Python 3.10 as well

python_requires=">=3.7, <3.10",
install_requires=["datadog-lambda==3.39.0", "requests-futures==1.0.0"],
python_requires=">=3.9, <3.11",
install_requires=["datadog-lambda==4.77.0", "requests-futures==1.0.0"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's that version change coming from ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required dependency version update to support versions 3.10 -> 3.11

@@ -1,4 +1,4 @@
FROM python:3.9
FROM python:3.11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still mentions 3.11 (PR title states 3.10)

@@ -13,7 +13,7 @@ set -e
# Makes sure any subprocesses will be terminated with this process
trap "pkill -P $$; exit 1;" INT

PYTHON_VERSIONS_FOR_AWS_CLI=("python3.9")
PYTHON_VERSIONS_FOR_AWS_CLI=("python3.11")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still mentions 3.11 vs 3.10 in title of the PR

@ge0Aja ge0Aja force-pushed the georgi.ajaeiya/py310311 branch from eaad826 to b7a1e2c Compare December 12, 2023 09:38
- Use the correct python runtime for tester and recorder docker images
- Add a health check for the recorder service in the docker-compose file
- Update service dependency
- Pass the correct python runtime version when bundling the forwarder code for the Itests
- Remove unused docker files as we are using the image version in the compose file
@ge0Aja ge0Aja merged commit 87e0a1a into master Dec 14, 2023
12 checks passed
@ge0Aja ge0Aja deleted the georgi.ajaeiya/py310311 branch December 14, 2023 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants