1{ stdenv 2, lib 3, buildPythonPackage 4, pythonOlder 5, isPyPy 6, fetchPypi 7, postgresql 8, openssl 9, sphinxHook 10, sphinx-better-theme 11}: 12 13buildPythonPackage rec { 14 pname = "psycopg2"; 15 version = "2.9.5"; 16 format = "setuptools"; 17 18 # Extension modules don't work well with PyPy. Use psycopg2cffi instead. 19 # c.f. https://github.com/NixOS/nixpkgs/pull/104151#issuecomment-729750892 20 disabled = pythonOlder "3.6" || isPyPy; 21 22 src = fetchPypi { 23 inherit pname version; 24 sha256 = "sha256-pSRtLmg6ly4hh6hxS1ws+BVsBkYp+amxqHPBcw2eJFo="; 25 }; 26 27 outputs = [ "out" "doc" ]; 28 29 nativeBuildInputs = [ 30 postgresql 31 sphinxHook 32 sphinx-better-theme 33 ]; 34 35 buildInputs = lib.optionals stdenv.isDarwin [ 36 openssl 37 ]; 38 39 sphinxRoot = "doc/src"; 40 41 # Requires setting up a PostgreSQL database 42 doCheck = false; 43 44 pythonImportsCheck = [ 45 "psycopg2" 46 ]; 47 48 meta = with lib; { 49 description = "PostgreSQL database adapter for the Python programming language"; 50 homepage = "https://www.psycopg.org"; 51 license = with licenses; [ lgpl3Plus zpl20 ]; 52 maintainers = with maintainers; [ ]; 53 }; 54}