mirror of
https://github.com/dbt-labs/dbt-core
synced 2025-12-17 19:31:34 +00:00
Drop python 3.9 support (#12120)
* Update `setup.py` to drop support for python 3.9 * Update github issue templates to not use python 3.9 as an example * Update github workflows to no longer depend on or test python 3.9 * Drop python 3.9 from the test dockerfile * Update `CONTRIBUTING.md` to correctly list what python versions we test * Update comment about some code specifically needed for a python 3.9.7 issue * Update pre-commit python version comment * Add changie doc * Update imports from click as upgrading to python 3.10 changed some click items
This commit is contained in:
6
.changes/unreleased/Dependencies-20251027-162502.yaml
Normal file
6
.changes/unreleased/Dependencies-20251027-162502.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Dependencies
|
||||
body: Drop support for python 3.9
|
||||
time: 2025-10-27T16:25:02.435562-05:00
|
||||
custom:
|
||||
Author: QMalcolm
|
||||
Issue: "12118"
|
||||
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -62,7 +62,7 @@ body:
|
||||
description: |
|
||||
examples:
|
||||
- **OS**: Ubuntu 24.04
|
||||
- **Python**: 3.9.12 (`python3 --version`)
|
||||
- **Python**: 3.10.12 (`python3 --version`)
|
||||
- **dbt-core**: 1.1.1 (`dbt --version`)
|
||||
value: |
|
||||
- OS:
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/regression-report.yml
vendored
2
.github/ISSUE_TEMPLATE/regression-report.yml
vendored
@@ -56,7 +56,7 @@ body:
|
||||
description: |
|
||||
examples:
|
||||
- **OS**: Ubuntu 24.04
|
||||
- **Python**: 3.9.12 (`python3 --version`)
|
||||
- **Python**: 3.10.12 (`python3 --version`)
|
||||
- **dbt-core (working version)**: 1.1.1 (`dbt --version`)
|
||||
- **dbt-core (regression version)**: 1.2.0 (`dbt --version`)
|
||||
value: |
|
||||
|
||||
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
@@ -54,7 +54,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install python dependencies
|
||||
run: |
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13" ]
|
||||
|
||||
env:
|
||||
TOXENV: "unit"
|
||||
@@ -142,7 +142,7 @@ jobs:
|
||||
- name: generate include
|
||||
id: generate-include
|
||||
run: |
|
||||
INCLUDE=('"python-version":"3.9","os":"windows-latest"' '"python-version":"3.9","os":"macos-14"' )
|
||||
INCLUDE=('"python-version":"3.10","os":"windows-latest"' '"python-version":"3.10","os":"macos-14"' )
|
||||
INCLUDE_GROUPS="["
|
||||
for include in ${INCLUDE[@]}; do
|
||||
for group in $(seq 1 ${{ env.PYTHON_INTEGRATION_TEST_WORKERS }}); do
|
||||
@@ -164,7 +164,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
|
||||
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
|
||||
os: ["ubuntu-latest"]
|
||||
split-group: ${{ fromJson(needs.integration-metadata.outputs.split-groups) }}
|
||||
env:
|
||||
@@ -361,7 +361,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install python dependencies
|
||||
run: |
|
||||
|
||||
2
.github/workflows/model_performance.yml
vendored
2
.github/workflows/model_performance.yml
vendored
@@ -150,7 +150,7 @@ jobs:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Install dbt
|
||||
run: pip install dbt-postgres==${{ needs.set-variables.outputs.release_id }}
|
||||
|
||||
2
.github/workflows/schema-check.yml
vendored
2
.github/workflows/schema-check.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: 3.9
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Checkout dbt repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -96,7 +96,7 @@ jobs:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Install python dependencies
|
||||
run: |
|
||||
|
||||
1
.github/workflows/test-repeater.yml
vendored
1
.github/workflows/test-repeater.yml
vendored
@@ -27,7 +27,6 @@ on:
|
||||
description: 'Version of Python to Test Against'
|
||||
type: choice
|
||||
options:
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
- '3.11'
|
||||
os:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
exclude: ^(core/dbt/docs/build/|core/dbt/common/events/types_pb2.py|core/dbt/adapters/events/adapter_types_pb2.py)
|
||||
|
||||
# Force all unspecified python hooks to run python 3.9
|
||||
# Force all unspecified python hooks to run python 3.10
|
||||
default_language_version:
|
||||
python: python3
|
||||
|
||||
|
||||
@@ -2,15 +2,34 @@
|
||||
|
||||
`dbt-core` is open source software. It is what it is today because community members have opened issues, provided feedback, and [contributed to the knowledge loop](https://www.getdbt.com/dbt-labs/values/). Whether you are a seasoned open source contributor or a first-time committer, we welcome and encourage you to contribute code, documentation, ideas, or problem statements to this project.
|
||||
|
||||
1. [About this document](#about-this-document)
|
||||
2. [Getting the code](#getting-the-code)
|
||||
3. [Setting up an environment](#setting-up-an-environment)
|
||||
4. [Running dbt-core in development](#running-dbt-core-in-development)
|
||||
5. [Testing dbt-core](#testing)
|
||||
6. [Debugging](#debugging)
|
||||
7. [Adding or modifying a changelog entry](#adding-or-modifying-a-changelog-entry)
|
||||
8. [Submitting a Pull Request](#submitting-a-pull-request)
|
||||
9. [Troubleshooting Tips](#troubleshooting-tips)
|
||||
- [Contributing to `dbt-core`](#contributing-to-dbt-core)
|
||||
- [About this document](#about-this-document)
|
||||
- [Notes](#notes)
|
||||
- [Getting the code](#getting-the-code)
|
||||
- [Installing git](#installing-git)
|
||||
- [External contributors](#external-contributors)
|
||||
- [dbt Labs contributors](#dbt-labs-contributors)
|
||||
- [Setting up an environment](#setting-up-an-environment)
|
||||
- [Tools](#tools)
|
||||
- [Virtual environments](#virtual-environments)
|
||||
- [Docker and `docker-compose`](#docker-and-docker-compose)
|
||||
- [Postgres (optional)](#postgres-optional)
|
||||
- [Running `dbt-core` in development](#running-dbt-core-in-development)
|
||||
- [Installation](#installation)
|
||||
- [Running `dbt-core`](#running-dbt-core)
|
||||
- [Testing](#testing)
|
||||
- [Initial setup](#initial-setup)
|
||||
- [Test commands](#test-commands)
|
||||
- [Makefile](#makefile)
|
||||
- [`pre-commit`](#pre-commit)
|
||||
- [`tox`](#tox)
|
||||
- [`pytest`](#pytest)
|
||||
- [Unit, Integration, Functional?](#unit-integration-functional)
|
||||
- [Debugging](#debugging)
|
||||
- [Assorted development tips](#assorted-development-tips)
|
||||
- [Adding or modifying a CHANGELOG Entry](#adding-or-modifying-a-changelog-entry)
|
||||
- [Submitting a Pull Request](#submitting-a-pull-request)
|
||||
- [Troubleshooting Tips](#troubleshooting-tips)
|
||||
|
||||
## About this document
|
||||
|
||||
@@ -55,7 +74,7 @@ There are some tools that will be helpful to you in developing locally. While th
|
||||
|
||||
These are the tools used in `dbt-core` development and testing:
|
||||
|
||||
- [`tox`](https://tox.readthedocs.io/en/latest/) to manage virtualenvs across python versions. We currently target the latest patch releases for Python 3.8, 3.9, 3.10 and 3.11
|
||||
- [`tox`](https://tox.readthedocs.io/en/latest/) to manage virtualenvs across python versions. We currently target the latest patch releases for Python 3.10, 3.11, 3.12, and 3.13
|
||||
- [`pytest`](https://docs.pytest.org/en/latest/) to define, discover, and run tests
|
||||
- [`flake8`](https://flake8.pycqa.org/en/latest/) for code linting
|
||||
- [`black`](https://github.com/psf/black) for code formatting
|
||||
|
||||
@@ -33,9 +33,6 @@ RUN apt-get update \
|
||||
python-is-python3 \
|
||||
python-dev-is-python3 \
|
||||
python3-pip \
|
||||
python3.9 \
|
||||
python3.9-dev \
|
||||
python3.9-venv \
|
||||
python3.10 \
|
||||
python3.10-dev \
|
||||
python3.10-venv \
|
||||
|
||||
@@ -3,7 +3,7 @@ import typing as t
|
||||
|
||||
import click
|
||||
from click import Context
|
||||
from click.parser import OptionParser, ParsingState
|
||||
from click.parser import _OptionParser, _ParsingState
|
||||
|
||||
from dbt.cli.option_types import ChoiceTuple
|
||||
|
||||
@@ -33,8 +33,8 @@ class MultiOption(click.Option):
|
||||
else:
|
||||
assert isinstance(option_type, ChoiceTuple), msg
|
||||
|
||||
def add_to_parser(self, parser: OptionParser, ctx: Context):
|
||||
def parser_process(value: str, state: ParsingState):
|
||||
def add_to_parser(self, parser: _OptionParser, ctx: Context):
|
||||
def parser_process(value: str, state: _ParsingState):
|
||||
# method to hook to the parser.process
|
||||
done = False
|
||||
value_list = str.split(value, " ")
|
||||
|
||||
@@ -68,7 +68,9 @@ class Profile(HasCredentials):
|
||||
threads: int,
|
||||
credentials: Credentials,
|
||||
) -> None:
|
||||
"""Explicitly defining `__init__` to work around bug in Python 3.9.7
|
||||
"""
|
||||
TODO: Is this no longer needed now that 3.9 is no longer supported?
|
||||
Explicitly defining `__init__` to work around bug in Python 3.9.7
|
||||
https://bugs.python.org/issue45081
|
||||
"""
|
||||
self.profile_name = profile_name
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
if sys.version_info < (3, 10):
|
||||
print("Error: dbt does not support this version of Python.")
|
||||
print("Please upgrade to Python 3.9 or higher.")
|
||||
print("Please upgrade to Python 3.10 or higher.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@@ -92,11 +92,10 @@ setup(
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
],
|
||||
python_requires=">=3.9",
|
||||
python_requires=">=3.10",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user