diff options
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/duckdb')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/duckdb/default.nix | 48 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/duckdb/setup.patch | 30 |
2 files changed, 31 insertions, 47 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/duckdb/default.nix b/nixpkgs/pkgs/development/python-modules/duckdb/default.nix index a7cd1aa36dd4..fd197f9305d6 100644 --- a/nixpkgs/pkgs/development/python-modules/duckdb/default.nix +++ b/nixpkgs/pkgs/development/python-modules/duckdb/default.nix @@ -1,4 +1,5 @@ { lib +, stdenv , buildPythonPackage , duckdb , fsspec @@ -13,25 +14,24 @@ }: buildPythonPackage rec { - inherit (duckdb) pname version src; - format = "setuptools"; - - # 1. let nix control build cores - # 2. default to extension autoload & autoinstall disabled - # 3. unconstrain setuptools_scm version - patches = (duckdb.patches or []) ++ [ ./setup.patch ]; + inherit (duckdb) patches pname src version; + pyproject = true; postPatch = (duckdb.postPatch or "") + '' # we can't use sourceRoot otherwise patches don't apply, because the patches apply to the C++ library cd tools/pythonpkg - substituteInPlace setup.py --subst-var NIX_BUILD_CORES - - # avoid dependency on mypy - rm tests/stubs/test_stubs.py + # 1. let nix control build cores + # 2. default to extension autoload & autoinstall disabled + substituteInPlace setup.py \ + --replace-fail "ParallelCompile()" 'ParallelCompile("NIX_BUILD_CORES")' \ + --replace-fail "define_macros.extend([('DUCKDB_EXTENSION_AUTOLOAD_DEFAULT', '1'), ('DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT', '1')])" "" ''; - BUILD_HTTPFS = 1; + env = { + BUILD_HTTPFS = 1; + DUCKDB_BUILD_UNITY = 1; + }; nativeBuildInputs = [ pybind11 @@ -52,21 +52,35 @@ buildPythonPackage rec { pytestCheckHook ]; + # test flags from .github/workflows/Python.yml + pytestFlagsArray = [ + "--verbose" + ] ++ lib.optionals stdenv.isDarwin [ + "tests/fast" + ]; + + disabledTestPaths = [ + # avoid dependency on mypy + "tests/stubs/test_stubs.py" + ]; + disabledTests = [ # tries to make http request "test_install_non_existent_extension" - # test is racy and interrupt can be delivered before or after target point + + # https://github.com/duckdb/duckdb/issues/10702 + # tests are racy and interrupt can be delivered before or after target point + # causing a later test to fail with a spurious KeyboardInterrupt "test_connection_interrupt" + "test_query_interruption" ]; + # remove duckdb dir to prevent import confusion by pytest preCheck = '' export HOME="$(mktemp -d)" + rm -rf duckdb ''; - setupPyBuildFlags = [ - "--inplace" - ]; - pythonImportsCheck = [ "duckdb" ]; diff --git a/nixpkgs/pkgs/development/python-modules/duckdb/setup.patch b/nixpkgs/pkgs/development/python-modules/duckdb/setup.patch deleted file mode 100644 index 8c8f790a66a1..000000000000 --- a/nixpkgs/pkgs/development/python-modules/duckdb/setup.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/tools/pythonpkg/setup.py b/tools/pythonpkg/setup.py -index 30f1e1ccdd..6784169fcb 100644 ---- a/tools/pythonpkg/setup.py -+++ b/tools/pythonpkg/setup.py -@@ -96,7 +96,7 @@ def parallel_cpp_compile( - return - self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) - -- list(multiprocessing.pool.ThreadPool(multiprocessing.cpu_count()).imap(_single_compile, objects)) -+ list(multiprocessing.pool.ThreadPool(@NIX_BUILD_CORES@).imap(_single_compile, objects)) - return objects - - -@@ -163,7 +163,6 @@ if 'BUILD_HTTPFS' in os.environ: - for ext in extensions: - toolchain_args.extend(['-DDUCKDB_EXTENSION_{}_LINKED'.format(ext.upper())]) - --toolchain_args.extend(['-DDUCKDB_EXTENSION_AUTOLOAD_DEFAULT=1', '-DDUCKDB_EXTENSION_AUTOINSTALL_DEFAULT=1']) - - - class get_pybind_include(object): -@@ -348,7 +347,7 @@ setup( - packages=packages, - include_package_data=True, - python_requires='>=3.7.0', -- setup_requires=setup_requires + ["setuptools_scm<7.0.0", 'pybind11>=2.6.0'], -+ setup_requires=setup_requires + ["setuptools_scm", 'pybind11>=2.6.0'], - use_scm_version=setuptools_scm_conf, - tests_require=['google-cloud-storage', 'mypy', 'pytest'], - classifiers=[ |