1{ lib 2, stdenv 3, anyio 4, buildPythonPackage 5, fetchFromGitHub 6, rustPlatform 7, setuptools-rust 8, pythonOlder 9, dirty-equals 10, pytest-mock 11, pytest-timeout 12, pytestCheckHook 13, python 14}: 15 16buildPythonPackage rec { 17 pname = "watchfiles"; 18 version = "0.18.1"; 19 format = "pyproject"; 20 21 disabled = pythonOlder "3.7"; 22 23 src = fetchFromGitHub { 24 owner = "samuelcolvin"; 25 repo = pname; 26 rev = "refs/tags/v${version}"; 27 hash = "sha256-XEhu6M1hFi3/gAKZcei7KJSrIhhlZhlvZvbfyA6VLR4="; 28 }; 29 30 cargoDeps = rustPlatform.fetchCargoTarball { 31 inherit src; 32 name = "${pname}-${version}"; 33 hash = "sha256-IWONA3o+2emJ7cKEw5xYSMdWzGuUSwn1B70zUDzj7Cw="; 34 }; 35 36 nativeBuildInputs = [ 37 ] ++ (with rustPlatform; [ 38 cargoSetupHook 39 maturinBuildHook 40 rust.cargo 41 rust.rustc 42 ]); 43 44 propagatedBuildInputs = [ 45 anyio 46 ]; 47 48 checkInputs = [ 49 dirty-equals 50 pytest-mock 51 pytest-timeout 52 pytestCheckHook 53 ]; 54 55 postPatch = '' 56 sed -i "/^requires-python =.*/a version = '${version}'" pyproject.toml 57 ''; 58 59 preCheck = '' 60 rm -rf watchfiles 61 ''; 62 63 pythonImportsCheck = [ 64 "watchfiles" 65 ]; 66 67 meta = with lib; { 68 description = "File watching and code reload"; 69 homepage = "https://watchfiles.helpmanual.io/"; 70 license = licenses.mit; 71 maintainers = with maintainers; [ fab ]; 72 broken = stdenv.isDarwin; 73 }; 74}