summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/bt-decode/default.nix
blob: 94a4714a1bc01d1ff9987689a80e4177c67fcdfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  rustPlatform,
  toml,
  pytestCheckHook,
}:

buildPythonPackage (finalAttrs: {
  pname = "bt-decode";
  version = "0.8.0";
  pyproject = true;

  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "latent-to";
    repo = "bt-decode";
    tag = "v${finalAttrs.version}";
    hash = "sha256-jpCnYKoTVq2NCxE1vZhJzSagXtx43efDSdA5jWsZ95k=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit (finalAttrs) pname version src;
    hash = "sha256-qj4S1104HaFs6JePwgBjAI/4z7aH71Wq9CDvnSxlXmM=";
  };

  nativeBuildInputs = with rustPlatform; [
    cargoSetupHook
    maturinBuildHook
  ];

  dependencies = [ toml ];

  nativeCheckInputs = [ pytestCheckHook ];

  # these tests compare against bittensor, which is not in nixpkgs
  disabledTestPaths = [
    "tests/test_decode_delegate_info.py"
    "tests/test_decode_neurons.py"
    "tests/test_decode_stake_info.py"
    "tests/test_decode_subnet_hyp.py"
    "tests/test_decode_subnet_info.py"
  ];

  pythonImportsCheck = [ "bt_decode" ];

  meta = {
    description = "Fast SCALE decoding of Bittensor data structures";
    longDescription = "A python wrapper around the rust scale-codec crate for fast scale-decoding of Bittensor data structures.";
    homepage = "https://github.com/latent-to/bt-decode";
    changelog = "https://github.com/latent-to/bt-decode/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ kilyanni ];
  };
})