Skip to content

Commit 8c6767a

Browse files
Merge branch 'v1.4-andium' (#109)
This pulls in almost all bugfix work that was done since 1.4.0. It's way too big, but this is where we are. Hopefully things slow down on v.1.4-andium after this.
2 parents b494d1c + 1fb5fe3 commit 8c6767a

File tree

351 files changed

+13640
-12471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

351 files changed

+13640
-12471
lines changed

.github/workflows/code_quality.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Code Quality Checks
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
git_ref:
6+
type: string
7+
description: Git ref of the DuckDB python package
8+
required: false
9+
workflow_call:
10+
inputs:
11+
git_ref:
12+
type: string
13+
description: Git ref of the DuckDB python package
14+
required: false
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
jobs:
21+
run_checks:
22+
name: Run linting, formatting and static type checker
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
ref: ${{ inputs.git_ref }}
28+
fetch-depth: 0
29+
persist-credentials: false
30+
31+
- name: Install Astral UV
32+
uses: astral-sh/setup-uv@v6
33+
with:
34+
version: "0.7.14"
35+
python-version: 3.9
36+
37+
- name: pre-commit (cache)
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.cache/pre-commit
41+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
42+
43+
- name: pre-commit (--all-files)
44+
run: |
45+
uvx pre-commit run --show-diff-on-failure --color=always --all-files

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,4 @@ jobs:
151151
echo "### C++ Coverage Summary" >> $GITHUB_STEP_SUMMARY
152152
echo '```' >> $GITHUB_STEP_SUMMARY
153153
echo "$SUMMARY_CPP" >> $GITHUB_STEP_SUMMARY
154-
echo '```' >> $GITHUB_STEP_SUMMARY
154+
echo '```' >> $GITHUB_STEP_SUMMARY

.github/workflows/on_pr.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ jobs:
2323
name: Make sure submodule is in a sane state
2424
uses: ./.github/workflows/submodule_sanity.yml
2525

26+
code_quality:
27+
name: Code-quality checks
28+
needs: submodule_sanity_guard
29+
uses: ./.github/workflows/code_quality.yml
30+
2631
packaging_test:
2732
name: Build a minimal set of packages and run all tests on them
28-
needs: submodule_sanity_guard
33+
needs: code_quality
2934
# Skip packaging tests for draft PRs
3035
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
3136
uses: ./.github/workflows/packaging.yml
@@ -36,7 +41,7 @@ jobs:
3641

3742
coverage_test:
3843
name: Run coverage tests
39-
needs: submodule_sanity_guard
44+
needs: code_quality
4045
# Only run coverage test for draft PRs
4146
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == true }}
4247
uses: ./.github/workflows/coverage.yml

.github/workflows/on_push.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21+
code_quality:
22+
name: Code-quality checks
23+
uses: ./.github/workflows/code_quality.yml
24+
2125
test:
2226
name: Run coverage tests
27+
needs: code_quality
2328
uses: ./.github/workflows/coverage.yml
2429
with:
2530
git_ref: ${{ github.ref }}

