Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ first_value = 1

[bumpversion:part:nightly]

[bumpversion:file:core/setup.py]

[bumpversion:file:core/dbt/version.py]
[bumpversion:file:core/pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20251029-133450.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Move from setup.py to pyproject.toml
time: 2025-10-29T13:34:50.106244-04:00
custom:
Author: emmyoop
Issue: "5696"
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Each adapter plugin is a standalone python package that includes:

- `dbt/include/[name]`: A "sub-global" dbt project, of YAML and SQL files, that reimplements Jinja macros to use the adapter's supported SQL syntax
- `dbt/adapters/[name]`: Python modules that inherit, and optionally reimplement, the base adapter classes defined in dbt-core
- `setup.py`
- `pyproject.toml`

The Postgres adapter code is the most central, and many of its implementations are used as the default defined in the dbt-core global project. The greater the distance of a data technology from Postgres, the more its adapter plugin may need to reimplement.

Expand Down
21 changes: 20 additions & 1 deletion core/dbt/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import importlib.util
import json
import os
import re
from importlib import metadata as importlib_metadata
from pathlib import Path
from typing import Iterator, List, Optional, Tuple

import requests
Expand Down Expand Up @@ -226,5 +229,21 @@ def _get_adapter_plugin_names() -> Iterator[str]:
yield plugin_name


__version__ = "1.11.0b4"
def _resolve_version() -> str:
try:
return importlib_metadata.version("dbt-core")
except importlib_metadata.PackageNotFoundError:
pyproject_path = Path(__file__).resolve().parents[1] / "pyproject.toml"
if not pyproject_path.exists():
raise RuntimeError("Unable to locate pyproject.toml to determine dbt-core version")

text = pyproject_path.read_text(encoding="utf-8")
match = re.search(r'^version\s*=\s*"(?P<version>[^"]+)"', text, re.MULTILINE)
if match:
return match.group("version")

raise RuntimeError("Unable to determine dbt-core version from pyproject.toml")


__version__ = _resolve_version()
installed = get_installed_version()
110 changes: 110 additions & 0 deletions core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[tool.setuptools]
package-dir = {"" = "."}
include-package-data = true
zip-safe = false

[tool.setuptools.packages.find]
where = ["."]
include = [
"dbt",
"dbt.*",
]

# this needs to match MANIFEST.in for the wheels
[tool.setuptools.package-data]
"dbt" = [
"include/**/*.py",
"include/**/*.sql",
"include/**/*.yml",
"include/**/*.html",
"include/**/*.md",
"include/**/.gitkeep",
"include/**/.gitignore",
"task/docs/**/*.html",
"jsonschemas/**/*.json",
"py.typed",
]

[project]
name = "dbt-core"
version = "1.11.0b4"
description = "With dbt, data analysts and engineers can build analytics the way engineers build applications."
readme = "README.md"
requires-python = ">=3.10"
license = "Apache-2.0"
license-files = ["License.md"] # License.md copied to core/ by build script even though it lives at the root by convention
keywords = []
authors = [
{ name = "dbt Labs", email = "info@dbtlabs.com" },
]
maintainers = [
{ name = "dbt Labs", email = "info@dbtlabs.com" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
# ----
# dbt-core uses these packages deeply, throughout the codebase, and there have been breaking changes in past patch releases (even though these are major-version-one).
# Pin to the patch or minor version, and bump in each new minor version of dbt-core.
"agate>=1.7.0,<1.10",
"Jinja2>=3.1.3,<4",
"mashumaro[msgpack]>=3.9,<3.15",
# ----
# dbt-core uses these packages in standard ways. Pin to the major version, and check compatibility
# with major versions in each new minor version of dbt-core.
"click>=8.0.2,<9.0",
"jsonschema>=4.19.1,<5.0",
"networkx>=2.3,<4.0",
"protobuf>=6.0,<7.0",
"requests<3.0.0", # should match dbt-common
"snowplow-tracker>=1.0.2,<2.0",
# ----
# These packages are major-version-0. Keep upper bounds on upcoming minor versions (which could have breaking changes)
# and check compatibility / bump in each new minor version of dbt-core.
"pathspec>=0.9,<0.13",
"sqlparse>=0.5.0,<0.6.0",
# ----
# These are major-version-0 packages also maintained by dbt-labs.
# Accept patches but avoid automatically updating past a set minor version range.
"dbt-extractor>=0.5.0,<=0.6",
"dbt-semantic-interfaces>=0.9.0,<0.10",
# Minor versions for these are expected to be backwards-compatible
"dbt-common>=1.27.0,<2.0",
"dbt-adapters>=1.15.5,<2.0",
"dbt-protos>=1.0.375,<2.0",
"pydantic<3",
# ----
# Expect compatibility with all new versions of these packages, so lower bounds only.
"packaging>20.9",
"pytz>=2015.7",
"pyyaml>=6.0",
"daff>=1.3.46",
"typing-extensions>=4.4",
]

[project.urls]
Homepage = "https://github.com/dbt-labs/dbt-core"
Repository = "https://github.com/dbt-labs/dbt-core.git"
Issues = "https://github.com/dbt-labs/dbt-core/issues"
Changelog = "https://github.com/dbt-labs/dbt-core/blob/main/CHANGELOG.md"

[project.scripts]
dbt = "dbt.cli.main:cli"

[build-system]
requires = [
"setuptools>=61",
"wheel",
]
build-backend = "setuptools.build_meta"
117 changes: 21 additions & 96 deletions core/setup.py
Original file line number Diff line number Diff line change
@@ -1,101 +1,26 @@
#!/usr/bin/env python
import os
import sys

if sys.version_info < (3, 10):
print("Error: dbt does not support this version of Python.")
print("Please upgrade to Python 3.10 or higher.")
sys.exit(1)

"""Legacy setuptools shim retained for compatibility with existing workflows. Will be removed in a future version."""

from setuptools import setup

try:
from setuptools import find_namespace_packages
except ImportError:
# the user has a downlevel version of setuptools.
print("Error: dbt requires setuptools v40.1.0 or higher.")
print('Please upgrade setuptools with "pip install --upgrade setuptools" ' "and try again")
sys.exit(1)


this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, "README.md")) as f:
long_description = f.read()


