1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # nativeBuildInputs
7 rustPlatform,
8
9 # tests
10 anyio,
11 objsize,
12 pydantic,
13 pytestCheckHook,
14 trio,
15 y-py,
16
17 nix-update-script,
18}:
19
20buildPythonPackage rec {
21 pname = "pycrdt";
22 version = "0.12.37";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "y-crdt";
27 repo = "pycrdt";
28 tag = version;
29 hash = "sha256-jcp7rxpnNMa0xS+ig9CX4Mwzk05PuzhfkiAFYLoaAQI=";
30 };
31
32 postPatch = ''
33 cp ${./Cargo.lock} Cargo.lock
34 '';
35
36 cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
37
38 nativeBuildInputs = [
39 rustPlatform.cargoSetupHook
40 rustPlatform.maturinBuildHook
41 ];
42
43 dependencies = [ anyio ];
44
45 pythonImportsCheck = [ "pycrdt" ];
46
47 nativeCheckInputs = [
48 anyio
49 objsize
50 pydantic
51 pytestCheckHook
52 trio
53 y-py
54 ];
55
56 pytestFlags = [
57 "-Wignore::pytest.PytestUnknownMarkWarning" # requires unpackaged pytest-mypy-testing
58 ];
59
60 passthru.updateScript = nix-update-script { extraArgs = [ "--generate-lockfile" ]; };
61
62 meta = {
63 description = "CRDTs based on Yrs";
64 homepage = "https://github.com/jupyter-server/pycrdt";
65 changelog = "https://github.com/jupyter-server/pycrdt/blob/${version}/CHANGELOG.md";
66 license = lib.licenses.mit;
67 teams = [ lib.teams.jupyter ];
68 };
69}