.pre-commit-config.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.13.3
5+
hooks:
6+
# Run the linter.
7+
- id: ruff-check
8+
# Run the formatter.
9+
- id: ruff-format
10+
11+
- repo: https://github.com/pre-commit/mirrors-clang-format
12+
rev: v21.1.2 # pick the version of clang-format you want
13+
hooks:
14+
- id: clang-format
15+
files: \.(c|cpp|cc|h|hpp|cxx|hxx)$
16+
17+
- repo: https://github.com/cheshirekow/cmake-format-precommit
18+
rev: v0.6.13
19+
hooks:
20+
- id: cmake-format
21+
22+
- repo: https://github.com/pre-commit/mirrors-mypy
23+
rev: v1.18.2
24+
hooks:
25+
- id: mypy
26+
entry: mypy -v
27+
files: ^(duckdb/|_duckdb-stubs/)
28+
exclude: ^duckdb/(experimental|query_graph)/
29+
additional_dependencies: [ numpy, polars ]
30+
31+
- repo: local
32+
hooks:
33+
- id: post-checkout-submodules
34+
name: Update submodule post-checkout
35+
entry: .githooks/post-checkout
36+
language: script
37+
stages: [ post-checkout ]

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Changelog
2+
3+
## v1.4.1
4+
**DuckDB Core**: v1.4.1
5+
6+
### Bug Fixes
7+
- **ADBC Driver**: Fixed ADBC driver implementation (#81)
8+
- **SQLAlchemy compatibility**: Added `__hash__` method overload (#61)
9+
- **Error Handling**: Reset PyErr before throwing Python exceptions (#69)
10+
- **Polars Lazyframes**: Fixed Polars expression pushdown (#102)
11+
12+
### Code Quality Improvements & Developer Experience
13+
- **MyPy Support**: MyPy is functional again and better integrated with the dev workflow
14+
- **Stubs**: Re-created and manually curated stubs for the binary extension
15+
- **Type Shadowing**: Deprecated `typing` and `functional` modules
16+
- **Linting & Formatting**: Comprehensive code quality improvements with Ruff
17+
- **Type Annotations**: Added missing overloads and improved type coverage
18+
- **Pre-commit Integration**: Added ruff, clang-format, cmake-format and mypy configs
19+
- **CI/CD**: Added code quality workflow

CMakeLists.txt

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,50 +48,84 @@ duckdb_add_library(duckdb_target)
4848

4949
# Bundle in INTERFACE library
5050
add_library(_duckdb_dependencies INTERFACE)
51-
target_link_libraries(_duckdb_dependencies INTERFACE
52-
pybind11::pybind11
53-
duckdb_target
54-
)
51+
target_link_libraries(_duckdb_dependencies INTERFACE pybind11::pybind11
52+
duckdb_target)
5553
# Also add include directory
56-
target_include_directories(_duckdb_dependencies INTERFACE
57-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/duckdb_py/include>
54+
target_include_directories(
55+
_duckdb_dependencies
56+
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/duckdb_py/include>
5857
)
5958

6059
# ────────────────────────────────────────────
6160
# Descend into the real DuckDB‑Python sources
6261
# ────────────────────────────────────────────
6362
add_subdirectory(src/duckdb_py)
6463

65-
pybind11_add_module(_duckdb
66-
$<TARGET_OBJECTS:python_src>
67-
$<TARGET_OBJECTS:python_arrow>
68-
$<TARGET_OBJECTS:python_common>
69-
$<TARGET_OBJECTS:python_functional>
70-
$<TARGET_OBJECTS:python_jupyter>
71-
$<TARGET_OBJECTS:python_native>
72-
$<TARGET_OBJECTS:python_numpy>
73-
$<TARGET_OBJECTS:python_pandas>
74-
$<TARGET_OBJECTS:python_pybind11>
75-
$<TARGET_OBJECTS:python_connection>
76-
$<TARGET_OBJECTS:python_expression>
77-
$<TARGET_OBJECTS:python_relation>
78-
$<TARGET_OBJECTS:python_type>
79-
)
64+
pybind11_add_module(
65+
_duckdb
66+
$<TARGET_OBJECTS:python_src>
67+
$<TARGET_OBJECTS:python_arrow>
68+
$<TARGET_OBJECTS:python_common>
69+
$<TARGET_OBJECTS:python_functional>
70+
$<TARGET_OBJECTS:python_jupyter>
71+
$<TARGET_OBJECTS:python_native>
72+
$<TARGET_OBJECTS:python_numpy>
73+
$<TARGET_OBJECTS:python_pandas>
74+
$<TARGET_OBJECTS:python_pybind11>
75+
$<TARGET_OBJECTS:python_connection>
76+
$<TARGET_OBJECTS:python_expression>
77+
$<TARGET_OBJECTS:python_relation>
78+
$<TARGET_OBJECTS:python_type>)
8079
# add _duckdb_dependencies
8180
target_link_libraries(_duckdb PRIVATE _duckdb_dependencies)
8281

82+
# ────────────────────────────────────────────
83+
# Controlling symbol export
84+
#
85+
# We want to export exactly two symbols: - PyInit__duckdb: this allows CPython
86+
# to load the module - duckdb_adbc_init: the DuckDB ADBC driver
87+
#
88+
# The export of symbols on OSX and Linux is controlled by: - Visibility
89+
# annotations in the code (for this lib we use the PYBIND11_EXPORT macro) -
90+
# Telling the linker which symbols we want exported, which we do below
91+
#
92+
# For Windows, we rely on just the visbility annotations.
93+
# ────────────────────────────────────────────
94+
set_target_properties(
95+
_duckdb
96+
PROPERTIES CXX_VISIBILITY_PRESET hidden
97+
C_VISIBILITY_PRESET hidden
98+
VISIBILITY_INLINES_HIDDEN ON)
99+
100+
if(APPLE)
101+
target_link_options(
102+
_duckdb PRIVATE "LINKER:-exported_symbol,_duckdb_adbc_init"
103+
"LINKER:-exported_symbol,_PyInit__duckdb")
104+
elseif(UNIX AND NOT APPLE)
105+
target_link_options(
106+
_duckdb PRIVATE "LINKER:--export-dynamic-symbol=duckdb_adbc_init"
107+
"LINKER:--export-dynamic-symbol=PyInit__duckdb")
108+
elseif(WIN32)
109+
target_link_options(_duckdb PRIVATE "/EXPORT:duckdb_adbc_init"
110+
"/EXPORT:PyInit__duckdb")
111+
endif()
112+
83113
# ────────────────────────────────────────────
84114
# Put the object file in the correct place
85115
# ────────────────────────────────────────────
86116

87-
# If we're not building through scikit-build-core then we have to set a different dest dir
117+
# If we're not building through scikit-build-core then we have to set a
118+
# different dest dir
88119
include(GNUInstallDirs)
89120
if(DEFINED SKBUILD_PLATLIB_DIR)
90121
set(_DUCKDB_PY_INSTALL_DIR "${SKBUILD_PLATLIB_DIR}")
91122
elseif(DEFINED Python_SITEARCH)
92123
set(_DUCKDB_PY_INSTALL_DIR "${Python_SITEARCH}")
93124
else()
94-
message(WARNING "Could not determine Python install dir. Falling back to CMAKE_INSTALL_LIBDIR.")
125+
message(
126+
WARNING
127+
"Could not determine Python install dir. Falling back to CMAKE_INSTALL_LIBDIR."
128+
)
95129
set(_DUCKDB_PY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
96130
endif()
97131

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@
1919
<a href="https://duckdb.org/docs/stable/clients/python/overview">API Docs (Python)</a>
2020
</p>
2121

22-
# The [DuckDB](https://github.com/duckdb/duckdb) Python Package
22+
# DuckDB: A Fast, In-Process, Portable, Open Source, Analytical Database System
23+
24+
* **Simple**: DuckDB is easy to install and deploy. It has zero external dependencies and runs in-process in its host application or as a single binary.
25+
* **Portable**: DuckDB runs on Linux, macOS, Windows, Android, iOS and all popular hardware architectures. It has idiomatic client APIs for major programming languages.
26+
* **Feature-rich**: DuckDB offers a rich SQL dialect. It can read and write file formats such as CSV, Parquet, and JSON, to and from the local file system and remote endpoints such as S3 buckets.
27+
* **Fast**: DuckDB runs analytical queries at blazing speed thanks to its columnar engine, which supports parallel execution and can process larger-than-memory workloads.
28+
* **Extensible**: DuckDB is extensible by third-party features such as new data types, functions, file formats and new SQL syntax. User contributions are available as community extensions.
29+
* **Free**: DuckDB and its core extensions are open-source under the permissive MIT License. The intellectual property of the project is held by the DuckDB Foundation.
2330

2431
## Installation
2532

0 commit comments

Comments
 (0)