dbt-core icon indicating copy to clipboard operation
dbt-core copied to clipboard

Fix #9007: Make dbt-core compatible with Python 3.12

Open aranke opened this issue 1 year ago • 2 comments

resolves #9007

Problem

Solution

Checklist

  • [ ] I have read the contributing guide and understand what's expected of me
  • [ ] I have run this code in development and it appears to resolve the stated issue
  • [ ] This PR includes tests, or tests are not required/relevant for this PR
  • [ ] This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • [ ] This PR includes type annotations for new and modified functions

aranke avatar Feb 21 '24 15:02 aranke

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 88.08%. Comparing base (2b23a03) to head (36c4671). Report is 1 commits behind head on main.

Files Patch % Lines
core/dbt/utils.py 71.42% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9612      +/-   ##
==========================================
+ Coverage   88.01%   88.08%   +0.07%     
==========================================
  Files         177      177              
  Lines       22350    22356       +6     
==========================================
+ Hits        19671    19692      +21     
+ Misses       2679     2664      -15     
Flag Coverage Δ
integration 85.60% <75.00%> (+0.13%) :arrow_up:
unit 62.13% <25.00%> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 21 '24 15:02 codecov[bot]

@MichelleArk Any idea why tests/unit/test_plugin_manager.py::TestPluginManager::test_get_nodes is failing across all Python versions here?

aranke avatar Feb 24 '24 00:02 aranke

Do we also need to update https://github.com/dbt-labs/dbt-core/blob/main/core/setup.py#L88-L97?

MichelleArk avatar Feb 26 '24 16:02 MichelleArk

Any idea why tests/unit/test_plugin_manager.py::TestPluginManager::test_get_nodes is failing across all Python versions here?

Discussed offline: It was surprising that the test passed in the first place with called_once_with, because there were always multiple calls to the tracking module, each with num_models as 1 (not 2, as the test was previous passing). Switching to assert_called_once_with on this branch actually brought this issue to light. We confirmed no actual change in behaviour across the branches and updated the test to be more precise / accurate using assert_has_calls

MichelleArk avatar Feb 26 '24 16:02 MichelleArk

Do we also need to update main/core/setup.py#L88-L97?

Done, thanks!

aranke avatar Feb 26 '24 16:02 aranke

I noticed that part of the acceptance criteria was to ensure that bundles can be created with Python 3.12. Should we confirm that before merging this?

MichelleArk avatar Feb 26 '24 17:02 MichelleArk

I noticed that part of the acceptance criteria was to ensure that bundles can be created with Python 3.12. Should we confirm that before merging this?

How would you recommend I do this? I intended to merge this PR in, backport the change to 1.7, then test the created bundle for 1.7 with Python 3.12.

aranke avatar Feb 26 '24 17:02 aranke

I intended to merge this PR in, backport the change to 1.7, then test the created bundle for 1.7 with Python 3.12. Sounds great! 💪

MichelleArk avatar Feb 26 '24 20:02 MichelleArk

The backport to 1.7.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.7.latest 1.7.latest
# Navigate to the new working tree
cd .worktrees/backport-1.7.latest
# Create a new branch
git switch --create backport-9612-to-1.7.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b337e0b7263a01648028958dc3da3a145767b12b
# Push it to GitHub
git push --set-upstream origin backport-9612-to-1.7.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.7.latest

Then, create a pull request where the base branch is 1.7.latest and the compare/head branch is backport-9612-to-1.7.latest.

github-actions[bot] avatar Feb 26 '24 20:02 github-actions[bot]