1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 rustPlatform, 6 anyio, 7 8 # tests 9 dirty-equals, 10 pytest-mock, 11 pytest-timeout, 12 pytestCheckHook, 13 versionCheckHook, 14}: 15 16buildPythonPackage rec { 17 pname = "watchfiles"; 18 version = "1.0.5"; 19 pyproject = true; 20 21 src = fetchFromGitHub { 22 owner = "samuelcolvin"; 23 repo = "watchfiles"; 24 tag = "v${version}"; 25 hash = "sha256-a6SHqYRNMGXNkVvwj9RpLj449dAQtWXO44v1ko5suaw="; 26 }; 27 28 cargoDeps = rustPlatform.fetchCargoVendor { 29 inherit pname src version; 30 hash = "sha256-2RMWxeOjitbEqer9+ETpMX9WxHEiPzVmEv7LpSiaRVg="; 31 }; 32 33 nativeBuildInputs = [ 34 rustPlatform.cargoSetupHook 35 rustPlatform.maturinBuildHook 36 ]; 37 38 dependencies = [ 39 anyio 40 ]; 41 42 # Tests need these permissions in order to use the FSEvents API on macOS. 43 sandboxProfile = '' 44 (allow mach-lookup (global-name "com.apple.FSEvents")) 45 ''; 46 47 nativeCheckInputs = [ 48 dirty-equals 49 pytest-mock 50 pytest-timeout 51 pytestCheckHook 52 versionCheckHook 53 ]; 54 versionCheckProgramArg = "--version"; 55 56 preCheck = '' 57 rm -rf watchfiles 58 ''; 59 60 disabledTests = [ 61 # BaseExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) 62 "test_awatch_interrupt_raise" 63 ]; 64 65 pythonImportsCheck = [ "watchfiles" ]; 66 67 meta = { 68 description = "File watching and code reload"; 69 homepage = "https://watchfiles.helpmanual.io/"; 70 changelog = "https://github.com/samuelcolvin/watchfiles/releases/tag/v${version}"; 71 license = lib.licenses.mit; 72 maintainers = with lib.maintainers; [ fab ]; 73 mainProgram = "watchfiles"; 74 }; 75}