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

[CT-1411] [Feature] Support Python 3.11 #6147

Closed
3 tasks done
dbeatty10 opened this issue Oct 26, 2022 · 8 comments · Fixed by #6326
Closed
3 tasks done

[CT-1411] [Feature] Support Python 3.11 #6147

dbeatty10 opened this issue Oct 26, 2022 · 8 comments · Fixed by #6326
Labels
enhancement New feature or request performance repo ci/cd Testing and continuous integration for dbt-core + adapter plugins
Milestone

Comments

@dbeatty10
Copy link
Contributor

dbeatty10 commented Oct 26, 2022

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

Support Python 3.11.x in dbt Core and adapters:

Describe alternatives you've considered

No response

Who will this benefit?

Folks using the most recent release of Python

Are you interested in contributing this feature?

Will mark as a "good first issue" and let someone else take a shot at this

Anything else?

Last time

It looks like this work was split across multiple PRs last time, but it would be nice to have a single PR this time:

  1. https://github.com/dbt-labs/dbt-core/pull/4866/files
  2. https://github.com/dbt-labs/dbt-core/pull/5025/files

How to implement

Add 3.11 (and 3.10 when it is missing) to these locations:

  1. dbt-core/core/setup.py

    Lines 82 to 84 in 1916784

    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    ],
  2. "Programming Language :: Python :: 3.9",
    ],
  3. "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    ],
  4. [testenv:{unit,py37,py38,py39,py310,py}]
  5. [testenv:{integration,py37-integration,py38-integration,py39-integration,py310-integration,py-integration}]
  6. python-version: ["3.7", "3.8", "3.9", "3.10"]
  7. python-version: ["3.7", "3.8", "3.9", "3.10"]
  8. dbt-core/Dockerfile.test

    Lines 46 to 51 in 1916784

    python3.9 \
    python3.9-dev \
    python3.9-venv \
    python3.10 \
    python3.10-dev \
    python3.10-venv \
  9. - [`tox`](https://tox.readthedocs.io/en/latest/) to manage virtualenvs across python versions. We currently target the latest patch releases for Python 3.7, 3.8, 3.9, and 3.10
  10. [`tox`](https://tox.readthedocs.io/en/latest/) takes care of managing virtualenvs and install dependencies in order to run tests. You can also run tests in parallel, for example, you can run unit tests for Python 3.7, Python 3.8, Python 3.9, and Python 3.10 checks in parallel with `tox -p`. Also, you can run unit tests for specific python versions with `tox -e py37`. The configuration for these tests in located in `tox.ini`.
  11. Any other relevant file I may have missed in the two pull requests from last time (when we added Python 3.10)
@dbeatty10 dbeatty10 added enhancement New feature or request triage labels Oct 26, 2022
@github-actions github-actions bot changed the title [Feature] Support Python 3.11 [CT-1411] [Feature] Support Python 3.11 Oct 26, 2022
@dbeatty10 dbeatty10 added good_first_issue Straightforward + self-contained changes, good for new contributors! and removed triage labels Oct 26, 2022
@leahwicz leahwicz added the repo ci/cd Testing and continuous integration for dbt-core + adapter plugins label Oct 27, 2022
@jtcohen6 jtcohen6 added this to the v1.4 milestone Oct 27, 2022
@jtcohen6
Copy link
Contributor

jtcohen6 commented Oct 29, 2022

https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython

CPython 3.11 is on average 25% faster than CPython 3.10 when measured with the pyperformance benchmark suite, and compiled with GCC on Ubuntu Linux. Depending on your workload, the speedup could be up to 10-60% faster.

It took a teensy bit of finagling (48e6f96), but I was able to experiment running dbt-core + dbt-postgres with Python 3.11.0.

Completely anecdotal evidence: Running on my M1 locally, a full parse is ~3x faster (just over 9 seconds, instead of just under 27 seconds) for our internal analytics project (almost 2k files, 700+ models) compared with 3.9.13.

I'm going to remove the good_first_issue label because this was a slightly heavier lift due to internal changes within py311, and because this is worth us scheduling as work that definitely gets in for v1.4.

@jtcohen6 jtcohen6 removed the good_first_issue Straightforward + self-contained changes, good for new contributors! label Oct 29, 2022
@leahwicz
Copy link
Contributor

We should open up issues for each adapter repo as well

@dbeatty10
Copy link
Contributor Author

We should open up issues for each adapter repo as well

✅ done!

@Fleid
Copy link
Contributor

Fleid commented Nov 30, 2022

@leahwicz @nathaniel-may @jtcohen6 I'm going to assign this one to the adapter team unless there's a huge outcry. We have to do the 4 adapters + Postgres anyway so...

@jtcohen6
Copy link
Contributor

jtcohen6 commented Nov 30, 2022

@Fleid Makes sense for the adapters!

@leahwicz + I were thinking of giving the dbt-core part to @dbt-labs/core-language. It sounds like #6108 is a first step on the way toward unblocking this.

@leahwicz
Copy link
Contributor

@Fleid if Adapters wants to do this, that is fine with me. #6326 has already been put up as a draft PR and but still needs works obviously. I created a Slack thread in #dev-core to consolidate knowledge on who has looked at what so far with Python 3.11 and then we can have an Adapters person pick it up from there

@jelstongreen
Copy link

jelstongreen commented Jan 30, 2024

Folks the Dockerfile is currently pinned to 3.10 due to a bug - any plans to upgrade to 3.11?

@dbeatty10
Copy link
Contributor Author

Hey @jelstongreen !

Just replied to you here: #9491 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance repo ci/cd Testing and continuous integration for dbt-core + adapter plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants