-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add update-python-version command to automate Python version updates
#21694
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: master
Are you sure you want to change the base?
Conversation
update-python-version command to automate Python version updates
Codecov Report❌ Patch coverage is Additional details and impacted files🚀 New features to boost your workflow:
|
82e7659 to
147ab25
Compare
eb3c82c to
b3ec69a
Compare
a2aaba1 to
af01d4f
Compare
| @@ -0,0 +1,53 @@ | |||
| # (C) Datadog, Inc. 2023-present | |||
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 just a renamed file - formerly test_upgrade_python.py.
| @@ -0,0 +1,232 @@ | |||
| # (C) Datadog, Inc. 2023-present | |||
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 just a renamed file - formerly upgrade_python.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.
Any reason for not combining the 2 functions?
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 opted to make them different scripts since they target different things. The old upgrade python is just to update our hatch and pyproject config once a year or so (whenever we update the minor version). update-python-version will happen more frequently but I'm open to ideas 👍
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
This PR does not modify any files shipped with the agent. To help streamline the release process, please consider adding the |
09bd111 to
58bc862
Compare
| ) | ||
|
|
||
|
|
||
| @click.command('upgrade-python-version', short_help='Upgrade the Python version used in the repository.') |
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.
In the future what would happen if we need to upgrade to 3.14 for example? Seems like this is only intended to do patches?
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.
Yep this is only intended to do patches. It wouldn't be hard to enhance this feature to also allow minor version bumps but those tend to require more effort to incorporate into our CI so. We also wouldn't want the script to upgrade to a new minor version ahead of the Agent's embedded python version
| from ddev.repo.constants import PYTHON_VERSION as old_version | ||
|
|
||
| tracker = app.create_validation_tracker('Python upgrades') | ||
| tracker = app.create_validation_tracker('Python version upgrades') |
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.
what does tracker do? Is it just logging lines?
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.
Mostly, validation result tracker just collects and displays validation results. https://github.com/DataDog/integrations-core/blob/master/ddev/src/ddev/validation/tracker.py
| if target_line == new_line: | ||
| return |
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.
What is this for? If the MacOS version is already at latest? If so can you add a log message? Or a comment if it's not meant to be an error.
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.
Correct, this is a check in case the version is already at latest. More so, for anyone who's updating these manually.
|
Pretty well written! Left some nits and clarifying questions. But a few things:
|
What does this PR do?
Adds
ddev meta scripts update-python-versioncommand to automatically detect and apply Python version updates across the repository.Automate the process of updating Python versions by:
Affected files:
ddev/src/ddev/repo/constants.py(PYTHON_VERSION_FULL).builders/images/*/Dockerfile(Linux & Windows).github/workflows/resolve-build-deps.yaml(macOS)Motivation
https://datadoghq.atlassian.net/browse/AI-5659