package_name = "dbt-core"
package_version = "1.11.0b4"
description = """With dbt, data analysts and engineers can build analytics \
the way engineers build applications."""


setup(
name=package_name,
version=package_version,
description=description,
long_description=long_description,
long_description_content_type="text/markdown",
author="dbt Labs",
author_email="info@dbtlabs.com",
url="https://github.com/dbt-labs/dbt-core",
packages=find_namespace_packages(include=["dbt", "dbt.*"]),
include_package_data=True,
test_suite="test",
entry_points={
"console_scripts": ["dbt = dbt.cli.main:cli"],
},
install_requires=[
# ----
# dbt-core uses these packages deeply, throughout the codebase, and there have been breaking changes in past patch releases (even though these are major-version-one).
# Pin to the patch or minor version, and bump in each new minor version of dbt-core.
"agate>=1.7.0,<1.10",
"Jinja2>=3.1.3,<4",
"mashumaro[msgpack]>=3.9,<3.15",
# ----
# dbt-core uses these packages in standard ways. Pin to the major version, and check compatibility
# with major versions in each new minor version of dbt-core.
"click>=8.0.2,<9.0",
"jsonschema>=4.19.1,<5.0",
"networkx>=2.3,<4.0",
"protobuf>=6.0,<7.0",
"requests<3.0.0", # should match dbt-common
"snowplow-tracker>=1.0.2,<2.0",
# ----
# These packages are major-version-0. Keep upper bounds on upcoming minor versions (which could have breaking changes)
# and check compatibility / bump in each new minor version of dbt-core.
"pathspec>=0.9,<0.13",
"sqlparse>=0.5.0,<0.6.0",
# ----
# These are major-version-0 packages also maintained by dbt-labs.
# Accept patches but avoid automatically updating past a set minor version range.
"dbt-extractor>=0.5.0,<=0.6",
"dbt-semantic-interfaces>=0.9.0,<0.10",
# Minor versions for these are expected to be backwards-compatible
"dbt-common>=1.27.0,<2.0",
"dbt-adapters>=1.15.5,<2.0",
"dbt-protos>=1.0.375,<2.0",
"pydantic<3",
# ----
# Expect compatibility with all new versions of these packages, so lower bounds only.
"packaging>20.9",
"pytz>=2015.7",
"pyyaml>=6.0",
"daff>=1.3.46",
"typing-extensions>=4.4",
# ----
],
zip_safe=False,
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
python_requires=">=3.10",
)
# the user has a downlevel version of setuptools.
# ----
# dbt-core uses these packages deeply, throughout the codebase, and there have been breaking changes in past patch releases (even though these are major-version-one).
# Pin to the patch or minor version, and bump in each new minor version of dbt-core.
# ----
# dbt-core uses these packages in standard ways. Pin to the major version, and check compatibility
# with major versions in each new minor version of dbt-core.
# ----
# These packages are major-version-0. Keep upper bounds on upcoming minor versions (which could have breaking changes)
# and check compatibility / bump in each new minor version of dbt-core.
# ----
# These are major-version-0 packages also maintained by dbt-labs.
# Accept patches but avoid automatically updating past a set minor version range.
# Minor versions for these are expected to be backwards-compatible
# ----
# Expect compatibility with all new versions of these packages, so lower bounds only.
# ----

