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: 6 additions & 0 deletions .githooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
if [ "$3" = "1" ]; then
echo "Updating submodules..."
git submodule update --init --recursive
fi

2 changes: 1 addition & 1 deletion .github/workflows/on_external_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ jobs:
DUCKDB_SHA="${{ inputs.duckdb-sha }}"
aws s3 cp \
artifacts \
s3://duckdb-staging/${DUCKDB_SHA:0:7}/${{ github.repository }}/ \
s3://duckdb-staging/${DUCKDB_SHA:0:10}/${{ github.repository }}/ \
--recursive
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
path = external/duckdb
url = https://github.com/duckdb/duckdb.git
branch = main
[submodule]
recurse = true
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ setup_compiler_launcher_if_available()
# ────────────────────────────────────────────
# Create compile_commands.json for IntelliSense and clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# If we're not building through scikit-build-core then we have to set a different dest dir
include(GNUInstallDirs)
set(_DUCKDB_PY_INSTALL_DIR "${SKBUILD_PLATLIB_DIR}")
if(NOT _DUCKDB_PY_INSTALL_DIR)
set(_DUCKDB_PY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
endif()

# ────────────────────────────────────────────
# Policy hygiene
Expand Down Expand Up @@ -87,4 +81,16 @@ target_link_libraries(_duckdb PRIVATE _duckdb_dependencies)
# ────────────────────────────────────────────
# Put the object file in the correct place
# ────────────────────────────────────────────

# If we're not building through scikit-build-core then we have to set a different dest dir
include(GNUInstallDirs)
if(DEFINED SKBUILD_PLATLIB_DIR)
set(_DUCKDB_PY_INSTALL_DIR "${SKBUILD_PLATLIB_DIR}")
elseif(DEFINED Python_SITEARCH)
set(_DUCKDB_PY_INSTALL_DIR "${Python_SITEARCH}")
else()
message(WARNING "Could not determine Python install dir. Falling back to CMAKE_INSTALL_LIBDIR.")
set(_DUCKDB_PY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
endif()

install(TARGETS _duckdb LIBRARY DESTINATION "${_DUCKDB_PY_INSTALL_DIR}")
50 changes: 40 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,27 @@ pip install 'duckdb[all]'

## Development

### Building wheels and sdists
### Cloning

To build a wheel and sdist for your system and the default Python version:
```bash
uv build
````
When you clone the repo or your fork, make sure you initialize the duckdb submodule:
```shell
git clone --recurse-submodules <repo>
```

To build a wheel for a different Python version:
```bash
# E.g. for Python 3.9
uv build -p 3.9
... or, if you already have the repo locally:
```shell
git clone <your-repo>
cd <your-repo>
git submodule update --init --recursive
```

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


### Editable installs (general)

It's good to be aware of the following when creating an editable install:
Expand All @@ -72,7 +80,7 @@ uv build -p 3.9
# install all dev dependencies without building the project (needed once)
uv sync -p 3.9 --no-install-project
# build and install without build isolation
uv sync --no-build-isolation
uv sync --no-build-isolation
```

### Editable installs (IDEs)
Expand All @@ -82,6 +90,28 @@ uv sync --no-build-isolation
compilation and editable rebuilds. This will skip scikit-build-core's build backend and all of uv's dependency
management, so for "real" builds you better revert to the CLI. However, this should work fine for coding and debugging.


### Cleaning

```shell
uv cache clean
rm -rf build .venv uv.lock
```


### Building wheels and sdists

To build a wheel and sdist for your system and the default Python version:
```bash
uv build
````

To build a wheel for a different Python version:
```bash
# E.g. for Python 3.9
uv build -p 3.9
```

### Running tests

Run all pytests:
Expand Down
4 changes: 2 additions & 2 deletions duckdb_packaging/setuptools_scm_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# Import from our own versioning module to avoid duplication
from ._versioning import parse_version, format_version

# MAIN_BRANCH_VERSIONING default should be 'True' for main branch and feature branches
MAIN_BRANCH_VERSIONING = True
# MAIN_BRANCH_VERSIONING should be 'True' on main branch only
MAIN_BRANCH_VERSIONING = False

SCM_PRETEND_ENV_VAR = "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DUCKDB"
SCM_GLOBAL_PRETEND_ENV_VAR = "SETUPTOOLS_SCM_PRETEND_VERSION"
Expand Down
36 changes: 0 additions & 36 deletions external/README_GIT_SUBMODULE.md

This file was deleted.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ if.state = "editable"
if.env.COVERAGE = false
build-dir = "build/debug/"
editable.rebuild = true
editable.mode = "redirect"
cmake.build-type = "Debug"

# Separate override because we have to append to cmake.define with `inherit` in order not to overwrite other defines.
Expand Down
Loading