diff --git a/pkgs/development/python-modules/duckdb-engine/default.nix b/pkgs/development/python-modules/duckdb-engine/default.nix new file mode 100644 index 000000000000..fe7a95aba9bf --- /dev/null +++ b/pkgs/development/python-modules/duckdb-engine/default.nix @@ -0,0 +1,40 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +, pythonOlder +, duckdb +, hypothesis +, ipython-sql +, poetry-core +, sqlalchemy +}: +buildPythonPackage rec { + pname = "duckdb-engine"; + version = "0.1.8"; + format = "pyproject"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + repo = "duckdb_engine"; + owner = "Mause"; + rev = version; + hash = "sha256-dnm1nveCjrXFjDRykHp39AeVx7sk7Q/XwGn6hxdydT4="; + }; + + nativeBuildInputs = [ poetry-core ]; + + propagatedBuildInputs = [ duckdb sqlalchemy ]; + + checkInputs = [ pytestCheckHook hypothesis ipython-sql ]; + + pythonImportsCheck = [ "duckdb_engine" ]; + + meta = with lib; { + description = "Very very very basic sqlalchemy driver for duckdb"; + homepage = "https://github.com/Mause/duckdb_engine"; + license = licenses.mit; + maintainers = with maintainers; [ cpcloud ]; + }; +} diff --git a/pkgs/development/python-modules/ibis-framework/default.nix b/pkgs/development/python-modules/ibis-framework/default.nix index 39d226bb9564..dee63fb0856d 100644 --- a/pkgs/development/python-modules/ibis-framework/default.nix +++ b/pkgs/development/python-modules/ibis-framework/default.nix @@ -8,6 +8,9 @@ , clickhouse-driver , click , dask +, datafusion +, duckdb +, duckdb-engine , graphviz , importlib-metadata , multipledispatch @@ -15,50 +18,51 @@ , pandas , parsy , poetry-core +, poetry-dynamic-versioning , pyarrow -, pytest +, pydantic +, pytest-benchmark , pytest-mock , pytest-xdist +, python , pytz , regex , requests , sqlalchemy -, tables +, sqlite +, tabulate , toolz }: let # ignore tests for which dependencies are not available backends = [ - "csv" "dask" - "hdf5" + "datafusion" + "duckdb" "pandas" - "parquet" "sqlite" ]; - backendsString = lib.concatStringsSep " " backends; - ibisTestingData = fetchFromGitHub { owner = "ibis-project"; repo = "testing-data"; - rev = "743201a35c6b968cf55b054f9d28949ea15d1f0a"; - sha256 = "sha256-xuSE6wHP3aF8lnEE2SuFbTRBu49ecRmc1F3HPcszptI="; + rev = "a88a4b3c3b54a88e7f77e59de70f5bf20fb62f19"; + sha256 = "sha256-BnRhVwPcWFwiBJ2ySgiiuUdnF4gesnTq1/dLcuvc868="; }; in buildPythonPackage rec { pname = "ibis-framework"; - version = "2.1.1"; + version = "3.0.2"; format = "pyproject"; - disabled = pythonOlder "3.7"; + disabled = pythonOlder "3.8"; src = fetchFromGitHub { repo = "ibis"; owner = "ibis-project"; rev = version; - hash = "sha256-n3fR6wvcSfIo7760seB+5SxtoYSqQmqkzZ9VlNQF200="; + hash = "sha256-7ywDMAHQAl39kiHfxVkq7voUEKqbb9Zq8qlaug7+ukI="; }; nativeBuildInputs = [ poetry-core ]; @@ -68,65 +72,48 @@ buildPythonPackage rec { cached-property clickhouse-driver dask + datafusion + duckdb + duckdb-engine graphviz + importlib-metadata multipledispatch numpy pandas parsy + poetry-dynamic-versioning pyarrow + pydantic pytz regex requests sqlalchemy - tables + tabulate toolz - ] ++ lib.optionals (pythonOlder "3.8" && lib.versionOlder version "3.0.0") [ - importlib-metadata ]; checkInputs = [ pytestCheckHook click - pytest + pytest-benchmark pytest-mock pytest-xdist + sqlite ]; - postPatch = '' - substituteInPlace pyproject.toml \ - --replace 'atpublic = ">=2.3,<3"' 'atpublic = ">=2.3"' \ - --replace 'regex = "^2021.7.6"' 'regex = "*"' - ''; - preBuild = '' # setup.py exists only for developer convenience and is automatically generated rm setup.py ''; - disabledTests = [ - # These tests are broken upstream: https://github.com/ibis-project/ibis/issues/3291 - "test_summary_numeric" - "test_summary_non_numeric" - "test_batting_most_hits" - "test_join_with_window_function" - "test_where_long" - "test_quantile_groupby" - "test_summary_numeric" - "test_summary_numeric_group_by" - "test_summary_non_numeric" - "test_searched_case_column" - "test_simple_case_column" - "test_summary_non_numeric_group_by" - ]; - pytestFlagsArray = [ - "ibis/tests" - "ibis/backends/tests" - "ibis/backends/{${lib.concatStringsSep "," backends}}/tests" + "--dist=loadgroup" + "-m" + "'${lib.concatStringsSep " or " backends} or core'" ]; preCheck = '' - set -euo pipefail + set -eo pipefail export IBIS_TEST_DATA_DIRECTORY IBIS_TEST_DATA_DIRECTORY="$(mktemp -d)" @@ -138,13 +125,13 @@ buildPythonPackage rec { find "$IBIS_TEST_DATA_DIRECTORY" -type f -exec chmod u+rw {} + # load data - for backend in ${backendsString}; do - python ci/datamgr.py "$backend" & + for backend in ${lib.concatStringsSep " " backends}; do + ${python.interpreter} ci/datamgr.py load "$backend" done + ''; - wait - '' + lib.optionalString (lib.versionOlder version "3.0.0") '' - export PYTEST_BACKENDS="${backendsString}" + postCheck = '' + rm -r "$IBIS_TEST_DATA_DIRECTORY" ''; pythonImportsCheck = [ diff --git a/pkgs/development/python-modules/ipython-sql/default.nix b/pkgs/development/python-modules/ipython-sql/default.nix new file mode 100644 index 000000000000..1a86ae238be3 --- /dev/null +++ b/pkgs/development/python-modules/ipython-sql/default.nix @@ -0,0 +1,58 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pythonOlder +, ipython +, ipython_genutils +, pandas +, prettytable +, pytest +, sqlalchemy +, sqlparse +}: +buildPythonPackage rec { + pname = "ipython-sql"; + version = "0.4.0"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "catherinedevlin"; + repo = "ipython-sql"; + rev = "117764caf099d80100ed4b09fc004b55eed6f121"; + hash = "sha256-ScQihsvRSnC7VIgy8Tzi1z4x6KIZo0SAeLPvHAVdrfA="; + }; + + postPatch = '' + substituteInPlace setup.py --replace 'prettytable<1' prettytable + ''; + + propagatedBuildInputs = [ + ipython + ipython_genutils + prettytable + sqlalchemy + sqlparse + ]; + + checkInputs = [ ipython pandas pytest ]; + + checkPhase = '' + runHook preCheck + + # running with ipython is required because the tests use objects available + # only inside of ipython, for example the global `get_ipython()` function + ipython -c 'import pytest; pytest.main()' + + runHook postCheck + ''; + + pythonImportsCheck = [ "sql" ]; + + meta = with lib; { + description = "Introduces a %sql (or %%sql) magic."; + homepage = "https://github.com/catherinedevlin/ipython-sql"; + license = licenses.mit; + maintainers = with maintainers; [ cpcloud ]; + }; +} diff --git a/pkgs/development/python-modules/poetry-dynamic-versioning/default.nix b/pkgs/development/python-modules/poetry-dynamic-versioning/default.nix new file mode 100644 index 000000000000..35265b94e17d --- /dev/null +++ b/pkgs/development/python-modules/poetry-dynamic-versioning/default.nix @@ -0,0 +1,52 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +, pythonOlder +, dunamai +, jinja2 +, markupsafe +, poetry-core +, pytest +, tomlkit +}: +buildPythonPackage rec { + pname = "poetry-dynamic-versioning"; + version = "0.14.1"; + format = "pyproject"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "mtkennerly"; + repo = pname; + rev = "v${version}"; + hash = "sha256-J/93BFyp+XBy9TRAzAM64ZcMurHxcXDTukOGJE5yvBk="; + }; + + nativeBuildInputs = [ poetry-core ]; + + propagatedBuildInputs = [ + dunamai + tomlkit + jinja2 + markupsafe + ]; + + checkInputs = [ pytestCheckHook ]; + + disabledTests = [ + # these require .git, but leaveDotGit = true doesn't help + "test__get_version__defaults" + "test__get_version__format_jinja" + ]; + + pythonImportsCheck = [ "poetry_dynamic_versioning" ]; + + meta = with lib; { + description = "Plugin for Poetry to enable dynamic versioning based on VCS tags"; + homepage = "https://github.com/mtkennerly/poetry-dynamic-versioning"; + license = licenses.mit; + maintainers = with maintainers; [ cpcloud ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 51100fb611a7..12b1515dbcd4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2530,6 +2530,8 @@ in { inherit (pkgs) duckdb; }; + duckdb-engine = callPackage ../development/python-modules/duckdb-engine { }; + duecredit = callPackage ../development/python-modules/duecredit { }; duet = callPackage ../development/python-modules/duet { }; @@ -4193,6 +4195,8 @@ in { ipython = callPackage ../development/python-modules/ipython { }; + ipython-sql = callPackage ../development/python-modules/ipython-sql { }; + ipyvue = callPackage ../development/python-modules/ipyvue { }; ipyvuetify = callPackage ../development/python-modules/ipyvuetify { }; @@ -6509,6 +6513,8 @@ in { poetry-core = callPackage ../development/python-modules/poetry-core { }; + poetry-dynamic-versioning = callPackage ../development/python-modules/poetry-dynamic-versioning { }; + poetry-semver = callPackage ../development/python-modules/poetry-semver { }; poetry2conda = callPackage ../development/python-modules/poetry2conda { };