Skip to content

Commit 6d6f2fb

Browse files
Merge branch 'main' into fix-DuckDBPyRelation.aggregate-incorrect-typing
2 parents b845b35 + 14a86f5 commit 6d6f2fb

21 files changed

Lines changed: 235 additions & 568 deletions
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Create or Label Mirror Issue
2+
on:
3+
discussion:
4+
types:
5+
- labeled
6+
issues:
7+
types:
8+
- labeled
9+
10+
env:
11+
GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }}
12+
TITLE_PREFIX: "[duckdb-python/#${{ github.event.issue.number || github.event.discussion.number }}]"
13+
PUBLIC_ISSUE_TITLE: ${{ github.event.issue.title }}
14+
15+
jobs:
16+
add_needs_reproducible_example_comment:
17+
if: github.event.label.name == 'needs reproducible example'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Add comment
21+
run: |
22+
cat > needs-reproducible-example-comment.md << EOF
23+
Thanks for opening this issue in the DuckDB-Python project's issue tracker! To resolve this issue, our team needs a reproducible example. This includes:
24+
25+
* A source code snippet which reproduces the issue.
26+
* The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid \`/Users/JohnDoe/...\`).
27+
* A lot of issues can be reproduced with plain SQL code executed in the [DuckDB command line client](https://duckdb.org/docs/api/cli/overview). For such issues, please open an issue in the [main DuckDB repository](https://github.com/duckdb/duckdb/).
28+
* If the script needs additional data, please share the data as a CSV, JSON, or Parquet file. Unfortunately, we cannot fix issues that can only be reproduced with a confidential data set. [Support contracts](https://duckdblabs.com/#support) allow sharing confidential data with the core DuckDB team under NDA.
29+
30+
For more detailed guidelines on how to create reproducible examples, please visit Stack Overflow's [“Minimal, Reproducible Example”](https://stackoverflow.com/help/minimal-reproducible-example) page.
31+
EOF
32+
gh issue comment --repo duckdb/duckdb-python ${{ github.event.issue.number || github.event.discussion.number }} --body-file needs-reproducible-example-comment.md
33+
34+
create_or_label_mirror_issue:
35+
if: github.event.label.name == 'reproduced' || github.event.label.name == 'under review'
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Remove 'needs triage' / 'under review' if 'reproduced'
39+
if: github.event.label.name == 'reproduced'
40+
run: |
41+
gh issue edit --repo duckdb/duckdb-python ${{ github.event.issue.number || github.event.discussion.number }} --remove-label "needs triage" --remove-label "under review" --remove-label "needs reproducible example"
42+
43+
- name: Remove 'needs triage' / 'reproduced' if 'under review'
44+
if: github.event.label.name == 'under review'
45+
run: |
46+
gh issue edit --repo duckdb/duckdb-python ${{ github.event.issue.number || github.event.discussion.number }} --remove-label "needs triage" --remove-label "reproduced"
47+
48+
- name: Remove 'needs triage' if 'expected behavior'
49+
if: github.event.label.name == 'expected behavior'
50+
run: |
51+
gh issue edit --repo duckdb/duckdb-python ${{ github.event.issue.number || github.event.discussion.number }} --remove-label "needs triage"
52+
53+
- name: Get mirror issue number
54+
run: |
55+
gh issue list --repo duckdblabs/duckdb-internal --search "${TITLE_PREFIX}" --json title,number --state all --jq ".[] | select(.title | startswith(\"$TITLE_PREFIX\")).number" > mirror_issue_number.txt
56+
echo "MIRROR_ISSUE_NUMBER=$(cat mirror_issue_number.txt)" >> $GITHUB_ENV
57+
58+
- name: Print whether mirror issue exists
59+
run: |
60+
if [ "$MIRROR_ISSUE_NUMBER" == "" ]; then
61+
echo "Mirror issue with title prefix '$TITLE_PREFIX' does not exist yet"
62+
else
63+
echo "Mirror issue with title prefix '$TITLE_PREFIX' exists with number $MIRROR_ISSUE_NUMBER"
64+
fi
65+
66+
- name: Set label environment variable
67+
run: |
68+
if ${{ github.event.label.name == 'reproduced' }}; then
69+
echo "LABEL=reproduced" >> $GITHUB_ENV
70+
echo "UNLABEL=under review" >> $GITHUB_ENV
71+
else
72+
echo "LABEL=under review" >> $GITHUB_ENV
73+
echo "UNLABEL=reproduced" >> $GITHUB_ENV
74+
fi
75+
76+
- name: Create or label issue
77+
run: |
78+
if [ "$MIRROR_ISSUE_NUMBER" == "" ]; then
79+
gh issue create --repo duckdblabs/duckdb-internal --label "$LABEL" --label "Python" --title "$TITLE_PREFIX - $PUBLIC_ISSUE_TITLE" --body "See https://github.com/duckdb/duckdb-python/issues/${{ github.event.issue.number || github.event.discussion.number }}"
80+
else
81+
gh issue edit --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --remove-label "$UNLABEL" --add-label "$LABEL"
82+
fi
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Update Mirror Issue
2+
on:
3+
discussion:
4+
types:
5+
- labeled
6+
issues:
7+
types:
8+
- closed
9+
- reopened
10+
11+
env:
12+
GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }}
13+
TITLE_PREFIX: "[duckdb-python/#${{ github.event.issue.number || github.event.discussion.number }}]"
14+
15+
jobs:
16+
update_mirror_issue:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Get mirror issue number
20+
run: |
21+
gh issue list --repo duckdblabs/duckdb-internal --search "${TITLE_PREFIX}" --json title,number --state all --jq ".[] | select(.title | startswith(\"$TITLE_PREFIX\")).number" > mirror_issue_number.txt
22+
echo "MIRROR_ISSUE_NUMBER=$(cat mirror_issue_number.txt)" >> $GITHUB_ENV
23+
24+
- name: Print whether mirror issue exists
25+
run: |
26+
if [ "$MIRROR_ISSUE_NUMBER" == "" ]; then
27+
echo "Mirror issue with title prefix '$TITLE_PREFIX' does not exist yet"
28+
else
29+
echo "Mirror issue with title prefix '$TITLE_PREFIX' exists with number $MIRROR_ISSUE_NUMBER"
30+
fi
31+
32+
- name: Add comment with status to mirror issue
33+
run: |
34+
if [ "$MIRROR_ISSUE_NUMBER" != "" ]; then
35+
gh issue comment --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --body "The issue has been ${{ github.event.action }} (https://github.com/duckdb/duckdb-python/issues/${{ github.event.issue.number || github.event.discussion.number }})."
36+
fi
37+
38+
- name: Add closed label to mirror issue
39+
if: github.event.action == 'closed'
40+
run: |
41+
if [ "$MIRROR_ISSUE_NUMBER" != "" ]; then
42+
gh issue edit --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --add-label "public closed" --remove-label "public reopened"
43+
fi
44+
45+
- name: Reopen mirror issue and add reopened label
46+
if: github.event.action == 'reopened'
47+
run: |
48+
if [ "$MIRROR_ISSUE_NUMBER" != "" ]; then
49+
gh issue reopen --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER
50+
gh issue edit --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --add-label "public reopened" --remove-label "public closed"
51+
fi

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ project(duckdb_py LANGUAGES CXX)
66
set(CMAKE_CXX_STANDARD 11)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
88
set(CMAKE_CXX_EXTENSIONS OFF)
9+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
910

1011
# Set the library name
1112
set(DUCKDB_PYTHON_LIB_NAME "_duckdb")
@@ -78,6 +79,7 @@ pybind11_add_module(
7879
$<TARGET_OBJECTS:python_type>)
7980
# add _duckdb_dependencies
8081
target_link_libraries(_duckdb PRIVATE _duckdb_dependencies)
82+
duckdb_link_extensions(_duckdb)
8183

8284
# ────────────────────────────────────────────
8385
# Controlling symbol export

cmake/duckdb_loader.cmake

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# debugging but will never allow jemalloc in a release build if not on Linux.
88
#
99
# Usage: include(cmake/duckdb_loader.cmake) # Optionally load extensions
10-
# set(CORE_EXTENSIONS "json;parquet;icu")
10+
# set(BUILD_EXTENSIONS "json;parquet;icu")
1111
#
1212
# # set sensible defaults for a debug build: duckdb_configure_for_debug()
1313
#
@@ -35,7 +35,7 @@ _duckdb_set_default(DUCKDB_SOURCE_PATH
3535
"${CMAKE_CURRENT_SOURCE_DIR}/external/duckdb")
3636

3737
# Extension list - commonly used extensions for Python
38-
_duckdb_set_default(CORE_EXTENSIONS "core_functions;parquet;icu;json")
38+
_duckdb_set_default(BUILD_EXTENSIONS "core_functions;parquet;icu;json")
3939

4040
# Core build options - disable unnecessary components for Python builds
4141
_duckdb_set_default(BUILD_SHELL OFF)
@@ -64,8 +64,8 @@ _duckdb_set_default(DEBUG_STACKTRACE OFF)
6464
set(DUCKDB_SOURCE_PATH
6565
"${DUCKDB_SOURCE_PATH}"
6666
CACHE PATH "Path to DuckDB source directory")
67-
set(CORE_EXTENSIONS
68-
"${CORE_EXTENSIONS}"
67+
set(BUILD_EXTENSIONS
68+
"${BUILD_EXTENSIONS}"
6969
CACHE STRING "Semicolon-separated list of extensions to enable")
7070
set(BUILD_SHELL
7171
"${BUILD_SHELL}"
@@ -110,40 +110,32 @@ set(DEBUG_STACKTRACE
110110

111111
function(_duckdb_validate_jemalloc_config)
112112
# Check if jemalloc is in the extension list
113-
if(NOT CORE_EXTENSIONS MATCHES "jemalloc")
113+
if(NOT BUILD_EXTENSIONS MATCHES "jemalloc")
114114
return()
115115
endif()
116116

117-
# If we're on Linux then using jemalloc is fine, otherwise we only allow it in
118-
# debug builds
119-
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
120-
set(is_debug_build FALSE)
121-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
122-
set(is_debug_build TRUE)
123-
endif()
124-
if(is_debug_build)
125-
message(
126-
WARNING
127-
"jemalloc extension enabled on ${CMAKE_SYSTEM_NAME} in Debug build.\n"
128-
"This is only recommended for debugging purposes.\n"
129-
"jemalloc is officially supported only on Linux.")
130-
else()
131-
message(
132-
WARNING
133-
"jemalloc extension is only supported on ${CMAKE_SYSTEM_NAME} in Debug builds.\n"
134-
"Removing jemalloc from extension list.\n"
135-
"In non-debug builds, jemalloc is only supported on Linux.")
136-
# Remove jemalloc from the extension list
137-
string(REPLACE "jemalloc" "" CORE_EXTENSIONS_FILTERED
138-
"${CORE_EXTENSIONS}")
139-
string(REGEX REPLACE ";+" ";" CORE_EXTENSIONS_FILTERED
140-
"${CORE_EXTENSIONS_FILTERED}")
141-
string(REGEX REPLACE "^;|;$" "" CORE_EXTENSIONS_FILTERED
142-
"${CORE_EXTENSIONS_FILTERED}")
143-
set(CORE_EXTENSIONS
144-
"${CORE_EXTENSIONS_FILTERED}"
145-
PARENT_SCOPE)
146-
endif()
117+
# jemalloc is only enabled on 64bit x86 linux builds
118+
if(CMAKE_SIZEOF_VOID_P EQUAL 8
119+
AND CMAKE_SYSTEM_NAME STREQUAL "Linux"
120+
AND NOT BSD)
121+
set(jemalloc_allowed TRUE)
122+
else()
123+
set(jemalloc_allowed FALSE)
124+
endif()
125+
126+
if(NOT jemalloc_allowed)
127+
message(WARNING "jemalloc extension is only supported on Linux.\n"
128+
"Removing jemalloc from extension list.")
129+
# Remove jemalloc from the extension list
130+
string(REPLACE "jemalloc" "" BUILD_EXTENSIONS_FILTERED
131+
"${BUILD_EXTENSIONS}")
132+
string(REGEX REPLACE ";+" ";" BUILD_EXTENSIONS_FILTERED
133+
"${BUILD_EXTENSIONS_FILTERED}")
134+
string(REGEX REPLACE "^;|;$" "" BUILD_EXTENSIONS_FILTERED
135+
"${BUILD_EXTENSIONS_FILTERED}")
136+
set(BUILD_EXTENSIONS
137+
"${BUILD_EXTENSIONS_FILTERED}"
138+
PARENT_SCOPE)
147139
endif()
148140
endfunction()
149141

@@ -188,19 +180,17 @@ function(_duckdb_create_interface_target target_name)
188180
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
189181
target_compile_options(
190182
${target_name}
191-
INTERFACE
192-
/wd4244 # suppress Conversion from 'type1' to 'type2', possible loss of
193-
# data
194-
/wd4267 # suppress Conversion from ‘size_t’ to ‘type’, possible loss of
195-
# data
196-
/wd4200 # suppress Nonstandard extension used: zero-sized array in
197-
# struct/union
198-
/wd26451
199-
/wd26495 # suppress Code Analysis
200-
/D_CRT_SECURE_NO_WARNINGS # suppress warnings about unsafe functions
201-
/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR # see
202-
# https://github.com/duckdblabs/duckdb-internal/issues/5151
203-
/utf-8 # treat source files as UTF-8 encoded
183+
INTERFACE /wd4244 # suppress Conversion from 'type1' to 'type2', possible
184+
# loss of data
185+
/wd4267 # suppress Conversion from ‘size_t’ to ‘type’, possible
186+
# loss of data
187+
/wd4200 # suppress Nonstandard extension used: zero-sized array
188+
# in struct/union
189+
/wd26451
190+
/wd26495 # suppress Code Analysis
191+
/D_CRT_SECURE_NO_WARNINGS # suppress warnings about unsafe
192+
# functions
193+
/utf-8 # treat source files as UTF-8 encoded
204194
)
205195
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
206196
target_compile_options(
@@ -225,10 +215,6 @@ function(_duckdb_print_summary)
225215
message(STATUS " Native Arch: ${NATIVE_ARCH}")
226216
message(STATUS " Unity Build Disabled: ${DISABLE_UNITY}")
227217

228-
if(CORE_EXTENSIONS)
229-
message(STATUS " Extensions: ${CORE_EXTENSIONS}")
230-
endif()
231-
232218
set(debug_opts)
233219
if(FORCE_ASSERT)
234220
list(APPEND debug_opts "FORCE_ASSERT")
@@ -256,6 +242,26 @@ function(duckdb_add_library target_name)
256242

257243
# Create clean interface target
258244
_duckdb_create_interface_target(${target_name})
245+
246+
# Propagate BUILD_EXTENSIONS back to caller scope in case it was modified
247+
set(BUILD_EXTENSIONS
248+
"${BUILD_EXTENSIONS}"
249+
PARENT_SCOPE)
250+
endfunction()
251+
252+
function(duckdb_link_extensions target_name)
253+
# Link to the DuckDB static library and extensions
254+
target_link_libraries(${target_name}
255+
PRIVATE duckdb_generated_extension_loader)
256+
if(BUILD_EXTENSIONS)
257+
message(STATUS "Linking DuckDB extensions:")
258+
foreach(ext IN LISTS BUILD_EXTENSIONS)
259+
message(STATUS "- ${ext}")
260+
target_link_libraries(${target_name} PRIVATE ${ext}_extension)
261+
endforeach()
262+
else()
263+
message(STATUS "No DuckDB extensions linked in")
264+
endif()
259265
endfunction()
260266

261267
# ════════════════════════════════════════════════════════════════════════════════

duckdb_packaging/setuptools_scm_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ._versioning import format_version, parse_version
1313

1414
# MAIN_BRANCH_VERSIONING should be 'True' on main branch only
15-
MAIN_BRANCH_VERSIONING = False
15+
MAIN_BRANCH_VERSIONING = True
1616

1717
SCM_PRETEND_ENV_VAR = "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DUCKDB"
1818
SCM_GLOBAL_PRETEND_ENV_VAR = "SETUPTOOLS_SCM_PRETEND_VERSION"

external/duckdb

Submodule duckdb updated 2980 files

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ packages.adbc_driver_duckdb = "adbc_driver_duckdb"
8282
packages._duckdb-stubs = "_duckdb-stubs"
8383

8484
[tool.scikit-build.cmake.define]
85-
CORE_EXTENSIONS = "core_functions;json;parquet;icu;jemalloc"
85+
BUILD_EXTENSIONS = "core_functions;json;parquet;icu;jemalloc"
8686

8787
[tool.setuptools_scm]
8888
version_scheme = "duckdb_packaging.setuptools_scm_version:version_scheme"

sqllogic/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)