nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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.1.1";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "samuelcolvin";
23 repo = "watchfiles";
24 tag = "v${version}";
25 hash = "sha256-UlQnCYSNU9H4x31KenSfYExGun94ekrOCwajORemSco=";
26 };
27
28 cargoDeps = rustPlatform.fetchCargoVendor {
29 inherit pname src version;
30 hash = "sha256-6sxtH7KrwAWukPjLSMAebguPmeAHbC7YHOn1QiRPigs=";
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
55 preCheck = ''
56 rm -rf watchfiles
57 '';
58
59 disabledTests = [
60 # BaseExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
61 "test_awatch_interrupt_raise"
62 ];
63
64 pythonImportsCheck = [ "watchfiles" ];
65
66 meta = {
67 description = "File watching and code reload";
68 homepage = "https://watchfiles.helpmanual.io/";
69 changelog = "https://github.com/samuelcolvin/watchfiles/releases/tag/v${version}";
70 license = lib.licenses.mit;
71 maintainers = with lib.maintainers; [ fab ];
72 mainProgram = "watchfiles";
73 };
74}