if __name__ == "__main__":
setup()
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Root-level pyproject.toml for tool configurations
# Packaging configuration is in core/pyproject.toml
# This file exists so tools like mypy and black can find their config when run from root

[tool.mypy]
# TODO: widen range of files as we fix issues
files = 'core/dbt'
Expand Down
15 changes: 11 additions & 4 deletions scripts/build-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ set -x

rm -rf "$DBT_PATH"/dist
rm -rf "$DBT_PATH"/build
rm -rf "$DBT_PATH"/core/dist
rm -rf "$DBT_PATH"/core/build

mkdir -p "$DBT_PATH"/dist

rm -rf "$DBT_PATH"/core/dist
rm -rf "$DBT_PATH"core/build
# Copy License.md to core/ for inclusion in distribution (required by Apache 2.0)
# The license-files in pyproject.toml references it relative to core/
cp "$DBT_PATH"/License.md "$DBT_PATH"/core/License.md

cd "$DBT_PATH"/core
$PYTHON_BIN setup.py sdist bdist_wheel
cp -r "$DBT_PATH"/"core"/dist/* "$DBT_PATH"/dist/
$PYTHON_BIN -m pip install --upgrade build
$PYTHON_BIN -m build --outdir "$DBT_PATH/dist"

# Clean up License.md that was copied to core/ for build
rm -f "$DBT_PATH/core/License.md"

set +x
8 changes: 5 additions & 3 deletions scripts/update_dev_packages.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/bash -e
set -e

# this is used in dbt-common for CI

repo=$1
ref=$2
target_req_file="dev-requirements.txt"

req_sed_pattern="s|${repo}.git@main|${repo}.git@${ref}|g"
if [[ "$OSTYPE" == darwin* ]]; then
# mac ships with a different version of sed that requires a delimiter arg
sed -i "" "$req_sed_pattern" $target_req_file
# mac ships with a different version of sed that requires a delimiter arg
sed -i "" "$req_sed_pattern" "$target_req_file"
else
sed -i "$req_sed_pattern" $target_req_file
sed -i "$req_sed_pattern" "$target_req_file"
fi
Loading