nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 208 lines 4.9 kB view raw
1{ 2 stdenv, 3 lib, 4 python3Packages, 5 fetchFromGitHub, 6 makeWrapper, 7 gdal, 8 geos, 9 fetchPnpmDeps, 10 pnpmConfigHook, 11 pnpm, 12 nodejs, 13 postgresql, 14 postgresqlTestHook, 15 playwright-driver, 16}: 17let 18 19 python = python3Packages.python.override { 20 packageOverrides = self: super: { 21 django_5 = super.django_5.override { withGdal = true; }; 22 django = super.django_5; 23 # custom python module part of froide 24 dogtail = super.buildPythonPackage { 25 pname = "dogtail"; 26 version = "0-unstable-2024-11-27"; 27 pyproject = true; 28 29 src = fetchFromGitHub { 30 owner = "okfde"; 31 repo = "dogtail"; 32 rev = "d2f341cab0f05ef4e193f0158fe5a64aadc5bae6"; 33 hash = "sha256-2lQZgvFXAz6q/3NpBcwckUologWxKmwXI0ZG5nylajg="; 34 }; 35 36 build-system = with super; [ setuptools ]; 37 }; 38 }; 39 }; 40 41in 42python.pkgs.buildPythonApplication rec { 43 pname = "froide"; 44 version = "0-unstable-2025-09-10"; 45 pyproject = true; 46 47 src = fetchFromGitHub { 48 owner = "okfde"; 49 repo = "froide"; 50 rev = "826415bbc402c3b71c62477f5eed112787169c95"; 51 hash = "sha256-K9TMtDfYP6v/lbL7SXeHBa6EngK+fsHgU13C1hat/K0="; 52 }; 53 54 patches = [ ./django_42_storages.patch ]; 55 56 # Relax dependency pinning 57 # Channels: https://github.com/okfde/froide/issues/995 58 pythonRelaxDeps = [ 59 "channels" 60 ]; 61 62 build-system = [ python.pkgs.setuptools ]; 63 64 nativeBuildInputs = [ 65 makeWrapper 66 nodejs 67 pnpmConfigHook 68 pnpm 69 ]; 70 71 dependencies = with python.pkgs; [ 72 celery 73 celery-singleton 74 channels 75 dj-database-url 76 django 77 django-celery-beat 78 django-celery-email 79 django-configurations 80 django-contrib-comments 81 django-crossdomainmedia 82 django-elasticsearch-dsl 83 django-filingcabinet 84 django-filter 85 django-json-widget 86 django-leaflet 87 django-mfa3 88 django-oauth-toolkit 89 django-parler 90 django-storages 91 django-taggit 92 django-treebeard 93 djangorestframework 94 djangorestframework-csv 95 djangorestframework-jsonp 96 dogtail 97 drf-spectacular 98 drf-spectacular-sidecar 99 easy-thumbnails 100 elasticsearch 101 elasticsearch-dsl 102 geoip2 103 icalendar 104 markdown 105 nh3 106 phonenumbers 107 pillow 108 pikepdf 109 psycopg 110 pygtail 111 pyisemail 112 pypdf 113 python-magic 114 python-mimeparse 115 python-slugify 116 requests 117 wand 118 weasyprint 119 websockets 120 ]; 121 122 pnpmDeps = fetchPnpmDeps { 123 inherit pname version src; 124 fetcherVersion = 1; 125 hash = "sha256-g7YX2fVXGmb3Qq9NNCb294bk4/0khcIZVSskYbE8Mdw="; 126 }; 127 128 postBuild = '' 129 pnpm run build 130 ''; 131 132 postInstall = '' 133 cp -r build manage.py $out/${python.sitePackages}/froide/ 134 makeWrapper $out/${python.sitePackages}/froide/manage.py $out/bin/froide \ 135 --prefix PYTHONPATH : "${python3Packages.makePythonPath dependencies}" \ 136 --set GDAL_LIBRARY_PATH "${gdal}/lib/libgdal.so" \ 137 --set GEOS_LIBRARY_PATH "${geos}/lib/libgeos_c.so" 138 ''; 139 140 nativeCheckInputs = with python.pkgs; [ 141 (postgresql.withPackages (p: [ p.postgis ])) 142 postgresqlTestHook 143 pytest-django 144 pytest-playwright 145 pytestCheckHook 146 ]; 147 148 checkInputs = with python.pkgs; [ 149 beautifulsoup4 150 pytest-asyncio 151 pytest-factoryboy 152 time-machine 153 ]; 154 155 disabledTests = [ 156 # Requires network connection: elastic_transport.ConnectionError 157 "test_search_similar" 158 "test_search" 159 "test_list_requests" 160 "test_list_jurisdiction_requests" 161 "test_tagged_requests" 162 "test_publicbody_requests" 163 "test_feed" 164 "test_request_list_filter_pagination" 165 "test_request_list_path_filter" 166 "test_web_page" 167 "test_autocomplete" 168 "test_list_no_identical" 169 "test_set_status" 170 "test_make_not_logged_in_request" 171 "test_make_logged_in_request" 172 # TypeError: Pygtail.with_offsets() got an unexpected keyword argument 173 "test_email_signal" 174 "test_pygtail_log_append" 175 "test_bouncing_email" 176 "test_multiple_partial" 177 "test_logfile_rotation" 178 # Test hangs 179 "test_collapsed_menu" 180 "test_make_request_logged_out_with_existing_account" 181 ]; 182 183 preCheck = '' 184 export PGUSER="froide" 185 export postgresqlEnableTCP=1 186 export postgresqlTestUserOptions="LOGIN SUPERUSER" 187 export GDAL_LIBRARY_PATH="${gdal}/lib/libgdal.so" 188 export GEOS_LIBRARY_PATH="${geos}/lib/libgeos_c.so" 189 '' 190 + lib.optionalString (!stdenv.hostPlatform.isRiscV) '' 191 export PLAYWRIGHT_BROWSERS_PATH="${playwright-driver.browsers}" 192 ''; 193 194 # Playwright tests not supported on RiscV yet 195 doCheck = lib.meta.availableOn stdenv.hostPlatform playwright-driver.browsers; 196 197 passthru = { 198 inherit python; 199 }; 200 201 meta = { 202 description = "Freedom of Information Portal"; 203 homepage = "https://github.com/okfde/froide"; 204 license = lib.licenses.mit; 205 maintainers = [ lib.maintainers.onny ]; 206 mainProgram = "froide"; 207 }; 208}