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
20 changes: 8 additions & 12 deletions .github/workflows/Python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
env:
CIBW_BUILD: 'cp39-manylinux_x86_64'
CIBW_TEST_COMMAND: 'python -m pytest {project}/tests --verbose'
SETUPTOOLS_SCM_NO_LOCAL: 'yes'
PYTEST_TIMEOUT: '600'

steps:
Expand All @@ -62,7 +61,7 @@ jobs:

- name: Install
shell: bash
run: pip install cibuildwheel twine
run: pip install cibuildwheel twine build

- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main
Expand All @@ -74,7 +73,7 @@ jobs:
shell: bash
working-directory: tools/pythonpkg
run: |
python setup.py sdist
pyproject-build . --sdist
mkdir duckdb_tarball && tar xvf dist/duckdb-*.tar.gz --strip-components=1 -C duckdb_tarball
- name: Build
shell: bash
Expand Down Expand Up @@ -152,7 +151,6 @@ jobs:
CIBW_BUILD: ${{ matrix.python_build}}
CIBW_SKIP: '*-musllinux_aarch64'
CIBW_ARCHS: ${{ matrix.arch == 'aarch64' && 'aarch64' || 'auto64' }}
SETUPTOOLS_SCM_NO_LOCAL: 'yes'
PYTEST_TIMEOUT: '600'
DUCKDB_BUILD_UNITY: 1

Expand All @@ -172,7 +170,7 @@ jobs:
- name: Install
shell: bash
run: |
pip install cibuildwheel twine
pip install cibuildwheel twine build
python -m pip install numpy --config-settings=setup-args="-Dallow-noblas=true"

- uses: actions/download-artifact@v3
Expand All @@ -196,7 +194,7 @@ jobs:
shell: bash
run: |
cd tools/pythonpkg
python setup.py sdist
pyproject-build . --sdist
mkdir duckdb_tarball && tar xvf dist/duckdb-*.tar.gz --strip-components=1 -C duckdb_tarball
ls duckdb_tarball
export DISTUTILS_C_COMPILER_LAUNCHER=ccache
Expand Down Expand Up @@ -230,7 +228,6 @@ jobs:
CIBW_BUILD: ${{ matrix.python_build}}
CIBW_ARCHS: 'x86_64 universal2 arm64'
CIBW_TEST_COMMAND: 'python -m pytest {project}/tests/fast --verbose'
SETUPTOOLS_SCM_NO_LOCAL: 'yes'
TWINE_USERNAME: '__token__'
DUCKDB_BUILD_UNITY: 1

Expand All @@ -245,7 +242,7 @@ jobs:

- name: Install
shell: bash
run: pip install cibuildwheel twine
run: pip install cibuildwheel twine build

- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main
Expand All @@ -257,7 +254,7 @@ jobs:
shell: bash
run: |
cd tools/pythonpkg
python setup.py sdist
pyproject-build . --sdist
mkdir duckdb_tarball && tar xvf dist/duckdb-*.tar.gz --strip-components=1 -C duckdb_tarball
export DISTUTILS_C_COMPILER_LAUNCHER=ccache
# TODO: Use ccache inside container, see https://github.com/pypa/cibuildwheel/issues/1030
Expand Down Expand Up @@ -297,7 +294,6 @@ jobs:

env:
CIBW_BUILD: ${{ matrix.python_build}}
SETUPTOOLS_SCM_NO_LOCAL: 'yes'
SETUPTOOLS_USE_DISTUTILS: 'stdlib'
TWINE_USERNAME: '__token__'
DUCKDB_BUILD_UNITY: 1
Expand All @@ -313,7 +309,7 @@ jobs:

- name: Install
shell: bash
run: pip install cibuildwheel twine
run: pip install cibuildwheel twine build

- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main
Expand All @@ -325,7 +321,7 @@ jobs:
shell: bash
run: |
cd tools/pythonpkg
python setup.py sdist
pyproject-build . --sdist
mkdir duckdb_tarball && tar xvf dist/duckdb-*.tar.gz --strip-components=1 -C duckdb_tarball
export DISTUTILS_C_COMPILER_LAUNCHER=ccache
# TODO: Use ccache inside container, see https://github.com/pypa/cibuildwheel/issues/1030
Expand Down
11 changes: 6 additions & 5 deletions tools/pythonpkg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Note that this will override any existing DuckDB installation you might have. Yo
source .venv/bin/activate
BUILD_PYTHON=1 make

You can also directly invoke the setup.py script from the `tools/pythonpkg` environment.
You can also directly invoke pip from the `tools/pythonpkg` environment.

cd tools/pythonpkg
python3 setup.py install
python3 -m pip install .

Alternatively, using virtualenv and pip:

Expand All @@ -49,9 +49,10 @@ storage from a notebook.

First, get the repository based version number and extract the source distribution.

python3 -m pip install build # required for pep517 compliant source dists
cd tools/pythonpkg
export SETUPTOOLS_SCM_PRETEND_VERSION=$(python setup.py --version)
python setup.py sdist
export SETUPTOOLS_SCM_PRETEND_VERSION=$(python3 -m setuptools_scm)
pyproject-build . --sdist
cd ../..

Next, copy over the python package related files, and install the package.
Expand Down Expand Up @@ -108,7 +109,7 @@ All the above should be done in a virtualenv.

## Clang-tidy and CMakeLists

The pythonpkg does not use the CMakeLists for compilation, for that it uses `setup.py` and `package_build.py` mostly.
The pythonpkg does not use the CMakeLists for compilation, for that it uses pip and `package_build.py` mostly.
But we still have CMakeLists in the pythonpkg, for tidy-check and intellisense purposes.
For this reason it might not be instantly apparent that the CMakeLists are incorrectly set up, and will only result in a very confusing CI failure of TidyCheck.

Expand Down
2 changes: 1 addition & 1 deletion tools/pythonpkg/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
root = "../.."
local_scheme = {env = "SETUPTOOLS_SCM_LOCAL_SCHEME", default = "no-local-version"}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find any evidence of env/default being supported by setuptools_scm

local_scheme = "no-local-version"

### CI Builwheel configurations ###

Expand Down
4 changes: 0 additions & 4 deletions tools/pythonpkg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@ def list_source_files(directory):
else:
setup_requires = []

setuptools_scm_conf = {"root": "../..", "relative_to": __file__}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines weren't used anymore anyway

if os.getenv('SETUPTOOLS_SCM_NO_LOCAL', 'no') != 'no':
setuptools_scm_conf['local_scheme'] = 'no-local-version'


# data files need to be formatted as [(directory, [files...]), (directory2, [files...])]
# no clue why the setup script can't do this automatically, but hey
Expand Down
5 changes: 5 additions & 0 deletions tools/pythonpkg/tests/fast/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import duckdb


def test_version():
assert duckdb.__version__ != "0.0.0"