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

fix: support python 3.12

Open l1xnan opened this issue 1 year ago • 7 comments

resolves #9007

Problem

distutils.util.strtobool was removed in Python 3.12, see https://peps.python.org/pep-0632

Solution

Copying the distutils.util.strtobool implementation from python 3.10.

Checklist

  • [x] I have read the contributing guide and understand what's expected of me
  • [x] 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
  • [x] 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
  • [x] This PR includes type annotations for new and modified functions

l1xnan avatar Feb 20 '24 07:02 l1xnan

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @l1xnan

cla-bot[bot] avatar Feb 20 '24 07:02 cla-bot[bot]

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

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

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @l1xnan

cla-bot[bot] avatar Feb 20 '24 14:02 cla-bot[bot]

Codecov Report

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

Project coverage is 87.99%. Comparing base (1ec5e22) to head (714569c). Report is 3 commits behind head on main.

:exclamation: Current head 714569c differs from pull request most recent head 721cb38. Consider uploading reports for the commit 721cb38 to get more accurate results

Files Patch % Lines
core/dbt/utils.py 71.42% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9601      +/-   ##
==========================================
- Coverage   88.00%   87.99%   -0.01%     
==========================================
  Files         168      176       +8     
  Lines       22210    22317     +107     
==========================================
+ Hits        19546    19638      +92     
- Misses       2664     2679      +15     
Flag Coverage Δ
integration 85.59% <75.00%> (-0.08%) :arrow_down:
unit 62.08% <25.00%> (+0.16%) :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 14:02 codecov[bot]

Hey @l1xnan,

Thanks for the PR, it looks good to me!

Can you please sign the CLA and add a changelog entry so we can merge this in? Instructions on creating a changelog entry are here: https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-or-modifying-a-changelog-entry

Thank you!

aranke avatar Feb 21 '24 14:02 aranke

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @l1xnan

cla-bot[bot] avatar Feb 22 '24 11:02 cla-bot[bot]

Run pip install -e dbt-core in python 3.11, it is installed by running setup.py develop:

# lib/site-packages
dbt/
dbt-core.egg-link
easy-install.pth    # The content is `<project-root>/dbt-core/core`

As a comparison, run pip install -e dbt-core in python 3.12, dbt-core is installed by building it as a temp wheel file:

# lib/site-packages
dbt/
dbt_core-1.8.0a1.dist-info/
__editable___dbt_core_1_8_0a1_finder.py
__editable__.dbt_core-1.8.0a1

The easy-install.pth file is missing, dbt.include.starter_project is only found in the site-packages/dbt, so the dbt.include.starter_project cannot be imported.

It can also be resolved with the following command:

pip install -e ./core --config-settings editable_mode=compat

see to https://setuptools.pypa.io/en/latest/userguide/development_mode.html#legacy-behavior

l1xnan avatar Feb 23 '24 08:02 l1xnan

Official resolves

l1xnan avatar Feb 26 '24 02:02 l1xnan