Skip to content

Commit 9e00936

Browse files
Merge branch 'v1.4-andium' into reset_pyerr_before_throwing
2 parents 4086efe + c96b325 commit 9e00936

File tree

326 files changed

+11529
-11227
lines changed

Some content is hidden

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

326 files changed

+11529
-11227
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 and formatting
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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.13.0
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: v18.1.8 # 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: local
23+
hooks:
24+
- id: post-checkout-submodules
25+
name: Update submodule post-checkout
26+
entry: .githooks/post-checkout
27+
language: script
28+
stages: [ post-checkout ]

CMakeLists.txt

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,50 +48,53 @@ 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

8382
# ────────────────────────────────────────────
8483
# Put the object file in the correct place
8584
# ────────────────────────────────────────────
8685

87-
# If we're not building through scikit-build-core then we have to set a different dest dir
86+
# If we're not building through scikit-build-core then we have to set a
87+
# different dest dir
8888
include(GNUInstallDirs)
8989
if(DEFINED SKBUILD_PLATLIB_DIR)
9090
set(_DUCKDB_PY_INSTALL_DIR "${SKBUILD_PLATLIB_DIR}")
9191
elseif(DEFINED Python_SITEARCH)
9292
set(_DUCKDB_PY_INSTALL_DIR "${Python_SITEARCH}")
9393
else()
94-
message(WARNING "Could not determine Python install dir. Falling back to CMAKE_INSTALL_LIBDIR.")
94+
message(
95+
WARNING
96+
"Could not determine Python install dir. Falling back to CMAKE_INSTALL_LIBDIR."
97+
)
9598
set(_DUCKDB_PY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
9699
endif()
97100

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,22 @@ git fetch --all
6666

6767
### Submodule update hook
6868

69-
If you'll be switching between branches that are have the submodule set to different refs, then make your life
70-
easier and add the git hooks in the .githooks directory to your local config:
69+
If you'll be switching between branches that are have the submodule set to different refs, then make your life
70+
easier and add the git hooks in the .githooks directory to your git hooks:
7171
```shell
72-
git config --local core.hooksPath .githooks/
72+
cp .githooks/post-checkout .git/hooks/
7373
```
7474

7575

7676
### Editable installs (general)
7777

7878
It's good to be aware of the following when performing an editable install:
79-
- `uv sync` or `uv run [tool]` perform an editable install by default. We have
80-
configured the project so that scikit-build-core will use a persistent build-dir, but since the build itself
81-
happens in an isolated, ephemeral environment, cmake's paths will point to non-existing directories. CMake itself
79+
- `uv sync` or `uv run [tool]` perform an editable install by default. We have
80+
configured the project so that scikit-build-core will use a persistent build-dir, but since the build itself
81+
happens in an isolated, ephemeral environment, cmake's paths will point to non-existing directories. CMake itself
8282
will be missing.
83-
- You should install all development dependencies, and then build the project without build isolation, in two separate
84-
steps. After this you can happily keep building and running, as long as you don't forget to pass in the
83+
- You should install all development dependencies, and then build the project without build isolation, in two separate
84+
steps. After this you can happily keep building and running, as long as you don't forget to pass in the
8585
`--no-build-isolation` flag.
8686

8787
```bash
@@ -93,9 +93,9 @@ uv sync --no-build-isolation
9393

9494
### Editable installs (IDEs)
9595

96-
If you're using an IDE then life is a little simpler. You install build dependencies and the project in the two
97-
steps outlined above, and from that point on you can rely on e.g. CLion's cmake capabilities to do incremental
98-
compilation and editable rebuilds. This will skip scikit-build-core's build backend and all of uv's dependency
96+
If you're using an IDE then life is a little simpler. You install build dependencies and the project in the two
97+
steps outlined above, and from that point on you can rely on e.g. CLion's cmake capabilities to do incremental
98+
compilation and editable rebuilds. This will skip scikit-build-core's build backend and all of uv's dependency
9999
management, so for "real" builds you better revert to the CLI. However, this should work fine for coding and debugging.
100100

101101

@@ -139,7 +139,7 @@ uv run --no-build-isolation pytest ./tests --verbose --ignore=./tests/slow
139139
COVERAGE=1 uv run --no-build-isolation coverage run -m pytest ./tests --verbose
140140
```
141141

142-
The `COVERAGE` env var will compile the extension with `--coverage`, allowing us to collect coverage stats of C++
142+
The `COVERAGE` env var will compile the extension with `--coverage`, allowing us to collect coverage stats of C++
143143
code as well as Python code.
144144

145145
Check coverage for Python code:
@@ -148,7 +148,7 @@ uvx coverage html -d htmlcov-python
148148
uvx coverage report --format=markdown
149149
```
150150

151-
Check coverage for C++ code (note: this will clutter your project dir with html files, consider saving them in some
151+
Check coverage for C++ code (note: this will clutter your project dir with html files, consider saving them in some
152152
other place):
153153
```bash
154154
uvx gcovr \
@@ -275,7 +275,7 @@ versioning scheme.
275275
```toml
276276
[tool.scikit-build]
277277
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
278-
278+
279279
[tool.setuptools_scm]
280280
version_scheme = "duckdb_packaging._setuptools_scm_version:version_scheme"
281281
```

adbc_driver_duckdb/dbapi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
"""
19-
DBAPI 2.0-compatible facade for the ADBC DuckDB driver.
20-
"""
18+
"""DBAPI 2.0-compatible facade for the ADBC DuckDB driver."""
2119

2220
import typing
2321

2422
import adbc_driver_manager
2523
import adbc_driver_manager.dbapi
24+
2625
import adbc_driver_duckdb
2726

2827
__all__ = [

cmake/compiler_launcher.cmake

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,25 @@ include(CMakeParseArguments)
88
# Function to look for ccache and sccache to speed up builds, if available
99
# ────────────────────────────────────────────
1010
function(setup_compiler_launcher_if_available)
11-
if(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER AND NOT DEFINED ENV{CMAKE_C_COMPILER_LAUNCHER})
12-
find_program(COMPILER_LAUNCHER NAMES ccache sccache)
13-
if(COMPILER_LAUNCHER)
14-
message(STATUS "Using ${COMPILER_LAUNCHER} as C compiler launcher")
15-
set(CMAKE_C_COMPILER_LAUNCHER "${COMPILER_LAUNCHER}" CACHE STRING "" FORCE)
16-
endif()
11+
if(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER AND NOT DEFINED
12+
ENV{CMAKE_C_COMPILER_LAUNCHER})
13+
find_program(COMPILER_LAUNCHER NAMES ccache sccache)
14+
if(COMPILER_LAUNCHER)
15+
message(STATUS "Using ${COMPILER_LAUNCHER} as C compiler launcher")
16+
set(CMAKE_C_COMPILER_LAUNCHER
17+
"${COMPILER_LAUNCHER}"
18+
CACHE STRING "" FORCE)
1719
endif()
20+
endif()
1821

19-
if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER AND NOT DEFINED ENV{CMAKE_CXX_COMPILER_LAUNCHER})
20-
find_program(COMPILER_LAUNCHER NAMES ccache sccache)
21-
if(COMPILER_LAUNCHER)
22-
message(STATUS "Using ${COMPILER_LAUNCHER} as C++ compiler launcher")
23-
set(CMAKE_CXX_COMPILER_LAUNCHER "${COMPILER_LAUNCHER}" CACHE STRING "" FORCE)
24-
endif()
22+
if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER
23+
AND NOT DEFINED ENV{CMAKE_CXX_COMPILER_LAUNCHER})
24+
find_program(COMPILER_LAUNCHER NAMES ccache sccache)
25+
if(COMPILER_LAUNCHER)
26+
message(STATUS "Using ${COMPILER_LAUNCHER} as C++ compiler launcher")
27+
set(CMAKE_CXX_COMPILER_LAUNCHER
28+
"${COMPILER_LAUNCHER}"
29+
CACHE STRING "" FORCE)
2530
endif()
31+
endif()
2632
endfunction()

0 commit comments

Comments
 (0)