diff --git a/nixos/modules/services/misc/paperless.nix b/nixos/modules/services/misc/paperless.nix index db2406603c39..c6c6522114a8 100644 --- a/nixos/modules/services/misc/paperless.nix +++ b/nixos/modules/services/misc/paperless.nix @@ -38,12 +38,8 @@ let PAPERLESS_REDIS = "unix://${redisServer.unixSocket}"; } // lib.optionalAttrs (cfg.settings.PAPERLESS_AI_ENABLED or true) { - NLTK_DATA = cfg.package.nltkDataDir; TIKTOKEN_CACHE_DIR = cfg.package.tiktokenCacheDir; } - // lib.optionalAttrs (cfg.settings.PAPERLESS_ENABLE_NLTK or true) { - PAPERLESS_NLTK_DIR = cfg.package.nltkDataDir; - } // lib.optionalAttrs (cfg.openMPThreadingWorkaround) { OMP_NUM_THREADS = "1"; } diff --git a/pkgs/by-name/pa/paperless-ngx/frontend.nix b/pkgs/by-name/pa/paperless-ngx/frontend.nix index 0afd491d0625..433e05cee3fb 100644 --- a/pkgs/by-name/pa/paperless-ngx/frontend.nix +++ b/pkgs/by-name/pa/paperless-ngx/frontend.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation (finalAttrs: { inherit pnpm; inherit (finalAttrs) pname version src; fetcherVersion = 4; - hash = "sha256-YYj6ZywzdQRyrCfTThbJz6gFiaiuYvXUzEpxvXT6zho="; + hash = "sha256-xVo3+C3VtPcuLynyuUC1KYVrBiWWyT1f7SDPZI8Pzic="; }; nativeBuildInputs = [ diff --git a/pkgs/by-name/pa/paperless-ngx/package.nix b/pkgs/by-name/pa/paperless-ngx/package.nix index ff56e114cbfc..7ee1e1bbe025 100644 --- a/pkgs/by-name/pa/paperless-ngx/package.nix +++ b/pkgs/by-name/pa/paperless-ngx/package.nix @@ -17,8 +17,6 @@ tesseract5, poppler-utils, liberation_ttf, - symlinkJoin, - nltk-data, lndir, nix-update-script, extraPythonPackageOverrides ? (_final: _prev: { }), @@ -47,15 +45,6 @@ let poppler-utils ]; - nltkDataDir = symlinkJoin { - name = "paperless-ngx-nltk-data"; - paths = with nltk-data; [ - punkt-tab - snowball-data - stopwords - ]; - }; - # The paperless_ai want tiktoken's cl100k_base tokenizer. If not provided, they would try to download them and fail. # Seed tiktoken's on-disk cache instead so the tests can run and succeed offline; it keys cached files by sha1 of the download URL. tiktokenCacheDir = linkFarm "paperless-ngx-tiktoken-cache" [ @@ -70,14 +59,14 @@ let in pythonPackages.buildPythonApplication (finalAttrs: { pname = "paperless-ngx"; - version = "3.1.3"; + version = "3.2.1"; pyproject = true; src = fetchFromGitHub { owner = "paperless-ngx"; repo = "paperless-ngx"; tag = "v${finalAttrs.version}"; - hash = "sha256-iTNl+TGs9NbbPl1Z+Y7z5DaBIv//Fcq21A9zhkmqIuw="; + hash = "sha256-z9M3BS4YbWyr3Y2RepSYyzZHumL4ohqivt5NXSncucg="; }; postPatch = '' @@ -152,7 +141,6 @@ pythonPackages.buildPythonApplication (finalAttrs: { llama-index-llms-ollama llama-index-llms-openai-like mysqlclient - nltk ocrmypdf openai pathvalidate @@ -176,11 +164,15 @@ pythonPackages.buildPythonApplication (finalAttrs: { torch watchfiles whitenoise + whoosh-compat zxing-cpp ] ++ django-allauth.optional-dependencies.mfa ++ django-allauth.optional-dependencies.socialaccount - ++ redis.optional-dependencies.hiredis; + ++ gotenberg-client.optional-dependencies.httpx + ++ redis.optional-dependencies.hiredis + ++ tika-client.optional-dependencies.httpx + ++ whoosh-compat.optional-dependencies.tantivy; postBuild = '' # v3 rejects the default secret key at import, which the manage.py calls below hit. @@ -254,7 +246,6 @@ pythonPackages.buildPythonApplication (finalAttrs: { export PATH="${path}:$PATH" export HOME=$(mktemp -d) export XDG_DATA_DIRS="${liberation_ttf}/share:$XDG_DATA_DIRS" - export PAPERLESS_NLTK_DIR=${finalAttrs.passthru.nltkDataDir} # Limit threads per worker based on NIX_BUILD_CORES, capped at 256 # ocrmypdf has an internal limit of 256 jobs and will fail with more: # https://github.com/ocrmypdf/OCRmyPDF/blob/66308c281306302fac3470f587814c3b212d0c40/src/ocrmypdf/cli.py#L234 @@ -294,7 +285,6 @@ pythonPackages.buildPythonApplication (finalAttrs: { meta = removeAttrs finalAttrs.meta [ "mainProgram" ]; }; inherit - nltkDataDir path tesseract5 tiktokenCacheDir diff --git a/pkgs/development/python-modules/django-oauth-toolkit/default.nix b/pkgs/development/python-modules/django-oauth-toolkit/default.nix index 51ad16e5c39b..9fb7271aef20 100644 --- a/pkgs/development/python-modules/django-oauth-toolkit/default.nix +++ b/pkgs/development/python-modules/django-oauth-toolkit/default.nix @@ -15,7 +15,7 @@ django-ninja, djangorestframework, pytest-cov-stub, - pytest-django, + pytest-django_4_12, pytest-mock, pytest-xdist, pytestCheckHook, @@ -51,7 +51,7 @@ buildPythonPackage (finalAttrs: { django-ninja djangorestframework pytest-cov-stub - pytest-django + pytest-django_4_12 pytest-mock pytest-xdist pytestCheckHook diff --git a/pkgs/development/python-modules/django-valkey/default.nix b/pkgs/development/python-modules/django-valkey/default.nix index debe76ca11a5..b4b3c7fea2ca 100644 --- a/pkgs/development/python-modules/django-valkey/default.nix +++ b/pkgs/development/python-modules/django-valkey/default.nix @@ -17,7 +17,7 @@ # testing anyio, - pytest-django, + pytest-django_4_12, pytest-mock, pytestCheckHook, redisTestHook, @@ -56,7 +56,7 @@ buildPythonPackage rec { nativeCheckInputs = [ anyio - pytest-django + pytest-django_4_12 pytest-mock pytestCheckHook redisTestHook # contains valkey diff --git a/pkgs/development/python-modules/django-vtasks/default.nix b/pkgs/development/python-modules/django-vtasks/default.nix index 8fd95cd6ffd8..56c1edffa678 100644 --- a/pkgs/development/python-modules/django-vtasks/default.nix +++ b/pkgs/development/python-modules/django-vtasks/default.nix @@ -23,14 +23,14 @@ buildPythonPackage rec { pname = "django-vtasks"; - version = "3.1.0"; + version = "3.2.0"; pyproject = true; src = fetchFromGitLab { owner = "glitchtip"; repo = "django-vtasks"; tag = "v${version}"; - hash = "sha256-Ny6dgW8XOpBsGi4wdxVGGFYH9ZQxtKKdRa0LHxlJMrU="; + hash = "sha256-nxQxInYp2GW3U3iY8sfUyLO2sK/hStKeMzyHhas8Euc="; }; postPatch = '' @@ -74,7 +74,8 @@ buildPythonPackage rec { pytest-django pytestCheckHook redisTestHook # contains valkey - ]; + ] + ++ psycopg.optional-dependencies.pool; meta = { description = "Very fast valkey/postgres django tasks backend"; diff --git a/pkgs/development/python-modules/gotenberg-client/default.nix b/pkgs/development/python-modules/gotenberg-client/default.nix index 36cc2a81e674..08acec742836 100644 --- a/pkgs/development/python-modules/gotenberg-client/default.nix +++ b/pkgs/development/python-modules/gotenberg-client/default.nix @@ -4,17 +4,20 @@ fetchFromGitHub, hatchling, httpx, + niquests, + python-magic, + requests, }: buildPythonPackage rec { pname = "gotenberg-client"; - version = "0.14.0"; + version = "1.0.0"; pyproject = true; src = fetchFromGitHub { owner = "stumpylog"; repo = "gotenberg-client"; tag = version; - hash = "sha256-BS/QGapok9iaFNfI3G55F0H4CKHPHS85Qs4G6nt043s="; + hash = "sha256-NgfqUgtD70XvpFee8e32rTPe3TOS+JdmCnefzFY4gNY="; }; build-system = [ hatchling ]; @@ -24,6 +27,13 @@ buildPythonPackage rec { ] ++ httpx.optional-dependencies.http2; + optional-dependencies = { + httpx = [ httpx ] ++ httpx.optional-dependencies.http2; + magic = [ python-magic ]; + niquests = [ niquests ]; + requests = [ requests ]; + }; + # requires running gotenberg service doCheck = false; diff --git a/pkgs/development/python-modules/pytest-django/default.nix b/pkgs/development/python-modules/pytest-django/default.nix index fc5cb01cf15d..e6efe6052994 100644 --- a/pkgs/development/python-modules/pytest-django/default.nix +++ b/pkgs/development/python-modules/pytest-django/default.nix @@ -12,13 +12,13 @@ buildPythonPackage (finalAttrs: { pname = "pytest-django"; - version = "4.12.0"; + version = "4.14.0"; pyproject = true; src = fetchPypi { pname = "pytest_django"; inherit (finalAttrs) version; - hash = "sha256-35TsgZqDyJecj23hPZzfvnbowh05Rzz+K0DJ/Jvjx1g="; + hash = "sha256-Jnh90/Qiz7q49VuAp3bi7ep6EQkst06WC+8TElFXCO8="; }; build-system = [ diff --git a/pkgs/development/python-modules/pytest-django_4_12/default.nix b/pkgs/development/python-modules/pytest-django_4_12/default.nix new file mode 100644 index 000000000000..fc5cb01cf15d --- /dev/null +++ b/pkgs/development/python-modules/pytest-django_4_12/default.nix @@ -0,0 +1,56 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + django, + setuptools, + setuptools-scm, + django-configurations, + pytest, + pytestCheckHook, +}: + +buildPythonPackage (finalAttrs: { + pname = "pytest-django"; + version = "4.12.0"; + pyproject = true; + + src = fetchPypi { + pname = "pytest_django"; + inherit (finalAttrs) version; + hash = "sha256-35TsgZqDyJecj23hPZzfvnbowh05Rzz+K0DJ/Jvjx1g="; + }; + + build-system = [ + setuptools + setuptools-scm + ]; + + buildInputs = [ pytest ]; + + dependencies = [ django ]; + + nativeCheckInputs = [ + django-configurations + # pytest-xidst causes random errors in the form of: django.db.utils.OperationalError: no such table: app_item + pytestCheckHook + ]; + + preCheck = '' + # bring pytest_django_test module into PYTHONPATH + export PYTHONPATH="$PWD:$PYTHONPATH" + + # test the lightweight sqlite flavor + export DJANGO_SETTINGS_MODULE="pytest_django_test.settings_sqlite" + ''; + + __darwinAllowLocalNetworking = true; + + meta = { + changelog = "https://github.com/pytest-dev/pytest-django/blob/v${finalAttrs.version}/docs/changelog.rst"; + description = "Pytest plugin for testing of Django applications"; + homepage = "https://pytest-django.readthedocs.org/en/latest/"; + license = lib.licenses.bsd3; + maintainers = [ ]; + }; +}) diff --git a/pkgs/development/python-modules/tika-client/default.nix b/pkgs/development/python-modules/tika-client/default.nix index 704dddf4a74f..8734b178f890 100644 --- a/pkgs/development/python-modules/tika-client/default.nix +++ b/pkgs/development/python-modules/tika-client/default.nix @@ -5,18 +5,20 @@ anyio, hatchling, httpx, + niquests, + requests, }: buildPythonPackage rec { pname = "tika-client"; - version = "0.11.0"; + version = "1.0.0"; pyproject = true; src = fetchFromGitHub { owner = "stumpylog"; repo = "tika-client"; tag = version; - hash = "sha256-vVS+1RmJVURz25jlABsJBqL02GgAY18AeWag0GUmRWQ="; + hash = "sha256-ZXtNHjdbAzur6lRZIom+wDMhXgpqQxvHPQMxjXJDwlw="; }; build-system = [ hatchling ]; @@ -26,6 +28,12 @@ buildPythonPackage rec { httpx ]; + optional-dependencies = { + httpx = [ httpx ]; + niquests = [ niquests ]; + requests = [ requests ]; + }; + pythonImportsCheck = [ "tika_client" ]; # The tests expect the tika-server to run in a docker container diff --git a/pkgs/development/python-modules/whoosh-compat/default.nix b/pkgs/development/python-modules/whoosh-compat/default.nix new file mode 100644 index 000000000000..8f612898d8fe --- /dev/null +++ b/pkgs/development/python-modules/whoosh-compat/default.nix @@ -0,0 +1,51 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + hatchling, + hypothesis, + pytestCheckHook, + python-dateutil, + tantivy, + whoosh, +}: + +buildPythonPackage (finalAttrs: { + pname = "whoosh-compat"; + version = "0.3.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "stumpylog"; + repo = "whoosh-compat"; + tag = "v${finalAttrs.version}"; + hash = "sha256-DmPrNoOGzgTDwHh1GqyTJ7PkXWu2rbWrvNj+8fnjcpE="; + }; + + build-system = [ hatchling ]; + + dependencies = [ + python-dateutil + ]; + + optional-dependencies = { + tantivy = [ tantivy ]; + }; + + nativeCheckInputs = [ + hypothesis + pytestCheckHook + whoosh + ] + ++ finalAttrs.passthru.optional-dependencies.tantivy; + + pythonImportsCheck = [ "whoosh_compat" ]; + + meta = { + description = "Whoosh query-language parser emitting programmatic tantivy queries"; + homepage = "https://github.com/stumpylog/whoosh-compat/"; + changelog = "https://github.com/stumpylog/whoosh-compat/blob/${finalAttrs.src.tag}/CHANGELOG.md"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ SuperSandro2000 ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d61c14f995ef..fa2008778f5f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -16510,6 +16510,8 @@ self: super: with self; { pytest-django = callPackage ../development/python-modules/pytest-django { }; + pytest-django_4_12 = callPackage ../development/python-modules/pytest-django_4_12 { }; + pytest-docker = callPackage ../development/python-modules/pytest-docker { }; pytest-docker-tools = callPackage ../development/python-modules/pytest-docker-tools { }; @@ -22663,6 +22665,8 @@ self: super: with self; { whoosh = callPackage ../development/python-modules/whoosh { }; + whoosh-compat = callPackage ../development/python-modules/whoosh-compat { }; + whoosh-reloaded = callPackage ../development/python-modules/whoosh-reloaded { }; widgetsnbextension = callPackage ../development/python-modules/widgetsnbextension { };